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
14namespace isc {
15namespace stats {
16
18class DuplicateStat : public Exception {
19public:
20 DuplicateStat(const char* file, size_t line, const char* what) :
21 isc::Exception(file, line, what) {}
22};
23
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
59typedef boost::shared_ptr<StatContext> StatContextPtr;
60
61};
62};
63
64#endif // CONTEXT_H
This is a base class for exceptions thrown from the DNS library module.
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
DuplicateStat(const char *file, size_t line, const char *what)
Definition: context.h:20
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
Definition: observation.h:261
boost::shared_ptr< StatContext > StatContextPtr
Pointer to the statistics context.
Definition: context.h:59
Defines the logger used by the top-level component of kea-dhcp-ddns.
Statistics context.
Definition: context.h:30
bool del(const std::string &name)
Attempts to delete an observation.
Definition: context.cc:35
void add(const ObservationPtr &obs)
Adds a new observation.
Definition: context.cc:24
std::map< std::string, ObservationPtr > stats_
Statistics container.
Definition: context.h:55
ObservationPtr get(const std::string &name) const
attempts to get an observation
Definition: context.cc:15