Kea  1.5.0
context.h
Go to the documentation of this file.
1 // Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef CONTEXT_H
8 #define CONTEXT_H
9 
10 #include <stats/observation.h>
11 #include <boost/shared_ptr.hpp>
12 #include <string>
13 
14 namespace isc {
15 namespace stats {
16 
18 class DuplicateStat : public Exception {
19 public:
20  DuplicateStat(const char* file, size_t line, const char* what) :
21  isc::Exception(file, line, what) {}
22 };
23 
30 struct StatContext {
31  public:
32 
36  ObservationPtr get(const std::string& name) const;
37 
41  void add(const ObservationPtr& obs);
42 
46  bool del(const std::string& name);
47 
55  std::map<std::string, ObservationPtr> stats_;
56 };
57 
59 typedef boost::shared_ptr<StatContext> StatContextPtr;
60 
61 };
62 };
63 
64 #endif // CONTEXT_H
boost::shared_ptr< StatContext > StatContextPtr
Pointer to the statistics context.
Definition: context.h:59
std::map< std::string, ObservationPtr > stats_
Statistics container.
Definition: context.h:55
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Exception indicating that a given statistic is duplicated.
Definition: context.h:18
Statistics context.
Definition: context.h:30
void add(const ObservationPtr &obs)
Adds a new observation.
Definition: context.cc:24
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
DuplicateStat(const char *file, size_t line, const char *what)
Definition: context.h:20
ObservationPtr get(const std::string &name) const
attempts to get an observation
Definition: context.cc:15
bool del(const std::string &name)
Attempts to delete an observation.
Definition: context.cc:35
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
Definition: observation.h:261