 |
Kea
1.5.0
|
Go to the documentation of this file.
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>
45 typedef std::pair<double, boost::posix_time::ptime>
FloatSample;
51 typedef 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_;
266 #endif // OBSERVATION_H
std::pair< double, boost::posix_time::ptime > FloatSample
Float (implemented as double precision)
InvalidStatType(const char *file, size_t line, const char *what)
@ STAT_STRING
this statistic represents a string
boost::posix_time::time_duration StatsDuration
Defines duration resolution.
std::pair< int64_t, boost::posix_time::ptime > IntegerSample
Integer (implemented as signed 64-bit integer)
@ STAT_INTEGER
this statistic is unsinged 64-bit integer value
void reset()
Resets statistic.
void setValue(const int64_t value)
Records absolute integer observation.
This is a base class for exceptions thrown from the DNS library module.
Type getType() const
Returns statistic type.
static std::string typeToText(Type type)
Converts statistic type to string.
boost::shared_ptr< Observation > ObservationPtr
Observation pointer.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
IntegerSample getInteger() const
Returns observed integer sample.
Exception thrown if invalid statistic type is used.
isc::data::ConstElementPtr getJSON() const
Returns as a JSON structure.
std::pair< std::string, boost::posix_time::ptime > StringSample
String.
std::string getName() const
Returns observation name.
Observation(const std::string &name, const int64_t value)
Constructor for integer observations.
@ STAT_FLOAT
this statistic is a floating point value
void addValue(const int64_t value)
Records incremental integer observation.
StringSample getString() const
Returns observed string sample.
DurationSample getDuration() const
Returns observed duration sample.
@ STAT_DURATION
this statistic represents time duration
FloatSample getFloat() const
Returns observed float sample.
Represents a single observable characteristic (a 'statistic')
boost::shared_ptr< const Element > ConstElementPtr
Type
Type of available statistics.
std::pair< StatsDuration, boost::posix_time::ptime > DurationSample
Time Duration.