AL::ALValue Class Reference

ALValue is a class to manipulate differente value type. More...

#include " alvalue/alvalue.h "

Classes

union unionValue
unionValue is a union to different type of ALValue . More...

Public Types

enum Type {
TypeInvalid = 0, TypeArray , TypeBool , TypeInt ,
TypeFloat , TypeString , TypeObject , TypeBinary
}
Type of ALValue . More...
typedef int TALValueInt
Type definition to int. More...
typedef float TALValueFloat
Type definition to float. More...
typedef double TALValueDouble
Type definition to double. More...
typedef bool TALValueBool
Type definition to bool. More...
typedef std::string TALValueString
Type definition to std::string. More...
typedef std::vector< unsigned
char >
TAlValueBinaryData
Vector of unsigned char used for binary data. More...
typedef
TAlValueBinaryData::iterator
ITAlValueBinaryData
Iterator to a vector of unsigned char used for binary data. More...
typedef
TAlValueBinaryData::const_iterator
CITAlValueBinaryData
Const iterator to a vector of unsigned char used for binary data. More...
typedef std::vector< ALValue > TAlValueArray
Vector of ALValue . More...
typedef TAlValueArray::iterator ITAlValueArray
Iterator to a vector of ALValue . More...
typedef
TAlValueArray::const_iterator
CITAlValueArray
Const iterator to a vector of ALValue . More...
typedef std::vector< std::string > TStringArray
Vector of std::string. More...
typedef std::vector< float > TFloatArray
Vector of float. More...
typedef std::vector< int > TIntArray
Vector of int. More...

Public Member Functions

