65 #ifdef SNMP_PP_NAMESPACE    98     : iv_str(0), iv_part_str(0), m_changed(true)
   101     smival.value.oid.len = 0;
   102     smival.value.oid.ptr = 0;
   121   Oid(
const char *oid_string, 
const bool is_dotted_oid_string = 
true);
   129     : iv_str(0), iv_part_str(0), m_changed(true)
   132     smival.value.oid.len = 0;
   133     smival.value.oid.ptr = 0;
   137     if (
oid.smival.value.oid.len)
   139       smival.value.oid.ptr = (
SmiLPUINT32) 
new unsigned long[
oid.smival.value.oid.len];
   140       if (smival.value.oid.ptr)
   151   Oid(
const unsigned long *raw_oid, 
int oid_len)
   152     : iv_str(0), iv_part_str(0), m_changed(true)
   155     smival.value.oid.len = 0;
   156     smival.value.oid.ptr = 0;
   158     if (raw_oid && (oid_len > 0))
   160       smival.value.oid.ptr = (
SmiLPUINT32) 
new unsigned long[oid_len];
   161       if (smival.value.oid.ptr)
   163         smival.value.oid.len = oid_len;
   164         for (
int i=0; i < oid_len; i++)
   165           smival.value.oid.ptr[i] = raw_oid[i];
   176     if (iv_str)      
delete [] iv_str;        
   177     if (iv_part_str) 
delete [] iv_part_str;   
   192   virtual Oid& operator=(
const char *dotted_oid_string);
   199     if (
this == &
oid) 
return *
this;  
   204     if (
oid.smival.value.oid.len == 0)
   208     smival.value.oid.ptr = (
SmiLPUINT32) 
new unsigned long[
oid.smival.value.oid.len];
   209     if (smival.value.oid.ptr)
   217   int get_asn1_length() 
const;
   222   bool operator == (
const Oid &rhs)
 const   225     if (len() != rhs.
len())
   227     return (nCompare(rhs) == 0);
   233   bool operator != (
const Oid &rhs)
 const   234       { 
return (!(*
this == rhs)); }  
   239   bool operator < (
const Oid &rhs)
 const   244     if((result = nCompare(rhs))<0)  
return 1;
   245     if (result > 0)    
return 0;
   248     return (len() < rhs.
len());
   254   bool operator <= (
const Oid &rhs)
 const   255       { 
return ((*
this < rhs) || (*
this == rhs)); }
   260   bool operator > (
const Oid &rhs)
 const   261       { 
return (!(*
this <= rhs)); }  
   266   bool operator >= (
const Oid &rhs)
 const   267       { 
return (!(*
this < rhs)); }  
   273     { 
Oid tmp(lhs); tmp += rhs; 
return tmp;}
   280   Oid& operator+=(
const char *a);
   313     if (smival.value.oid.ptr)
   317              (
size_t) (smival.value.oid.len*
sizeof(
SmiUINT32)));
   319       delete [] smival.value.oid.ptr;
   323     smival.value.oid.ptr = new_oid;
   345     { m_changed = 
true; 
return smival.value.oid.ptr[index]; }
   357     { 
return (index >= len()) ? 0 : smival.value.oid.ptr[index]; }
   374   void set_data(
const unsigned long *raw_oid, 
const unsigned int oid_len);
   382   void set_data(
const char *str, 
const unsigned int str_len);
   387   unsigned long len()
 const { 
return smival.value.oid.len; }
   394   void trim(
const unsigned long n = 1)
   397     if ((n <= smival.value.oid.len) && (n > 0))
   399       smival.value.oid.len -= n;
   400       if (smival.value.oid.len == 0)
   416     unsigned long length = n;
   417     bool reduced_len = 
false;
   423     if (length == 0) 
return 0; 
   426     if (length > smival.value.oid.len)
   428       length = smival.value.oid.len;
   465     unsigned long length;
   466     bool reduced_len = 
false;
   470     if (length == 0) 
return 0; 
   473     if (length > smival.value.oid.len)
   475       length = smival.value.oid.len;
   506   bool valid()
 const { 
return (smival.value.oid.ptr ? 
true : 
false); }
   514     { 
return get_printable(1, smival.value.oid.len, (
char*&)iv_str); };
   524     { 
return get_printable(smival.value.oid.len - n + 1, n, (
char*&)iv_part_str); };
   539   const char *get_printable(
const unsigned long start,
   540                             const unsigned long n,
   541                             char *&buffer) 
const;
   552                             const unsigned long n)
 const   553     { 
return get_printable(start, n, (
char*&)iv_part_str); };
   579   virtual int StrToOid(
const char *
string, 
SmiLPOID dstOid) 
const;
   590     if (srcOid->
len == 0) 
return -1;
   598     dstOid->
len = srcOid->
len;
   599     return (
int) srcOid->
len;
   609   virtual int OidToStr(
const SmiOID *srcOid,
   616   inline void delete_oid_ptr();
   633   if (smival.value.oid.ptr)
   635     delete [] smival.value.oid.ptr;
   636     smival.value.oid.ptr = 0;
   638   smival.value.oid.len = 0;
   642 #ifdef SNMP_PP_NAMESPACE   646 #endif // _SNMP_OID_H_ void delete_oid_ptr()
Free the internal oid pointer and set the pointer and the length to zero. 
 
int nCompare(const unsigned long n, const Oid &o) const
Compare two Oids from the left in direction left-to-right. 
 
Oid(const unsigned long *raw_oid, int oid_len)
Constructor from array. 
 
void clear()
Clear the Oid. 
 
virtual int OidCopy(SmiLPOID srcOid, SmiLPOID dstOid) const
Clone an smi oid. 
 
bool valid() const
Return validity of the object. 
 
void trim(const unsigned long n=1)
Trim off the rightmost values of an oid. 
 
SNMP_PP_MUTABLE char * iv_part_str
 
unsigned long operator[](const unsigned int index) const
Allows element access as an array for const objects. 
 
The Object Identifier Class. 
 
SnmpCollection< Oid > OidCollection
 
SNMP_PP_MUTABLE char * iv_str
 
Oid(const Oid &oid)
Constructor using another oid object (copy constructor). 
 
unsigned long WINFAR * SmiLPUINT32
 
SnmpSyntax * clone() const
Clone this object. 
 
Oid & operator+=(const Oid &o)
Appends an Oid. 
 
const char * get_printable(const unsigned long n) const
Get a printable ASCII string of the right part of the value. 
 
unsigned long len() const
Get the length of the oid. 
 
SmiUINT32 get_syntax() const
Return the current syntax. 
 
const char * get_printable() const
Get a printable ASCII string of the whole value. 
 
Oid()
Construct an invalid Oid. 
 
SNMP_PP_MUTABLE bool m_changed
 
int nCompare(const Oid &o) const
Compare two Oids from the left in direction left-to-right. 
 
unsigned char WINFAR * SmiLPBYTE
 
SmiLPOID oidval()
Get the WinSnmp oid part. 
 
virtual ~Oid()
Destructor. 
 
unsigned long & operator[](const unsigned int index)
Allows element access as an array. 
 
virtual Oid & operator=(const Oid &oid)
Assign one Oid to another. 
 
An "abstract" (pure virtual) class that serves as the base class for all specific SNMP syntax types...
 
const char * get_printable(const unsigned long start, const unsigned long n) const
Get a printable ASCII string of a part of the value. 
 
Oid & operator+=(const unsigned long i)
Appends an int.