1 /*_############################################################################
6 _## -----------------------------------------------
7 _## Copyright (c) 2001-2010 Jochen Katz, Frank Fock
9 _## This software is based on SNMP++2.6 from Hewlett Packard:
11 _## Copyright (c) 1996
12 _## Hewlett-Packard Company
14 _## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
15 _## Permission to use, copy, modify, distribute and/or sell this software
16 _## and/or its documentation is hereby granted without fee. User agrees
17 _## to display the above copyright notice and this license notice in all
18 _## copies of the software and any documentation of the software. User
19 _## agrees to assume all liability for the use of the software;
20 _## Hewlett-Packard and Jochen Katz make no representations about the
21 _## suitability of this software for any purpose. It is provided
22 _## "AS-IS" without warranty of any kind, either express or implied. User
23 _## hereby grants a royalty-free license to any and all derivatives based
24 _## upon this software code base.
26 _## Stuttgart, Germany, Thu Sep 2 00:07:47 CEST 2010
28 _##########################################################################*/
29 /*===================================================================
32 Hewlett-Packard Company
34 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
35 Permission to use, copy, modify, distribute and/or sell this software
36 and/or its documentation is hereby granted without fee. User agrees
37 to display the above copyright notice and this license notice in all
38 copies of the software and any documentation of the software. User
39 agrees to assume all liability for the use of the software; Hewlett-Packard
40 makes no representations about the suitability of this software for any
41 purpose. It is provided "AS-IS without warranty of any kind,either express
42 or implied. User hereby grants a royalty-free license to any and all
43 derivatives based upon this software code base.
46 SNMP++ C O U N T E R. H
48 COUNTER32 CLASS DEFINITION
50 DESIGN + AUTHOR: Peter E Mellquist
53 Class definition for SMI Counter32 class.
55 =====================================================================*/
56 // $Id: counter.h 1541 2009-05-29 11:29:22Z katz $
61 #include "snmp_pp/integer.h"
63 #ifdef SNMP_PP_NAMESPACE
67 //------------[ Counter32 Class ]------------------------------------------
69 * The counter class allows all the functionality of unsigned
70 * integers but is recognized as a distinct SMI type. Counter32
71 * class objects may be set or get into Vb objects.
73 class DLLOPT Counter32: public SnmpUInt32
77 * Constructor to create a Counter object with value zero.
79 Counter32() : SnmpUInt32() { smival.syntax = sNMP_SYNTAX_CNTR32; };
82 * Constructor with a value.
84 * @param i - unsigned 32 bit value
86 Counter32(const unsigned long i) : SnmpUInt32(i)
87 { smival.syntax = sNMP_SYNTAX_CNTR32; };
92 * @param c - Object to copy from
94 Counter32(const Counter32 &c);
99 * @return Returns always sNMP_SYNTAX_CNTR32
101 SmiUINT32 get_syntax() const { return sNMP_SYNTAX_CNTR32; };
106 * @return Pointer to a newly created copy of the object.
108 SnmpSyntax *clone() const { return (SnmpSyntax *)new Counter32(*this); };
111 * Map other SnmpSyntax objects to Counter32.
113 SnmpSyntax& operator=(const SnmpSyntax &val);
116 * Overloaded assignment for Counter32.
118 * @param uli - new value
119 * @return self reference
121 Counter32& operator=(const Counter32 &uli)
122 { smival.value.uNumber = uli.smival.value.uNumber;
123 m_changed = true; return *this;};
126 * Overloaded assignment for unsigned longs.
128 * @param i - new value
129 * @return self reference
131 Counter32& operator=(const unsigned long i)
132 { smival.value.uNumber = i; m_changed = true; return *this;};
135 * Casting to unsigned long.
137 * @return Current value as an unsigned long
139 operator unsigned long() { return smival.value.uNumber; };
142 #ifdef SNMP_PP_NAMESPACE
143 } // end of namespace Snmp_pp