diff options
Diffstat (limited to 'ASNMP/asnmp/timetick.cpp')
-rw-r--r-- | ASNMP/asnmp/timetick.cpp | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/ASNMP/asnmp/timetick.cpp b/ASNMP/asnmp/timetick.cpp index 4855605b313..06fd025797f 100644 --- a/ASNMP/asnmp/timetick.cpp +++ b/ASNMP/asnmp/timetick.cpp @@ -18,83 +18,83 @@ /*=================================================================== Copyright (c) 1996 Hewlett-Packard Company - + ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS. - Permission to use, copy, modify, distribute and/or sell this software - and/or its documentation is hereby granted without fee. User agrees - to display the above copyright notice and this license notice in all - copies of the software and any documentation of the software. User - agrees to assume all liability for the use of the software; Hewlett-Packard - makes no representations about the suitability of this software for any - purpose. It is provided "AS-IS without warranty of any kind,either express - or implied. User hereby grants a royalty-free license to any and all - derivatives based upon this software code base. + Permission to use, copy, modify, distribute and/or sell this software + and/or its documentation is hereby granted without fee. User agrees + to display the above copyright notice and this license notice in all + copies of the software and any documentation of the software. User + agrees to assume all liability for the use of the software; Hewlett-Packard + makes no representations about the suitability of this software for any + purpose. It is provided "AS-IS without warranty of any kind,either express + or implied. User hereby grants a royalty-free license to any and all + derivatives based upon this software code base. =====================================================================*/ -#include "asnmp/timetick.h" // include header file for timetick class +#include "asnmp/timetick.h" // include header file for timetick class ACE_RCSID(asnmp, timetick, "$Id$") -// constructor with a value +// constructor with a value TimeTicks::TimeTicks( const unsigned long i):SnmpUInt32(i) -{ +{ smival.syntax = sNMP_SYNTAX_TIMETICKS; -} - +} + // copy constructor TimeTicks::TimeTicks( const TimeTicks &t) -{ +{ smival.value.uNumber = t.smival.value.uNumber; smival.syntax = sNMP_SYNTAX_TIMETICKS; } // destructor -TimeTicks::~TimeTicks() +TimeTicks::~TimeTicks() { } // syntax type SmiUINT32 TimeTicks::get_syntax() -{ - return sNMP_SYNTAX_TIMETICKS; +{ + return sNMP_SYNTAX_TIMETICKS; } // create a new instance of this Value -SnmpSyntax *TimeTicks::clone() const -{ - return (SnmpSyntax *) new TimeTicks(*this); +SnmpSyntax *TimeTicks::clone() const +{ + return (SnmpSyntax *) new TimeTicks(*this); } // overloaded assignement from ulong TimeTicks& TimeTicks::operator=( const unsigned long int i) -{ +{ smival.value.uNumber =i; return *this; } // overloaded assignment from TimeTicks TimeTicks& TimeTicks::operator=( const TimeTicks &uli) -{ +{ this->smival.value.uNumber = uli.smival.value.uNumber; return *this; } // general assignment from any Value SnmpSyntax& TimeTicks::operator=( SnmpSyntax &in_val) { - if ( this == &in_val ) // handle assignement from itself + if ( this == &in_val ) // handle assignement from itself return *this; - valid_flag = 0; // will get set true if really valid - if (in_val.valid()) { + valid_flag = 0; // will get set true if really valid + if (in_val.valid()) { switch (in_val.get_syntax()) { case sNMP_SYNTAX_UINT32: - // case sNMP_SYNTAX_GAUGE32: .. indistinquishable from UINT32 + // case sNMP_SYNTAX_GAUGE32: .. indistinquishable from UINT32 case sNMP_SYNTAX_CNTR32: case sNMP_SYNTAX_TIMETICKS: - case sNMP_SYNTAX_INT32: // implied cast int -> uint - this->smival.value.uNumber = - ((TimeTicks &)in_val).smival.value.uNumber; - valid_flag = 1; - break; + case sNMP_SYNTAX_INT32: // implied cast int -> uint + this->smival.value.uNumber = + ((TimeTicks &)in_val).smival.value.uNumber; + valid_flag = 1; + break; } } return *this; @@ -102,8 +102,8 @@ SnmpSyntax& TimeTicks::operator=( SnmpSyntax &in_val) // otherwise, behave like an unsigned long TimeTicks::operator unsigned long() -{ - return smival.value.uNumber; +{ + return smival.value.uNumber; } @@ -140,4 +140,3 @@ char * TimeTicks::to_string() return output_buffer; } - |