Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

timetick.h

Go to the documentation of this file.
00001 /*_############################################################################
00002   _## 
00003   _##  timetick.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++ T I M E T I C K. H
00047 
00048   TIMETICK 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 Timeticks class.
00062 
00063 =====================================================================*/
00064 // $Id: timetick.h,v 1.5 2004/06/20 18:49:21 katz Exp $
00065 
00066 #ifndef _TIMETICKS
00067 #define _TIMETICKS
00068 
00069 #include "snmp_pp/integer.h"
00070 
00071 #ifdef SNMP_PP_NAMESPACE
00072 namespace Snmp_pp {
00073 #endif
00074 
00075 #define TICKOUTBUF 30 // max formatted time string
00076 
00077 //------------[ TimeTicks Class ]-----------------------------------
00078 /**
00079  * The timeticks class allows all the functionality of unsigned
00080  * integers but is recognized as a distinct SMI type. TimeTicks
00081  * objects may be get or set into Vb objects.
00082  */
00083 class DLLOPT TimeTicks : public SnmpUInt32
00084 {
00085  public:
00086   /**
00087    * Constructs a zero TimeTicks object.
00088    */
00089   TimeTicks() : SnmpUInt32()
00090     { smival.syntax = sNMP_SYNTAX_TIMETICKS; };
00091 
00092   /**
00093    * Constructs a TimeTicks object with the given value.
00094    *
00095    * @param val - time in hundredths of seconds.
00096    */
00097   TimeTicks(const unsigned long val) : SnmpUInt32(val)
00098     { smival.syntax = sNMP_SYNTAX_TIMETICKS; };
00099 
00100   /**
00101    * Copy constructor.
00102    *
00103    * @param t - Time for the new object.
00104    */
00105   TimeTicks(const TimeTicks &t);
00106 
00107   /**
00108    * Destructor.
00109    */
00110   ~TimeTicks() {};
00111 
00112   /**
00113    * Return the syntax.
00114    *
00115    * @return Always returns sNMP_SYNTAX_TIMETICKS.
00116    */
00117   SmiUINT32 get_syntax() const { return sNMP_SYNTAX_TIMETICKS; };
00118 
00119   /**
00120    * Get a printable ASCII value.
00121    */
00122   const char *get_printable() const;
00123 
00124   /**
00125    * Clone operator.
00126    *
00127    * @return Pointer to a newly created copy of the object.
00128    */
00129   SnmpSyntax *clone() const { return (SnmpSyntax *) new TimeTicks(*this); };
00130 
00131   /**
00132    * Map other SnmpSyntax objects to TimeTicks.
00133    */
00134   SnmpSyntax& operator=(const SnmpSyntax &val);
00135 
00136   /**
00137    * Overloaded assignment for TimeTicks.
00138    *
00139    * @param uli - new value
00140    * @return self reference
00141    */
00142   TimeTicks& operator=(const TimeTicks &uli)
00143     { smival.value.uNumber = uli.smival.value.uNumber; return *this; };
00144 
00145   /**
00146    * Overloaded assignment for unsigned longs.
00147    *
00148    * @param i - new value in hundrets of seconds
00149    * @return self reference
00150    */
00151   TimeTicks& operator=(const unsigned long i)
00152     { smival.value.uNumber = i; return *this; };
00153 
00154   /**
00155    * Casting to unsigned long.
00156    *
00157    * @return Current value as hundrets of seconds
00158    */
00159   operator unsigned long() { return smival.value.uNumber; };
00160 
00161   /**
00162    * Reset the object.
00163    */
00164   void clear()
00165     { smival.value.uNumber = 0; };
00166 
00167  protected:
00168   /*mutable*/ char output_buffer[TICKOUTBUF];  // for storing printed form
00169 
00170 };
00171 
00172 #ifdef SNMP_PP_NAMESPACE
00173 }; // end of namespace Snmp_pp
00174 #endif 
00175 
00176 #endif

Generated on Tue Jan 4 22:42:14 2005 for SNMP++ by doxygen 1.3.2