00001 /*_############################################################################ 00002 _## 00003 _## gauge.h 00004 _## 00005 _## SNMP++v3.2.15 00006 _## ----------------------------------------------- 00007 _## Copyright (c) 2001-2004 Jochen Katz, Frank Fock 00008 _## 00009 _## This software is based on SNMP++2.6 from Hewlett Packard: 00010 _## 00011 _## Copyright (c) 1996 00012 _## Hewlett-Packard Company 00013 _## 00014 _## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS. 00015 _## Permission to use, copy, modify, distribute and/or sell this software 00016 _## and/or its documentation is hereby granted without fee. User agrees 00017 _## to display the above copyright notice and this license notice in all 00018 _## copies of the software and any documentation of the software. User 00019 _## agrees to assume all liability for the use of the software; 00020 _## Hewlett-Packard and Jochen Katz make no representations about the 00021 _## suitability of this software for any purpose. It is provided 00022 _## "AS-IS" without warranty of any kind, either express or implied. User 00023 _## hereby grants a royalty-free license to any and all derivatives based 00024 _## upon this software code base. 00025 _## 00026 _## Stuttgart, Germany, Tue Jan 4 21:42:42 CET 2005 00027 _## 00028 _##########################################################################*/ 00029 /*=================================================================== 00030 00031 Copyright (c) 1999 00032 Hewlett-Packard Company 00033 00034 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS. 00035 Permission to use, copy, modify, distribute and/or sell this software 00036 and/or its documentation is hereby granted without fee. User agrees 00037 to display the above copyright notice and this license notice in all 00038 copies of the software and any documentation of the software. User 00039 agrees to assume all liability for the use of the software; Hewlett-Packard 00040 makes no representations about the suitability of this software for any 00041 purpose. It is provided "AS-IS without warranty of any kind,either express 00042 or implied. User hereby grants a royalty-free license to any and all 00043 derivatives based upon this software code base. 00044 00045 00046 SNMP++ G A U G E. H 00047 00048 GAUGE32 CLASS DEFINITION 00049 00050 DESIGN + AUTHOR: 00051 Peter E Mellquist 00052 00053 LANGUAGE: 00054 ANSI C++ 00055 00056 OPERATING SYSTEMS: 00057 MS-Windows Win32 00058 BSD UNIX 00059 00060 DESCRIPTION: 00061 Class definition for SMI Gauge32 class. 00062 00063 =====================================================================*/ 00064 // $Id: gauge.h,v 1.4 2004/03/03 23:11:21 katz Exp $ 00065 00066 #ifndef _GAUGE_H_ 00067 #define _GAUGE_H_ 00068 00069 #include "snmp_pp/integer.h" 00070 00071 #ifdef SNMP_PP_NAMESPACE 00072 namespace Snmp_pp { 00073 #endif 00074 00075 //------------[ Gauge32 Class ]------------------------------------------ 00076 /** 00077 * The gauge class allows all the functionality of unsigned integers 00078 * but is recognized as a distinct SMI type. Gauge32 objects may be 00079 * set or get into Vb objects. 00080 */ 00081 class DLLOPT Gauge32: public SnmpUInt32 00082 { 00083 public: 00084 00085 //-----------[ Constructors and Destrucotr ]---------------------- 00086 00087 /** 00088 * Constructs a valid Gauge32 with value 0. 00089 */ 00090 Gauge32() : SnmpUInt32() { smival.syntax = sNMP_SYNTAX_GAUGE32; }; 00091 00092 /** 00093 * Constructs a valid Gauge32 with the given value. 00094 * 00095 * @param ul - value (0..MAX_UINT32) 00096 */ 00097 Gauge32(const unsigned long ul) : SnmpUInt32(ul) 00098 { smival.syntax = sNMP_SYNTAX_GAUGE32; }; 00099 00100 /** 00101 * Copy constructor. 00102 * 00103 * @param g32 - value 00104 */ 00105 Gauge32(const Gauge32 &g32); 00106 00107 /** 00108 * Destructor (ensure that SnmpUInt32::~SnmpUInt32() is overridden). 00109 */ 00110 ~Gauge32() {}; 00111 00112 //-----------[ SnmpSyntax methods ]---------------------- 00113 00114 /** 00115 * Get the Syntax of the object. 00116 * 00117 * @return This method always returns sNMP_SYNTAX_GAUGE32. 00118 */ 00119 SmiUINT32 get_syntax() const { return sNMP_SYNTAX_GAUGE32; }; 00120 00121 /** 00122 * Clone the object. 00123 * 00124 * @return A cloned Gauge32 object allocated through new. 00125 */ 00126 SnmpSyntax *clone() const { return (SnmpSyntax *) new Gauge32(*this); }; 00127 00128 //-----------[ Overload some operators ]---------------------- 00129 00130 /** 00131 * Assign a Gauge32 to a Gauge32. 00132 */ 00133 Gauge32& operator=(const Gauge32 &uli) 00134 { smival.value.uNumber = uli.smival.value.uNumber; return *this;}; 00135 00136 /** 00137 * Assign a unsigned long to a Gauge32. 00138 * 00139 * @param ul - New value 00140 */ 00141 Gauge32& operator=(const unsigned long ul) 00142 { smival.value.uNumber = ul; return *this; }; 00143 00144 // otherwise, behave like an unsigned int 00145 /** 00146 * Cast a Gauge32 to unsigned long. 00147 * 00148 * @return Current value as unsigned long. 00149 */ 00150 operator unsigned long() { return smival.value.uNumber; }; 00151 00152 }; 00153 00154 #ifdef SNMP_PP_NAMESPACE 00155 }; // end of namespace Snmp_pp 00156 #endif 00157 00158 #endif // _GAUGE_H_
1.3.2