type conversion...
Sean
mathewss____nutech.com
Mon Aug 20 00:13:01 CEST 2001
Ok i understand now i spent some more time reading the VB
class..
unsigned long lVal;
TimeTicks tt;
vbl[0].get_value(tt);
lVal=(unsigned long)tt;
the get_value can return the protected member
---------- Original Message ----------------------------------
From: "Sean" <mathewss____nutech.com>
Reply-To: <mathewss____nutech.com>
Date: Sun, 19 Aug 2001 15:03:08 -0700
> ok but the SnmpSyntax *iv_vb_value value
>of the Vb class is protected so I cant do as you show
>ex..
>
>unsigned long ul=vbl[0].iv_vb_value;
>
> or did i miss something..
>
>---------- Original Message ----------------------------------
>From: Frank.Fock____t-online.de (Frank Fock)
>Date: Sat, 18 Aug 2001 15:42:31 +0200
>
>>Hi Sean,
>>
>>What about
>>
>>TimeTicks tt;
>>tt = (unsigned long)1;
>>unsigned long ul = (unsigned long)tt;
>>
>>All SNMP++ classes have these type of cast operators.
>>
>>Best regards,
>>Frank
>>
>>
>>Sean wrote:
>>
>>> Im a little confused about the class design
>>> it does not seem to provide any easy method of
>>> converting result get's from one type to another..
>>>
>>> If i request the uptime from an snmp device the
>>> TimeTicks class is used to hold the value. If I want
>>> the data from here i can only seem to be able
>>> to access it via get_printable() this returns nice
>>> data for a human to read but not very good for a program
>>> to digest.. Is there any easy way to get values
>>> from this class as a unsigned long etc..
>>>
>>> currently i would use
>>> vbl[0].get_printable
>>> accessing any private members is no good so i cant
>>> do
>>> (long)vbl[0].iv_vb_value->smival.value.uNumber
>>> any ideas would be appreciated.. I realy dont
>>> want to spoil the classes by addeing members
>>> if its not needed but it seems to me that
>>> there needs to be some common overide class
>>> involved where we can do something like.
>>>
>>> (long)vbl[0].get_cast()
>>> (int)vbl[0].get_cast()
>>> (char *)vbl[0].get_cast()
>>>
>>> etc where if its actual a long value the (char *) cast
>>> would covert it to a string via an ltoa...
>>>
>>> --
>>> Regards
>>> Sean Mathews Nu Tech CTO
>>>
>>> struct SoftwareProfessional {
>>> double salary;
>>> long lunches;
>>> float jobs;
>>> char unstable;
>>> void work;
>>> short tempers;
>>> };
>>> --
>>
>>
>
>--
> Regards
> Sean Mathews Nu Tech CTO
>
>struct SoftwareProfessional {
> double salary;
> long lunches;
> float jobs;
> char unstable;
> void work;
> short tempers;
>};
>--
>
More information about the AGENTPP
mailing list