ALValue ()
Default constructor. More...
ALValue (const bool &value)
Constructor. More...
ALValue (const int &value)
Constructor. More...
ALValue (const double &value)
Constructor. More...
ALValue (const float &value)
Constructor. More...
ALValue (const std::string &value)
Constructor. More...
ALValue (const char *value)
Constructor. More...
ALValue (const std::vector< std::string > &pListString)
Constructor. More...
ALValue (const std::vector< float > &pListFloat)
Constructor. More...
ALValue (const std::vector< int > &pListInt)
Constructor. More...
ALValue (const void *value, int nBytes)
Constructor. More...
ALValue (const char **pArrayOfString, int nNbrString)
Constructor. More...
ALValue (const float *pFloat, int nNbrElement)
Constructor. More...
ALValue (const int *pInt, int nNbrElement)
Constructor. More...
ALValue (const TAlValueBinaryData &rhs)
Copy constructor form binary data. More...
ALValue ( ALValue const &rhs)
Copy constructor. More...
~ALValue ()
Desctuctor. More...
void clear ()
Erase the current value. More...
ALValue & operator= (const ALValue &rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
ALValue & operator= (const bool &rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
ALValue & operator= (const int &rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
ALValue & operator= (const double &rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
ALValue & operator= (const float &rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
ALValue & operator= (const char *rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
ALValue & operator= (const TAlValueBinaryData &rhs)
Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs. More...
bool operator== ( ALValue const &other) const
alvalue.Type == other.alvalue.Type && alvalue.unionValue == other.alvalue.unionValue More...
bool operator!= ( ALValue const &other) const
alvalue.Type != other.alvalue.Type && alvalue.unionValue != other.alvalue.unionValue More...
operator bool & ()
Conversion operator to bool. More...
operator const bool () const
Conversion operator to const bool. More...
operator int & ()
Conversion operator to int. More...
operator const int () const
Conversion operator to const int. More...
operator float & ()
Conversion operator to float. More...
operator const float () const
Conversion operator to const float. More...
operator const double () const
Conversion operator to const double. More...
operator long long () const
Conversion operator to long long. More...
operator std::string & ()
Conversion operator to std::string. More...
operator const std::string & () const
Conversion operator to const std::string. More...
operator TAlValueBinaryData & ()
Conversion operator to binary data. More...
operator const TAlValueBinaryData & () const
Conversion operator to const binary data. More...
operator const void * () const
Conversion operator to const void*. More...
operator TStringArray () const
Conversion operator to a vector of stf::string. More...
operator TFloatArray () const
Conversion operator to a vector of float. More...
operator TIntArray () const
Conversion operator to a vector of int. More...
ALValue & setObject (const void *pData, int nDataSizeInBytes)
Set ALValue with an object data. More...
void SetBinary (const void *rhs, int nDataSizeInBytes)
Set ALValue with a binary data. More...
ALValue & SetBinaryNoCopy (const void *rhs, int nDataSizeInBytes)
Set ALValue with a binary data. It won't copy the data. More...
const void * GetBinary () const
Explicit operator to convert to const void*. More...
const void * getObject () const
Explicit operator to convert to const void*. More...
void * getPtrValue ()
Get pointer on value, only allowed with 32bits variable. More...
int * getIntPtr ()
Get pointer on int value. If the value is invalid, initialize it to 0. If the value is not invalid nor an int, throw. More...
float * getFloatPtr ()
Get pointer on float value. If the value is invalid, initialize it to 0.f. If the value is not invalid nor a float, throw. More...
void ToStringArray ( TStringArray &pArrayToFill, bool bInsertDefaultOnError=false) const
Explicit convert to vector<string>. More...
void ToFloatArray ( TFloatArray &pArrayToFill, bool bInsertDefaultOnError=false) const
Explicit convert to vector<float>. More...
void ToIntArray ( TIntArray &pArrayToFill, bool bInsertDefaultOnError=false) const
Explicit convert to vector<int>. More...
ALValue & operator[] (int i)
Get a reference to the ALValue at position i in the vector. More...
const ALValue & operator[] (int i) const
Get a reference to the ALValue at position i in the vector. More...
enum Type getType () const
Gat the type of the stored value. More...
bool isValid () const
Check if the value has been set. More...
bool isArray () const
Check if the value is an array. More...
bool isBool () const
Check if the value is a boolean. More...
bool isInt () const
Check if the value is an integer. More...
bool isFloat () const
Check if the value is a float. More...
bool isString () const
Check if the value is a string. More...
bool isObject () const
Check if the value is a binary object. More...
bool isBinary () const
Check if the value is a binary. More...
std::vector< unsigned char > asRaw () const
Get raw value of. More...
unsigned int getSize () const
Get the size for string, objectm array, binary, invalid values. More...
void arrayReserve (int size)
Specify the size the array values will use. More...
void arraySetSize (int size)
Specify the size of the array this will call vector::resize. More...
void arrayPush (const ALValue &pSrcToCopyNotOwned)
Adds a new element at the end of the vector, after its current last element. More...
void arrayPopFront ()
Pop the first element of the array. Deleting it. More...
std::string toString (Verbosity pnVerbosity=VerbosityMini) const
Get a string describing this object, for debug purpose. More...
std::string toPythonBuffer () const
Build python buffer from ALValue binary. More...
bool decodeB64 (const char *pszB64)
Decode a buffer from B64 to binary. More...
bool decodeB64Object (const char *pszB64)
Decode a buffer from B64 to binary object. More...
void encodeB64 (std::string &strOutput) const
Encode a binaries alvalue to B64 (binary 64 / uuencoded). More...
void unSerializeFromText (const char *szInput, int nLimitToLen=0x7FFFFFFF)
Create an ALValue from a text. More...
std::string serializeToText (void) const
Create a text describing an ALValue . More...
const unionValue getUnionValue ()
Get the value of the ALValue . More...
TAlValueArray * getArrayPtr () const
Get pointer on array value. More...

Static Public Member Functions

static enum Type deduceType (const char *szInput, int nLimitToLen=0x7FFFFFFF)
Analyses a string and try to guess the type of data describe in the string. More...
static bool xUnSerializeFromText_InnerTest (void)
Internal function to validate the correct functionnality of unSerializeFromText. More...
template<typename T0 >
static ALValue array (const T0 &a0)
template<typename T0 , typename T1 >
static ALValue array (const T0 &a0, const T1 &a1)
template<typename T0 , typename T1 , typename T2 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2)
template<typename T0 , typename T1 , typename T2 , typename T3 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3)
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4)
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5)
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6)
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7)
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7, const T8 &a8)
template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
static ALValue array (const T0 &a0, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7, const T8 &a8, const T9 &a9)
static std::string TypeToString (enum Type pnType)
Get a string with name of ALValue type. More...

Protected Attributes

int _type
Type of the ALValue . More...
union unionValue _value
Value of the ALValue . More...

Friends

class ALNetwork
void ConvertALValueToSoapXml (const ALValue *pAlValue, std::string &strToFill, bool bInAnArray)

Detailed Description

ALValue is a class to manipulate differente value type.

It's using to convert multiple value type to one type, to ease the communication or storage of differente values.

Definition at line 52 of file alvalue.h .

Member Typedef Documentation

Const iterator to a vector of ALValue .

Definition at line 116 of file alvalue.h .

Const iterator to a vector of unsigned char used for binary data.

Definition at line 100 of file alvalue.h .

Iterator to a vector of ALValue .

Definition at line 111 of file alvalue.h .

Iterator to a vector of unsigned char used for binary data.

Definition at line 95 of file alvalue.h .

Vector of ALValue .

Definition at line 106 of file alvalue.h .

Vector of unsigned char used for binary data.

Definition at line 90 of file alvalue.h .

Type definition to bool.

Definition at line 79 of file alvalue.h .

Type definition to double.

Definition at line 74 of file alvalue.h .

Type definition to float.

Definition at line 69 of file alvalue.h .

Type definition to int.

Definition at line 64 of file alvalue.h .

Type definition to std::string.

Definition at line 84 of file alvalue.h .

Vector of float.

Definition at line 398 of file alvalue.h .

Vector of int.

Definition at line 403 of file alvalue.h .

Vector of std::string.

Definition at line 393 of file alvalue.h .

Member Enumeration Documentation

Type of ALValue .

Warning
this enum order matter, it is used in paramtype.h
double support cannot be added. This would break:
v = 0.1;
sometime the compiler will use the double constructor instead of the float one, breaking too much user code.
Enumerator
TypeInvalid

Invalid type.

TypeArray

Array type.

TypeBool

Boolean type.

TypeInt

Integer type.

TypeFloat

Float type.

TypeString

String type.

TypeObject

Object type.

TypeBinary

Base64 type.

Definition at line 145 of file alvalue.h .

Constructor & Destructor Documentation

AL::ALValue::ALValue ( )

Default constructor.

AL::ALValue::ALValue ( const bool & value )

Constructor.

Parameters
value value of the ALValue
AL::ALValue::ALValue ( const int & value )

Constructor.

Parameters
value value of the ALValue
AL::ALValue::ALValue ( const double & value )

Constructor.

Parameters
value value of the ALValue
AL::ALValue::ALValue ( const float & value )

Constructor.

Parameters
value value of the ALValue
AL::ALValue::ALValue ( const std::string & value )

Constructor.

Parameters
value value of the ALValue
AL::ALValue::ALValue ( const char * value )

Constructor.

Parameters
value value of the ALValue
AL::ALValue::ALValue ( const std::vector< std::string > & pListString )

Constructor.

Parameters
pListString value of the ALValue
AL::ALValue::ALValue ( const std::vector< float > & pListFloat )

Constructor.

Parameters
pListFloat value of the ALValue
AL::ALValue::ALValue ( const std::vector< int > & pListInt )

Constructor.

Parameters
pListInt value of the ALValue
AL::ALValue::ALValue ( const void * value ,
int nBytes
)

Constructor.

Parameters
value value of the ALValue
nBytes size of the value
AL::ALValue::ALValue ( const char ** pArrayOfString ,
int nNbrString
)

Constructor.

Parameters
pArrayOfString value of the ALValue
nNbrString string's number
AL::ALValue::ALValue ( const float * pFloat ,
int nNbrElement
)

Constructor.

Parameters
pFloat value of the ALValue
nNbrElement float's number
AL::ALValue::ALValue ( const int * pInt ,
int nNbrElement
)

Constructor.

Parameters
pInt value of the ALValue
nNbrElement int's number
AL::ALValue::ALValue ( const TAlValueBinaryData & rhs )

Copy constructor form binary data.

Parameters
rhs value copied
AL::ALValue::ALValue ( ALValue const & rhs )

Copy constructor.

Parameters
rhs value copied
AL::ALValue::~ALValue ( )

Desctuctor.

Member Function Documentation

template<typename T0 >
ALValue AL::ALValue::array ( const T0 & a0 )
static

Definition at line 787 of file alvalue.h .

template<typename T0 , typename T1 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1
)
static

Definition at line 796 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2
)
static

Definition at line 806 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3
)
static

Definition at line 817 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3 ,
const T4 & a4
)
static

Definition at line 829 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3 ,
const T4 & a4 ,
const T5 & a5
)
static

Definition at line 842 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3 ,
const T4 & a4 ,
const T5 & a5 ,
const T6 & a6
)
static

Definition at line 856 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3 ,
const T4 & a4 ,
const T5 & a5 ,
const T6 & a6 ,
const T7 & a7
)
static

Definition at line 871 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3 ,
const T4 & a4 ,
const T5 & a5 ,
const T6 & a6 ,
const T7 & a7 ,
const T8 & a8
)
static

Definition at line 887 of file alvalue.h .

template<typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
ALValue AL::ALValue::array ( const T0 & a0 ,
const T1 & a1 ,
const T2 & a2 ,
const T3 & a3 ,
const T4 & a4 ,
const T5 & a5 ,
const T6 & a6 ,
const T7 & a7 ,
const T8 & a8 ,
const T9 & a9
)
static

Definition at line 904 of file alvalue.h .

void AL::ALValue::arrayPopFront ( )

Pop the first element of the array. Deleting it.

Does completely delete the first element of the array, if the AL::ALValue is an array, and if it is not empty.

void AL::ALValue::arrayPush ( const ALValue & pSrcToCopyNotOwned )

Adds a new element at the end of the vector, after its current last element.

The content of this new element is initialized to a copy of pSrcToCopyNotOwned .

Parameters
pSrcToCopyNotOwned Value to be copied to the new element. Push a new value in the array
void AL::ALValue::arrayReserve ( int size )

Specify the size the array values will use.

Requests that the capacity of the allocated storage space for the ALValue of the vector container be at least enough to hold size elements.

Parameters
size minimum amount desired as capacity of allocated storage
Exceptions
ALError if alvalue.type != TypeArray
void AL::ALValue::arraySetSize ( int size )

Specify the size of the array this will call vector::resize.

Parameters
size the new size of the array
std::vector<unsigned char> AL::ALValue::asRaw ( ) const

Get raw value of.

Returns
std::vector of object and binary.
void AL::ALValue::clear ( )

Erase the current value.

bool AL::ALValue::decodeB64 ( const char * pszB64 )

Decode a buffer from B64 to binary.

Decode a string containing some binaries encoded in B64 (binary 64 / uuencoded)

Parameters
pszB64 the buffer to decode
Returns
true
Warning
public method called from FillAlValueFromXmlNodeContent...
bool AL::ALValue::decodeB64Object ( const char * pszB64 )

Decode a buffer from B64 to binary object.

Decode a string containing some binaries encoded in B64 (binary 64 / uuencoded)

Parameters
pszB64 the buffer to decode
Returns
true
Warning
public method called from FillAlValueFromXmlNodeContent...
static enum Type AL::ALValue::deduceType ( const char * szInput ,
int nLimitToLen = 0x7FFFFFFF
)
static

Analyses a string and try to guess the type of data describe in the string.

eg: "5" => int; "'toto'" => string; [3,5] => array ...

Parameters
szInput a text to analyse, eg: "[36, 3, "toto", 3.5, [1,2,3]]"
nLimitToLen limit analysis to nLimitToLen first characters
Returns
type of the value
Exceptions
ALERROR
void AL::ALValue::encodeB64 ( std::string & strOutput ) const

Encode a binaries alvalue to B64 (binary 64 / uuencoded).

Parameters
strOutput the buffer to receive or data encoded in B64
TAlValueArray * AL::ALValue::getArrayPtr ( ) const

Get pointer on array value.

Returns
a pointer on the array
const void* AL::ALValue::GetBinary ( ) const

Explicit operator to convert to const void*.

Returns
A pointer on value.
float* AL::ALValue::getFloatPtr ( )

Get pointer on float value. If the value is invalid, initialize it to 0.f. If the value is not invalid nor a float, throw.

Returns
A pointer on float value.
int* AL::ALValue::getIntPtr ( )

Get pointer on int value. If the value is invalid, initialize it to 0. If the value is not invalid nor an int, throw.

Returns
A pointer on int value.
const void* AL::ALValue::getObject ( ) const

Explicit operator to convert to const void*.

