]> git.stg.codes - ssmd.git/blob - 3rdparty/snmp++/include/snmp_pp/gauge.h
Initial adding
[ssmd.git] / 3rdparty / snmp++ / include / snmp_pp / gauge.h
1 /*_############################################################################
2   _## 
3   _##  gauge.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++ G A U G E. H
47
48   GAUGE32 CLASS DEFINITION
49
50   DESIGN + AUTHOR:  Peter E Mellquist
51
52   DESCRIPTION:
53   Class definition for SMI Gauge32 class.
54 =====================================================================*/
55 // $Id: gauge.h 1541 2009-05-29 11:29:22Z katz $
56
57 #ifndef _GAUGE_H_
58 #define _GAUGE_H_
59
60 #include "snmp_pp/integer.h"
61
62 #ifdef SNMP_PP_NAMESPACE
63 namespace Snmp_pp {
64 #endif
65
66 //------------[ Gauge32 Class ]------------------------------------------
67 /**
68  * The gauge class allows all the functionality of unsigned integers
69  * but is recognized as a distinct SMI type. Gauge32 objects may be
70  * set or get into Vb objects.
71  */
72 class DLLOPT Gauge32: public SnmpUInt32
73 {
74  public:
75
76   //-----------[ Constructors and Destrucotr ]----------------------
77
78   /**
79    * Constructs a valid Gauge32 with value 0.
80    */
81   Gauge32() : SnmpUInt32() { smival.syntax = sNMP_SYNTAX_GAUGE32; };
82
83   /**
84    * Constructs a valid Gauge32 with the given value.
85    *
86    * @param ul - value (0..MAX_UINT32)
87    */
88   Gauge32(const unsigned long ul) : SnmpUInt32(ul)
89     { smival.syntax = sNMP_SYNTAX_GAUGE32; };
90
91   /**
92    * Copy constructor.
93    *
94    * @param g32 - value
95    */
96   Gauge32(const Gauge32 &g32);
97
98   /**
99    * Destructor (ensure that SnmpUInt32::~SnmpUInt32() is overridden).
100    */
101   ~Gauge32() {};
102
103   //-----------[ SnmpSyntax methods ]----------------------
104
105   /**
106    * Get the Syntax of the object.
107    *
108    * @return This method always returns sNMP_SYNTAX_GAUGE32.
109    */
110   SmiUINT32 get_syntax() const { return sNMP_SYNTAX_GAUGE32; };
111
112   /**
113    * Clone the object.
114    *
115    * @return A cloned Gauge32 object allocated through new.
116    */
117   SnmpSyntax *clone() const { return (SnmpSyntax *) new Gauge32(*this); };
118
119   //-----------[ Overload some operators ]----------------------
120
121   /**
122    * Assign a Gauge32 to a Gauge32.
123    */
124   Gauge32& operator=(const Gauge32 &uli)
125     { smival.value.uNumber = uli.smival.value.uNumber;
126       m_changed = true;  return *this;};
127
128   /**
129    * Assign a unsigned long to a Gauge32.
130    *
131    * @param ul - New value
132    */
133   Gauge32& operator=(const unsigned long ul)
134     { smival.value.uNumber = ul; m_changed = true; return *this; };
135
136   // otherwise, behave like an unsigned int
137   /**
138    * Cast a Gauge32 to unsigned long.
139    *
140    * @return Current value as unsigned long.
141    */
142   operator unsigned long() { return smival.value.uNumber; };
143
144 };
145
146 #ifdef SNMP_PP_NAMESPACE
147 } // end of namespace Snmp_pp
148 #endif 
149
150 #endif // _GAUGE_H_