Kea: isc::stats::StatContext Struct Reference

| Kea 1.5.0

Public Member Functions | Public Attributes | List of all members
isc::stats::StatContext Struct Reference

Statistics context. More...

`#include <context.h>`

## Public Member Functions
void | add (const ObservationPtr &obs)
| Adds a new observation. More...
bool | del (const std::string &name)
| Attempts to delete an observation. More...
ObservationPtr | get (const std::string &name) const
| attempts to get an observation More...

## Public Attributes
std::map< std::string, ObservationPtr > | stats_
| Statistics container. More...

## Detailed Description

Statistics context.

Statistics context is essentially a container used to group statistics related to a given context together. Two examples of such contexts are all statistics related to a given subnet or all statistics related to a given network interface.

Definition at line 30 of file context.h.

## Member Function Documentation

## ◆ add()

void isc::stats::StatContext::add | ( | const ObservationPtr & | obs | ) |

Adds a new observation.

Parameters

  obs | observation to be added

Exceptions

  DuplicateStat | if an observation with the same name exists already

Definition at line 24 of file context.cc.

References isc_throw, and stats_.

## ◆ del()

bool isc::stats::StatContext::del | ( | const std::string & | name | ) |

Attempts to delete an observation.

Parameters

  name | name of the observation to be deleted

Returns
  true if successful, false if no such statistic was found

Definition at line 35 of file context.cc.

References stats_.

## ◆ get()

ObservationPtr isc::stats::StatContext::get | ( | const std::string & | name | ) | const

attempts to get an observation

Parameters

  name | name of the statistic

Returns
  appropriate Observation object (or NULL)

Definition at line 15 of file context.cc.

References stats_.

## Member Data Documentation

## ◆ stats_

std::map<std::string, ObservationPtr> isc::stats::StatContext::stats_

Statistics container.

It is public to allow various operations that require iterating over all elements. In particular, two operations (setting all stats to 0; reporting all stats) will take advantage of this. Alternatively, we could make it protected and then return a pointer to it, but that would defeat the purpose of the hermetization in the first place.

Definition at line 55 of file context.h.

Referenced by add(), del(), and get().

The documentation for this struct was generated from the following files:

- context.h
- context.cc