EMANE  1.0.1
EMANE::Any Class Reference

The Any class can contain an instance of one of any type in its support type set. More...

#include <any.h>

Public Types

enum  Type {
  Type::TYPE_INT64, Type::TYPE_UINT64, Type::TYPE_INT32, Type::TYPE_UINT32,
  Type::TYPE_INT16, Type::TYPE_UINT16, Type::TYPE_INT8, Type::TYPE_UINT8,
  Type::TYPE_FLOAT, Type::TYPE_DOUBLE, Type::TYPE_INET_ADDR, Type::TYPE_BOOL,
  Type::TYPE_STRING
}
 

Public Member Functions

 Any (std::int64_t i64Value)
 
 Any (std::uint64_t u64Value)
 
 Any (std::int32_t i32Value)
 
 Any (std::uint32_t u32Value)
 
 Any (std::int16_t i16Value)
 
 Any (std::uint16_t u16Value)
 
 Any (std::int8_t i8Value)
 
 Any (std::uint8_t u8Value)
 
 Any (float fValue)
 
 Any (double dValue)
 
 Any (const INETAddr &addrValue)
 
 Any (const char *pzValue)
 
 Any (const std::string &sValue)
 
 Any (const bool &bValue)
 
 Any (const Any &rhs)
 
Anyoperator= (const Any &rhs)
 
 ~Any ()
 
std::int64_t asINT64 () const
 
std::uint64_t asUINT64 () const
 
std::int32_t asINT32 () const
 
std::uint32_t asUINT32 () const
 
std::int16_t asINT16 () const
 
std::uint16_t asUINT16 () const
 
std::int8_t asINT8 () const
 
std::uint8_t asUINT8 () const
 
float asFloat () const
 
double asDouble () const
 
INETAddr asINETAddr () const
 
bool asBool () const
 
std::string asString () const
 
Type getType () const
 
bool operator< (const EMANE::Any &rhs) const
 
bool operator> (const EMANE::Any &rhs) const
 
bool operator<= (const EMANE::Any &rhs) const
 
bool operator>= (const EMANE::Any &rhs) const
 
std::string toString () const
 

Static Public Member Functions

static Any create (std::string sValue, Type type)
 

Detailed Description

The Any class can contain an instance of one of any type in its support type set.

Definition at line 49 of file any.h.

Member Enumeration Documentation

◆ Type

enum EMANE::Any::Type
strong
Enumerator
TYPE_INT64 
TYPE_UINT64 
TYPE_INT32 
TYPE_UINT32 
TYPE_INT16 
TYPE_UINT16 
TYPE_INT8 
TYPE_UINT8 
TYPE_FLOAT 
TYPE_DOUBLE 
TYPE_INET_ADDR 
TYPE_BOOL 
TYPE_STRING 

Definition at line 52 of file any.h.

Constructor & Destructor Documentation

◆ Any() [1/15]

EMANE::Any::Any ( std::int64_t  i64Value)
explicit

Creates an Any instance from a signed 64-bit integer

Definition at line 36 of file any.cc.

◆ Any() [2/15]

EMANE::Any::Any ( std::uint64_t  u64Value)
explicit

Creates an Any instance from an unsigned 64-bit integer

Definition at line 40 of file any.cc.

◆ Any() [3/15]

EMANE::Any::Any ( std::int32_t  i32Value)
explicit

Creates an Any instance from a signed 32-bit integer

Definition at line 44 of file any.cc.

◆ Any() [4/15]

EMANE::Any::Any ( std::uint32_t  u32Value)
explicit

Creates an Any instance from an unsigned 32-bit integer

Definition at line 48 of file any.cc.

◆ Any() [5/15]

EMANE::Any::Any ( std::int16_t  i16Value)
explicit

Creates an Any instance from a signed 16-bit integer

Definition at line 52 of file any.cc.

◆ Any() [6/15]

EMANE::Any::Any ( std::uint16_t  u16Value)
explicit

Creates an Any instance from a unsigned 16-bit integer

Definition at line 56 of file any.cc.

◆ Any() [7/15]

EMANE::Any::Any ( std::int8_t  i8Value)
explicit

Creates an Any instance from a signed 8-bit integer

Definition at line 60 of file any.cc.

◆ Any() [8/15]

EMANE::Any::Any ( std::uint8_t  u8Value)
explicit

Creates an Any instance from a unsigned 8-bit integer

Definition at line 64 of file any.cc.

◆ Any() [9/15]

EMANE::Any::Any ( float  fValue)
explicit

Creates an Any instance from a float

Definition at line 68 of file any.cc.

◆ Any() [10/15]

EMANE::Any::Any ( double  dValue)
explicit

Creates an Any instance from a double

Definition at line 72 of file any.cc.

◆ Any() [11/15]

EMANE::Any::Any ( const INETAddr addrValue)
explicit

Creates an Any instance from an INETAddr

Definition at line 76 of file any.cc.