Returns
A pointer on value.
void* AL::ALValue::getPtrValue ( )

Get pointer on value, only allowed with 32bits variable.

Returns
A pointer on value.
unsigned int AL::ALValue::getSize ( ) const

Get the size for string, objectm array, binary, invalid values.

Returns
the size of the ALValue (0 if alvalue.type == InvalidType)
Exceptions
ALERROR if the value is null
enum Type AL::ALValue::getType ( ) const

Gat the type of the stored value.

See Also
Type .
Returns
the type of the value.
const unionValue AL::ALValue::getUnionValue ( )

Get the value of the ALValue .

Returns
the value
bool AL::ALValue::isArray ( ) const

Check if the value is an array.

Returns
true if alvalue.type == TypeArray, false otherswise
bool AL::ALValue::isBinary ( ) const

Check if the value is a binary.

Returns
true if alvalue.type == TypeBinary, false otherswise
bool AL::ALValue::isBool ( ) const

Check if the value is a boolean.

Returns
true if alvalue.type == TypeBool, false otherswise
bool AL::ALValue::isFloat ( ) const

Check if the value is a float.

Returns
true if alvalue.type == TypeFloat, false otherswise
bool AL::ALValue::isInt ( ) const

Check if the value is an integer.

Returns
true if alvalue.type == TypeInt, false otherswise
bool AL::ALValue::isObject ( ) const

Check if the value is a binary object.

Returns
true if alvalue.type == TypeObject, false otherswise
bool AL::ALValue::isString ( ) const

Check if the value is a string.

Returns
true if alvalue.type == TypeString, false otherswise
bool AL::ALValue::isValid ( ) const

Check if the value has been set.

Returns
true if alvalue.type != TypeInvalid, false otherswise
AL::ALValue::operator bool & ( )

Conversion operator to bool.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const bool ( ) const

Conversion operator to const bool.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const double ( ) const

Conversion operator to const double.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const float ( ) const

Conversion operator to const float.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const int ( ) const

Conversion operator to const int.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const std::string & ( ) const

Conversion operator to const std::string.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const TAlValueBinaryData & ( ) const

Conversion operator to const binary data.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator const void * ( ) const

Conversion operator to const void*.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator float & ( )

Conversion operator to float.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator int & ( )

Conversion operator to int.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator long long ( ) const

Conversion operator to long long.

Assert the object is compatible with a wanted type. If the object is not initialized, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator std::string & ( )

Conversion operator to std::string.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator TAlValueBinaryData & ( )

Conversion operator to binary data.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator TFloatArray ( ) const

Conversion operator to a vector of float.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator TIntArray ( ) const

Conversion operator to a vector of int.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
AL::ALValue::operator TStringArray ( ) const

Conversion operator to a vector of stf::string.

Assert the object is compatible with a wanted type. If the object is unitialiazed, it will be changed to the good type

Exceptions
ALERROR
bool AL::ALValue::operator!= ( ALValue const & other ) const

alvalue.Type != other.alvalue.Type && alvalue.unionValue != other.alvalue.unionValue

