<< Back to man.ChinaUnix.net

13.  Gauge32 Class

Object Modeling Technique (OMT) view of the SNMP++ Gauge32 Class

13.1.  The Gauge32 Class

The SNMP++ Gauge32 class provides benefits where SMI 32 bit gauges are needed. SMI gauges are defined with the storage capabilities of an unsigned long integer. In addition to being an unsigned long int, SMI gauges are treated as a distinct type. For this reason, the SNMP++ Gauge32 class has all the functionality and behavior of an unsigned long integers but is a separate class. Anything that can be done with an unsigned long int can be done with a Gauge32 object. The Gauge32 class has additional behavior when interfacing with other SNMP++ classes like the Vb class. When used with the Vb class, Gauge32 objects can be set into (Vb::set) and gotten out of (Vb::get) of Vb objects. This allows the developer to get all the functionality of unsigned long and provide a one-to-one mapping to SMI gauge.


13.2. Overview of Gauge32 Class Member Functions

Gauge32 Class Member Functions




     Gauge32::Gauge32( void);

Constructs an empty Gauge32 object.

     Gauge32::Gauge32( const unsigned long i );

Construct a Gauge32 object using an unsigned long.

     Gauge32::Gauge32(  const Gauge32 &g);

Construct a Gauge32 object using another Gaueg32 object.



    Gauge32::Gauge32( );

Destroy a Gauge32 object.

Overloaded Operators


    Gauge32& operator = ( const Gauge32 &g);

Overloaded assignment operator.

    char * get_printable();

Returns formatted Gauge32 for output.

    operator unsigned long( );

Gives unsigned long behavior.


13.3. Some Gauge32 Examples


// Gauge Examples

#include gauge.h

void gauge_example()


    Gauge32 gge ;                                         // create an un-initialized Gauge instance

    Gauge32gge1( (unsigned long) 57);           // create a Gauge using a number

    Gauge32 ctr2(ctr1);                                  // create a Gauge using another instance


    gge = 192;                                                    // overloaded assignment to a number

    gge1 = gge;                                                   // overloaded assignment to another counter

    cout << (unsigned long) gge;                      // behave like an unsigned long int



};  // end gauge example