◆ Any() [12/15]

EMANE::Any::Any ( const char *  pzValue)
explicit

Creates an Any instance from a NULL terminated string

Definition at line 84 of file any.cc.

◆ Any() [13/15]

EMANE::Any::Any ( const std::string &  sValue)
explicit

Creates an Any instance from a std::string

Definition at line 88 of file any.cc.

◆ Any() [14/15]

EMANE::Any::Any ( const bool &  bValue)
explicit

Creates an Any instance from a boolean

Definition at line 80 of file any.cc.

◆ Any() [15/15]

EMANE::Any::Any ( const Any rhs)

Creates an Any instance from another instance

Definition at line 92 of file any.cc.

◆ ~Any()

EMANE::Any::~Any ( )

Destroys an instance

Definition at line 136 of file any.cc.

Member Function Documentation

◆ asBool()

bool EMANE::Any::asBool ( ) const

Gets the boolean Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 260 of file any.cc.

◆ asDouble()

double EMANE::Any::asDouble ( ) const

Gets the double Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 239 of file any.cc.

◆ asFloat()

float EMANE::Any::asFloat ( ) const

Gets the float Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 229 of file any.cc.

◆ asINETAddr()

EMANE::INETAddr EMANE::Any::asINETAddr ( ) const

Gets the INETAddr Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 249 of file any.cc.

◆ asINT16()

std::int16_t EMANE::Any::asINT16 ( ) const

Gets the signed 16-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 189 of file any.cc.

◆ asINT32()

std::int32_t EMANE::Any::asINT32 ( ) const

Gets the signed 32-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 169 of file any.cc.

◆ asINT64()

std::int64_t EMANE::Any::asINT64 ( ) const

Gets the signed 64-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 149 of file any.cc.

◆ asINT8()

std::int8_t EMANE::Any::asINT8 ( ) const

Gets the signed 8-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 209 of file any.cc.

◆ asString()

std::string EMANE::Any::asString ( ) const

Gets the string Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 271 of file any.cc.

◆ asUINT16()

std::uint16_t EMANE::Any::asUINT16 ( ) const

Gets the unsigned 16-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 199 of file any.cc.

◆ asUINT32()

std::uint32_t EMANE::Any::asUINT32 ( ) const

Gets the unsigned 32-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 179 of file any.cc.

◆ asUINT64()

std::uint64_t EMANE::Any::asUINT64 ( ) const

Gets the unsigned 64-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 159 of file any.cc.

◆ asUINT8()

std::uint8_t EMANE::Any::asUINT8 ( ) const

Gets the unsigned 8-bit integer Any value

Returns
value
Exceptions
AnyExceptionif value is a different type

Definition at line 219 of file any.cc.

◆ create()

EMANE::Any EMANE::Any::create ( std::string  sValue,
Type  type 
)
static

Creates an Any instance from a string value and type

Parameters
sValueValue as a string
typeType interpret the value as

Definition at line 343 of file any.cc.

◆ getType()

EMANE::Any::Type EMANE::Any::getType ( ) const

Gets the Any type

Returns
value

Definition at line 281 of file any.cc.

◆ operator<()

bool EMANE::Any::operator< ( const EMANE::Any rhs) const

Less than comparison

Parameters
rhsINstance to compare
Returns
true if less than

Definition at line 476 of file any.cc.

◆ operator<=()

bool EMANE::Any::operator<= ( const EMANE::Any rhs) const

Less than or equal comparison

Parameters
rhsINstance to compare
Returns
true if less than or equal

Definition at line 400 of file any.cc.

◆ operator=()

EMANE::Any & EMANE::Any::operator= ( const Any rhs)

Creates an Any instance from another instance

Definition at line 110 of file any.cc.

◆ operator>()

bool EMANE::Any::operator> ( const EMANE::Any rhs) const

Greater than comparison

Parameters
rhsINstance to compare
Returns
true if greater than

Definition at line 513 of file any.cc.

◆ operator>=()

bool EMANE::Any::operator>= ( const EMANE::Any rhs) const

Greater than or equal comparison

Parameters
rhsINstance to compare
Returns
true if greater than or equal

Definition at line 438 of file any.cc.

◆ toString()

std::string EMANE::Any::toString ( ) const

Gets the stringified Any value

Returns
value as string

Definition at line 292 of file any.cc.

Member Data Documentation

◆ addrValue_

INETAddr EMANE::Any::addrValue_

Definition at line 338 of file any.h.

◆ dValue_

double EMANE::Any::dValue_

Definition at line 336 of file any.h.

◆ i64Value_

std::int64_t EMANE::Any::i64Value_

Definition at line 334 of file any.h.

◆ sValue_

std::string EMANE::Any::sValue_

Definition at line 337 of file any.h.

◆ u64Value_

std::uint64_t EMANE::Any::u64Value_

Definition at line 335 of file any.h.


The documentation for this class was generated from the following files: