11 #ifndef _LIBALVALUE_ALVALUE_ALVALUE_H_
12 #define _LIBALVALUE_ALVALUE_ALVALUE_H_
27 #ifndef ALVALUE_VERBOSITY
28 # define ALVALUE_VERBOSITY
54 friend void ConvertALValueToSoapXml(
const ALValue *pAlValue,
55 std::string &strToFill,
57 friend class ALNetwork;
183 ALValue(
const std::string &value);
194 ALValue(
const std::vector<std::string> &pListString);
199 ALValue(
const std::vector<float> &pListFloat);
204 ALValue(
const std::vector<int> &pListInt);
211 ALValue(
const void *value,
int nBytes);
217 ALValue(
const char **pArrayOfString,
int nNbrString);
223 ALValue(
const float *pFloat,
int nNbrElement);
229 ALValue(
const int *pInt,
int nNbrElement);
235 ALValue(
const TAlValueBinaryData &rhs);
256 ALValue& operator=(
const bool &rhs);
258 ALValue& operator=(
const int &rhs);
260 ALValue& operator=(
const double &rhs);
262 ALValue& operator=(
const float &rhs);
264 ALValue& operator=(
const char *rhs);
266 ALValue& operator=(
const TAlValueBinaryData &rhs);
273 bool operator==(
ALValue const &other)
const;
279 bool operator!=(
ALValue const &other)
const;
296 operator const bool()
const;
312 operator const int()
const;
328 operator const float()
const;
337 operator const double()
const;
346 operator long long()
const;
354 operator std::string&();
362 operator const std::string&()
const;
371 operator TAlValueBinaryData&();
379 operator const TAlValueBinaryData&()
const;
387 operator const void*()
const;
436 ALValue& setObject(
const void* pData,
int nDataSizeInBytes);
443 void SetBinary(
const void *rhs,
int nDataSizeInBytes);
450 ALValue& SetBinaryNoCopy(
const void *rhs,
int nDataSizeInBytes);
456 const void* GetBinary()
const;
461 const void* getObject()
const;
479 bool bInsertDefaultOnError =
false)
const;
490 bool bInsertDefaultOnError =
false)
const;
501 bool bInsertDefaultOnError =
false)
const;
518 const ALValue& operator[](
int i)
const;
524 enum Type getType()
const;
530 bool isValid ()
const;
535 bool isArray ()
const;
540 bool isBool ()
const;
550 bool isFloat ()
const;
555 bool isString()
const;
560 bool isObject()
const;
565 bool isBinary()
const;
570 std::vector<unsigned char> asRaw()
const;
577 unsigned int getSize()
const;
589 void arrayReserve(
int size);
596 void arraySetSize(
int size);
607 void arrayPush(
const ALValue &pSrcToCopyNotOwned);
616 void arrayPopFront();
628 std::string toString(Verbosity pnVerbosity = VerbosityMini)
const;
639 std::string toPythonBuffer()
const;
650 bool decodeB64(
const char *pszB64);
661 bool decodeB64Object(
const char *pszB64);
667 void encodeB64(std::string &strOutput)
const;
681 static enum Type deduceType(
const char *szInput,
682 int nLimitToLen = 0x7FFFFFFF);
692 void unSerializeFromText(
const char *szInput,
693 int nLimitToLen = 0x7FFFFFFF);
700 std::string serializeToText(
void)
const;
707 static bool xUnSerializeFromText_InnerTest(
void);
709 template <
typename T0>
710 static ALValue array(
const T0 &a0);
711 template <
typename T0,
typename T1>
712 static ALValue array(
const T0 &a0,
const T1 &a1);
713 template <
typename T0,
typename T1,
typename T2>
714 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2);
715 template <
typename T0,
typename T1,
typename T2,
typename T3>
716 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3);
717 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
718 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4);
719 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
720 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5);
721 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
722 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5,
const T6 &a6);
723 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
724 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);
725 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
726 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);
727 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
728 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);
733 void xAssertCompatibleType(
enum Type pnWantedType);
734 void xAssertType(
enum Type pnWantedType)
const;
735 void xAssertArraySize(
int pnSize)
const;
766 static std::string TypeToString(
enum Type pnType);
770 template <
typename T0>
779 template <
typename T0,
typename T1>
789 template <
typename T0,
typename T1,
typename T2>
800 template <
typename T0,
typename T1,
typename T2,
typename T3>
812 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
825 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
839 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
840 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5,
const T6 &a6)
854 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
855 ALValue 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)
870 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
871 ALValue 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)
887 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
888 ALValue 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)
915 #endif // _LIBALVALUE_ALVALUE_ALVALUE_H_
std::string TALValueString
Type definition to std::string.
static ALValue array(const T0 &a0)
TAlValueBinaryData * asObject
TAlValueBinaryData::iterator ITAlValueBinaryData
Iterator to a vector of unsigned char used for binary data.
std::ostream & operator<<(std::ostream &os, const AL::ALValue &a)
Stream operator for ALValue.
TALValueString * asString
int TALValueInt
Type definition to int.
int _type
Type of the ALValue.
unionValue is a union to different type of ALValue.
std::vector< unsigned char > TAlValueBinaryData
Vector of unsigned char used for binary data.
TAlValueBinaryData * asBinary
std::vector< std::string > TStringArray
Vector of std::string.
TAlValueArray::iterator ITAlValueArray
Iterator to a vector of ALValue.
void arraySetSize(int size)
Specify the size of the array this will call vector::resize.
double TALValueDouble
Type definition to double.
ALValue is a class to manipulate differente value type.
float TALValueFloat
Type definition to float.
TAlValueBinaryData::const_iterator CITAlValueBinaryData
Const iterator to a vector of unsigned char used for binary data.
TAlValueArray::const_iterator CITAlValueArray
Const iterator to a vector of ALValue.
std::vector< float > TFloatArray
Vector of float.
bool TALValueBool
Type definition to bool.
std::vector< ALValue > TAlValueArray
Vector of ALValue.
std::vector< int > TIntArray
Vector of int.