12#include <boost/shared_ptr.hpp>
13#include <boost/date_time/time_duration.hpp>
14#include <boost/date_time/posix_time/posix_time_types.hpp>
45typedef std::pair<double, boost::posix_time::ptime>
FloatSample;
51typedef std::pair<std::string, boost::posix_time::ptime>
StringSample;
93 Observation(
const std::string& name,
const int64_t value);
99 Observation(
const std::string& name,
const double value);
111 Observation(
const std::string& name,
const std::string& value);
135 void setValue(
const std::string& value);
159 void addValue(
const std::string& value);
218 template<
typename SampleType,
typename StorageType>
219 void setValueInternal(SampleType value, StorageType& storage,
230 template<
typename SampleType,
typename Storage>
231 SampleType getValueInternal(Storage& storage,
Type exp_type)
const;
247 std::list<IntegerSample> integer_samples_;
250 std::list<FloatSample> float_samples_;
253 std::list<DurationSample> duration_samples_;
256 std::list<StringSample> string_samples_;
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 thrown if invalid statistic type is used.
InvalidStatType(const char *file, size_t line, const char *what)
Represents a single observable characteristic (a 'statistic')
static std::string typeToText(Type type)
Converts statistic type to string.
void setValue(const int64_t value)
Records absolute integer observation.
Type getType() const
Returns statistic type.
void reset()
Resets statistic.
std::string getName() const
Returns observation name.
FloatSample getFloat() const
Returns observed float sample.
void addValue(const int64_t value)
Records incremental integer observation.
StringSample getString() const
Returns observed string sample.
Type
Type of available statistics.
@ STAT_INTEGER
this statistic is unsinged 64-bit integer value
@ STAT_STRING
this statistic represents a string
@ STAT_FLOAT
this statistic is a floating point value
@ STAT_DURATION
this statistic represents time duration
isc::data::ConstElementPtr getJSON() const
Returns as a JSON structure.
IntegerSample getInteger() const
Returns observed integer sample.
DurationSample getDuration() const
Returns observed duration sample.
std::pair< StatsDuration, boost::posix_time::ptime > DurationSample
Time Duration.
std::pair< double, boost::posix_time::ptime > FloatSample
Float (implemented as double precision)
std::pair< std::string, boost::posix_time::ptime > StringSample
String.
std::pair< int64_t, boost::posix_time::ptime > IntegerSample
Integer (implemented as signed 64-bit integer)
boost::shared_ptr< const Element > ConstElementPtr
boost::posix_time::time_duration StatsDuration
Defines duration resolution.
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
Defines the logger used by the top-level component of kea-dhcp-ddns.