]> git.stg.codes - ssmd.git/blob - 3rdparty/snmp++/include/snmp_pp/counter.h
Initial adding
[ssmd.git] / 3rdparty / snmp++ / include / snmp_pp / counter.h
1 /*_############################################################################
2   _## 
3   _##  counter.h  
4   _##
5   _##  SNMP++v3.2.25
6   _##  -----------------------------------------------
7   _##  Copyright (c) 2001-2010 Jochen Katz, Frank Fock
8   _##
9   _##  This software is based on SNMP++2.6 from Hewlett Packard:
10   _##  
11   _##    Copyright (c) 1996
12   _##    Hewlett-Packard Company
13   _##  
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. 
25   _##  
26   _##  Stuttgart, Germany, Thu Sep  2 00:07:47 CEST 2010 
27   _##  
28   _##########################################################################*/
29 /*===================================================================
30
31   Copyright (c) 1999
32   Hewlett-Packard Company
33
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.
44
45
46   SNMP++ C O U N T E R. H
47
48   COUNTER32 CLASS DEFINITION
49
50   DESIGN + AUTHOR:  Peter E Mellquist
51
52   DESCRIPTION:
53   Class definition for SMI Counter32 class.
54
55 =====================================================================*/
56 // $Id: counter.h 1541 2009-05-29 11:29:22Z katz $
57
58 #ifndef _COUNTER
59 #define _COUNTER
60
61 #include "snmp_pp/integer.h"
62
63 #ifdef SNMP_PP_NAMESPACE
64 namespace Snmp_pp {
65 #endif
66
67 //------------[ Counter32 Class ]------------------------------------------
68 /**
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.
72  */
73 class DLLOPT Counter32: public SnmpUInt32
74 {
75  public:
76   /**
77    * Constructor to create a Counter object with value zero.
78    */
79   Counter32() : SnmpUInt32() { smival.syntax = sNMP_SYNTAX_CNTR32; };
80
81   /**
82    * Constructor with a value.
83    *
84    * @param i - unsigned 32 bit value
85    */
86   Counter32(const unsigned long i) : SnmpUInt32(i)
87     { smival.syntax = sNMP_SYNTAX_CNTR32; };
88
89   /**
90    * Copy constructor.
91    *
92    * @param c - Object to copy from
93    */
94   Counter32(const Counter32 &c);
95
96   /**
97    * Return the syntax.
98    *
99    * @return Returns always sNMP_SYNTAX_CNTR32
100    */
101   SmiUINT32 get_syntax() const { return sNMP_SYNTAX_CNTR32; };
102
103   /**
104    * Clone operator.
105    *
106    * @return Pointer to a newly created copy of the object.
107    */
108   SnmpSyntax *clone() const { return (SnmpSyntax *)new Counter32(*this); };
109
110   /**
111    * Map other SnmpSyntax objects to Counter32.
112    */
113   SnmpSyntax& operator=(const SnmpSyntax &val);
114
115   /**
116    * Overloaded assignment for Counter32.
117    *
118    * @param uli - new value
119    * @return self reference
120    */
121   Counter32& operator=(const Counter32 &uli)
122     { smival.value.uNumber = uli.smival.value.uNumber;
123       m_changed = true; return *this;};
124
125   /**
126    * Overloaded assignment for unsigned longs.
127    *
128    * @param i - new value
129    * @return self reference
130    */
131   Counter32& operator=(const unsigned long i)
132     { smival.value.uNumber = i; m_changed = true; return *this;};
133
134   /**
135    * Casting to unsigned long.
136    *
137    * @return Current value as an unsigned long
138    */
139   operator unsigned long() { return smival.value.uNumber; };
140 };
141
142 #ifdef SNMP_PP_NAMESPACE
143 } // end of namespace Snmp_pp
144 #endif 
145
146 #endif // _COUNTER