Merge branch 'master' into jwi-bcc64xsingletonwarning
[ACE_TAO.git] / ACE / ASNMP / asnmp / ctr64.h
blob0e18edbddbcab5b0bd376576a567d716b07f43d8
1 /* -*-C++-*- */
2 #ifndef CTR64_
3 #define CTR64_
4 //=============================================================================
5 /**
6 * @file ctr64.h
8 * SNMP Counter64 class definition.
10 * @author Peter E Mellquist
12 //=============================================================================
14 /*===================================================================
15 Copyright (c) 1996
16 Hewlett-Packard Company
18 ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
19 Permission to use, copy, modify, distribute and/or sell this software
20 and/or its documentation is hereby granted without fee. User agrees
21 to display the above copyright notice and this license notice in all
22 copies of the software and any documentation of the software. User
23 agrees to assume all liability for the use of the software; Hewlett-Packard
24 makes no representations about the suitability of this software for any
25 purpose. It is provided "AS-IS without warranty of any kind,either express
26 or implied. User hereby grants a royalty-free license to any and all
27 derivatives based upon this software code base.
28 =====================================================================*/
30 #include "asnmp/smival.h"
31 #include "ace/Basic_Types.h"
33 #define CTR64OUTBUF 30 // maximum ascii string for a 64-bit ctr
36 //---------[ 64 bit Counter Class ]--------------------------------
37 // Counter64 Class encapsulates two unsigned integers into a
38 // a single entity. This type has is available in SNMPv2 but
39 // may be used anywhere where needed.
41 /**
42 * @class Counter64
44 * @brief Defines the member functions for the Counter64 concrete class
45 * This class implements RFC 1902 64 bit Counter Object.
47 class ASNMP_Export Counter64 : public SnmpSyntax
49 public:
50 /// default constructor
51 Counter64( ACE_UINT64 llw = 0);
53 /// constructor with values
54 Counter64( unsigned long hiparm, unsigned long loparm);
56 /// copy constructor
57 Counter64( const Counter64 &ctr64);
59 /// destructor (ensure that SnmpSyntax::~SnmpSyntax() is overridden)
60 ~Counter64();
62 /// syntax type
63 SmiUINT32 get_syntax();
65 /// return a long double representation
66 long double to_long_double() const;
68 /// assign a long double to a counter64
69 Counter64& assign( long double ld);
71 /// return the high part
72 unsigned long high() const;
74 /// return the low part
75 unsigned long low() const;
77 /// set the high part
78 void set_high( const unsigned long h);
80 /// set the low part
81 void set_low( const unsigned long l);
83 /// overloaded assignment
84 Counter64& operator=( const ACE_UINT64 rhs);
86 /// overloaded assignment
87 Counter64& operator=( const Counter64 &rhs);
89 /// get a printable ASCII representation
90 const char *to_string();
92 /// create a new instance of this Value
93 SnmpSyntax *clone() const;
95 /// copy an instance of this Value
96 SnmpSyntax& operator=( SnmpSyntax &val);
98 /// general validity test, always true
99 int valid() const;
101 /// otherwise, behave like an ACE_UINT64
102 operator ACE_UINT64();
104 protected:
105 char output_buffer[CTR64OUTBUF];
108 #endif // CTR64_