AgentXcpp  Revision:0.1.1
Internals Documentation
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Pages
agentxcpp::Counter32 Class Reference

Represents an Counter32 as descibed in RFC 2741. More...

#include <Counter32.hpp>

Inheritance diagram for agentxcpp::Counter32:
Collaboration diagram for agentxcpp::Counter32:

List of all members.

Public Member Functions

 Counter32 ()
 Create a counter without initialization.
 Counter32 (binary::const_iterator &pos, const binary::const_iterator &end, bool big_endian=true)
 Construct the object from input stream.
virtual binary serialize () const
 Encode the object as described in RFC 2741, section 5.4.
virtual void update ()
 Update the internal state of the object.
virtual uint32_t get ()
 Obtain the current value for the object.
- Public Member Functions inherited from agentxcpp::variable
virtual ~variable ()
 Destructor.

Private Attributes

uint32_t value
 The counter value.

Detailed Description

Represents an Counter32 as descibed in RFC 2741.

Definition at line 36 of file Counter32.hpp.


Constructor & Destructor Documentation

agentxcpp::Counter32::Counter32 ( )
inline

Create a counter without initialization.

The value after creation is undefined.

Definition at line 55 of file Counter32.hpp.

Counter32::Counter32 ( binary::const_iterator &  pos,
const binary::const_iterator &  end,
bool  big_endian = true 
)

Construct the object from input stream.

This constructor parses the serialized form of the object. It takes an iterator, starts parsing at the position of the iterator and advances the iterator to the position right behind the object.

The constructor expects valid data from the stream; if parsing fails, parse_error is thrown. In this case, the iterator position is undefined.

Parameters:
posIterator pointing to the current stream position. The iterator is advanced while reading the header.
endIterator pointing one element past the end of the current stream. This is needed to mark the end of the buffer.
big_endianWhether the input stream is in big endian format

Definition at line 36 of file Counter32.cpp.

References agentxcpp::read32(), and value.


Member Function Documentation

virtual uint32_t agentxcpp::Counter32::get ( )
inlinevirtual

Obtain the current value for the object.

This member function is derived by classes representing SNMP variables and shall return the current value of the object.

The default implementation throws generic_error.

Returns:
The current value of the object.
Exceptions:
generic_errorIf obtaining the current value fails. No other exception shall be thrown.

Definition at line 122 of file Counter32.hpp.

binary Counter32::serialize ( ) const
virtual

Encode the object as described in RFC 2741, section 5.4.

This function uses big endian.

Implements agentxcpp::variable.

Definition at line 25 of file Counter32.cpp.

References value, and agentxcpp::write32().

virtual void agentxcpp::Counter32::update ( )
inlinevirtual

Update the internal state of the object.

This function calls get() to obtain a new value and writes that value to the 'value' member.

Exceptions:
generic_errorIf obtaining the new value failed.

Implements agentxcpp::variable.

Definition at line 104 of file Counter32.hpp.

References value.


Member Data Documentation

uint32_t agentxcpp::Counter32::value
private

The counter value.

According to RFC 2578, Counter32 is a non-negative 32-bit number.

Definition at line 45 of file Counter32.hpp.

Referenced by Counter32(), serialize(), and update().


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