Returns
true if not equal ALValue , false otherwise
ALValue & AL::ALValue::operator= ( const ALValue & rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
ALValue & AL::ALValue::operator= ( const bool & rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
ALValue & AL::ALValue::operator= ( const int & rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
ALValue & AL::ALValue::operator= ( const double & rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
ALValue & AL::ALValue::operator= ( const float & rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
ALValue & AL::ALValue::operator= ( const char * rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
ALValue & AL::ALValue::operator= ( const TAlValueBinaryData & rhs )

Makes a copy of rhs, discarding previous content, so that the new content of is equivalent in both type and value to rhs.

Parameters
rhs value copied
bool AL::ALValue::operator== ( ALValue const & other ) const

alvalue.Type == other.alvalue.Type && alvalue.unionValue == other.alvalue.unionValue

Returns
true if equal ALValue , false otherwise
ALValue & AL::ALValue::operator[] ( int i )

Get a reference to the ALValue at position i in the vector.

Parameters
i position in the vector
Returns
a reference to the ALValue
Exceptions
ALERROR if alvalue.type != TypeArray || i out of range.
const ALValue & AL::ALValue::operator[] ( int i ) const

Get a reference to the ALValue at position i in the vector.

Parameters
i position in the vector
Returns
a reference to the ALValue
Exceptions
ALERROR if alvalue.type != TypeArray || i out of range.
std::string AL::ALValue::serializeToText ( void ) const

Create a text describing an ALValue .

Returns
the new string
Exceptions
ALERROR
void AL::ALValue::SetBinary ( const void * rhs ,
int nDataSizeInBytes
)

Set ALValue with a binary data.

Parameters
rhs pointer to data
nDataSizeInBytes data's size
ALValue & AL::ALValue::SetBinaryNoCopy ( const void * rhs ,
int nDataSizeInBytes
)

Set ALValue with a binary data. It won't copy the data.

Parameters
rhs pointer to data
nDataSizeInBytes (unused)
Returns
ALValue with the data.
ALValue & AL::ALValue::setObject ( const void * pData ,
int nDataSizeInBytes
)

Set ALValue with an object data.

Parameters
pData pointer to data
nDataSizeInBytes data's size
Returns
ALValue with the data.
void AL::ALValue::ToFloatArray ( TFloatArray & pArrayToFill ,
bool bInsertDefaultOnError = false
) const

Explicit convert to vector<float>.

Parameters
pArrayToFill the value to fill with string value from the ALValue
bInsertDefaultOnError a flag to inform what to do on a not wanted type. If set to false, invalid value are skipped, on true empty string will be inserted in the vector
void AL::ALValue::ToIntArray ( TIntArray & pArrayToFill ,
bool bInsertDefaultOnError = false
) const

Explicit convert to vector<int>.

Parameters
pArrayToFill the value to fill with string value from the ALValue
bInsertDefaultOnError a flag to inform what to do on a not wanted type. If set to false, invalid value are skipped, on true empty string will be inserted in the vector
std::string AL::ALValue::toPythonBuffer ( ) const

Build python buffer from ALValue binary.

Decode a string containing some binaries encoded in B64 (binary 64 / uuencoded).

Returns
python compatible string
Warning
public method called from FillAlValueFromXmlNodeContent...
std::string AL::ALValue::toString ( Verbosity pnVerbosity = VerbosityMini ) const

Get a string describing this object, for debug purpose.

Parameters
pnVerbosity style of ouput format
Warning
the VerbosityMini style is used in some code, it's the minimal description of the contents of an alvalue, with [] to describe array.
it's done to be directly evaluatable in script language (tested with: urbi and ruby)
Exceptions
ALERROR
void AL::ALValue::ToStringArray ( TStringArray & pArrayToFill ,
bool bInsertDefaultOnError = false
) const

Explicit convert to vector<string>.

Parameters
pArrayToFill the value to fill with string value from the ALValue
bInsertDefaultOnError a flag to inform what to do on a not wanted type. If set to false, invalid value are skipped, on true empty string will be inserted in the vector
static std::string AL::ALValue::TypeToString ( enum Type pnType )
static

Get a string with name of ALValue type.

Returns
"Invalid", "Array", "Bool", "Int", "Float", "String", "Object", "Binary"
void AL::ALValue::unSerializeFromText ( const char * szInput ,
int nLimitToLen = 0x7FFFFFFF
)

Create an ALValue from a text.

Parameters
szInput the source analysed to construct the alvalue, eg: "1" or "[36,3,"toto",3.5,[1,2,3]]"
nLimitToLen limit analysis to nLimitToLen first characters (used in recursion)
Exceptions
ALERROR
static bool AL::ALValue::xUnSerializeFromText_InnerTest ( void )
static

Internal function to validate the correct functionnality of unSerializeFromText.

Returns
true if test ok, false othewise

Friends And Related Function Documentation

friend class ALNetwork
friend

Definition at line 57 of file alvalue.h .

void ConvertALValueToSoapXml ( const ALValue * pAlValue ,
std::string & strToFill ,
bool bInAnArray
)
friend

Member Data Documentation

int AL::ALValue::_type
protected

Type of the ALValue .

Definition at line 760 of file alvalue.h .

union unionValue AL::ALValue::_value
protected

Value of the ALValue .

Definition at line 762 of file alvalue.h .


The documentation for this class was generated from the following file:
  • /home/opennao/work/release-2.8/sdk/libnaoqi/libalvalue/alvalue/ alvalue.h