Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ASNMP / asnmp / integer.h
blobecc83a0482efef130bfe8a5ad9b77f04a6d79611
1 /* -*-C++-*- */
2 #ifndef SNMPINTEGER_
3 #define SNMPINTEGER_
4 //=============================================================================
5 /**
6 * @file integer.h
8 * Class definition for Integer classes convertable to SMI.
9 */
10 //=============================================================================
12 /*===================================================================
13 Copyright (c) 1996
14 Hewlett-Packard Company
16 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
17 Permission to use, copy, modify, distribute and/or sell this software
18 and/or its documentation is hereby granted without fee. User agrees
19 to display the above copyright notice and this license notice in all
20 copies of the software and any documentation of the software. User
21 agrees to assume all liability for the use of the software; Hewlett-Packard
22 makes no representations about the suitability of this software for any
23 purpose. It is provided "AS-IS without warranty of any kind,either express
24 or implied. User hereby grants a royalty-free license to any and all
25 derivatives based upon this software code base.
26 =====================================================================*/
28 #include "asnmp/smival.h"
30 // TODO get rid of this constant
31 #define INTOUTBUF 15 // largest ASCII formatted integer
33 //------------[ Integer Classes ]------------------------------------------
34 // The integer class allows all the functionality of the various
35 // integers but is contained in a Value object for consistency
36 // among the various types.
37 // class objects may be set or get into Vb objects.
40 // 32 bit unsigned integer class
41 /**
42 * @class SnmpUInt32
44 * @brief Implement RFC 1920 Unsigned Integer SMI datatype
46 class ASNMP_Export SnmpUInt32 : public SnmpSyntax
48 public:
49 /// default constructor
50 explicit SnmpUInt32 (const unsigned long i = 0);
52 /// copy constructor
53 SnmpUInt32( const SnmpUInt32 &c);
55 /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden)
56 virtual ~SnmpUInt32();
58 /// syntax type
59 virtual SmiUINT32 get_syntax();
61 /// overloaded assignment
62 SnmpUInt32& operator=( const unsigned long i);
64 /// overloaded assignment
65 SnmpUInt32& operator=( const SnmpUInt32 &uli);
67 /// otherwise, behave like an unsigned long int
68 operator unsigned long();
70 /// get a printable ASCII value
71 virtual const char *to_string();
73 /// create a new instance of this Value
74 virtual SnmpSyntax *clone() const;
76 /// copy an instance of this Value
77 SnmpSyntax& operator=( SnmpSyntax &val);
79 /// did object construct properly
80 int valid() const;
82 protected:
83 /// contain string representation of object
84 int valid_flag;
85 char output_buffer[INTOUTBUF];
89 // 32 bit signed integer class
90 /**
91 * @class SnmpInt32
93 * @brief Implement RFC 1902 32 bit Integer SMI data object
95 class ASNMP_Export SnmpInt32 : public SnmpSyntax
97 public:
98 /// constructor with value
99 SnmpInt32 (const long i = 0);
101 /// constructor with value
102 SnmpInt32 (const SnmpInt32 &c);
104 /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden)
105 virtual ~SnmpInt32();
107 /// syntax type
108 virtual SmiUINT32 get_syntax();
110 /// overloaded assignment
111 SnmpInt32& operator=( const long i);
113 /// overloaded assignment
114 SnmpInt32& operator=( const SnmpInt32 &li);
116 /// otherwise, behave like a long int
117 operator long();
119 /// create a new instance of this Value
120 SnmpSyntax *clone() const;
122 /// copy an instance of this Value
123 SnmpSyntax& operator=( SnmpSyntax &val);
125 /// get a printable ASCII value
126 const char *to_string();
128 /// logical state of object
129 int valid() const;
131 protected:
132 /// contain string representation of object
133 int valid_flag;
134 char output_buffer[INTOUTBUF];
137 #endif