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;
483 float *getFloatPtr();
495 bool bInsertDefaultOnError =
false)
const;
506 bool bInsertDefaultOnError =
false)
const;
517 bool bInsertDefaultOnError =
false)
const;
534 const ALValue& operator[](
int i)
const;
540 enum Type getType()
const;
546 bool isValid ()
const;
551 bool isArray ()
const;
556 bool isBool ()
const;
566 bool isFloat ()
const;
571 bool isString()
const;
576 bool isObject()
const;
581 bool isBinary()
const;
586 std::vector<unsigned char> asRaw()
const;
593 unsigned int getSize()
const;
605 void arrayReserve(
int size);
612 void arraySetSize(
int size);
623 void arrayPush(
const ALValue &pSrcToCopyNotOwned);
632 void arrayPopFront();
644 std::string toString(Verbosity pnVerbosity = VerbosityMini)
const;
655 std::string toPythonBuffer()
const;
666 bool decodeB64(
const char *pszB64);
677 bool decodeB64Object(
const char *pszB64);
683 void encodeB64(std::string &strOutput)
const;
697 static enum Type deduceType(
const char *szInput,
698 int nLimitToLen = 0x7FFFFFFF);
708 void unSerializeFromText(
const char *szInput,
709 int nLimitToLen = 0x7FFFFFFF);
716 std::string serializeToText(
void)
const;
723 static bool xUnSerializeFromText_InnerTest(
void);
725 template <
typename T0>
726 static ALValue array(
const T0 &a0);
727 template <
typename T0,
typename T1>
728 static ALValue array(
const T0 &a0,
const T1 &a1);
729 template <
typename T0,
typename T1,
typename T2>
730 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2);
731 template <
typename T0,
typename T1,
typename T2,
typename T3>
732 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3);
733 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
734 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4);
735 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
736 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5);
737 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
738 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5,
const T6 &a6);
739 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
740 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);
741 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
742 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);
743 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
744 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);
749 void xAssertCompatibleType(
enum Type pnWantedType);
750 void xAssertType(
enum Type pnWantedType)
const;
751 void xAssertArraySize(
int pnSize)
const;
782 static std::string TypeToString(
enum Type pnType);
786 template <
typename T0>
795 template <
typename T0,
typename T1>
805 template <
typename T0,
typename T1,
typename T2>
816 template <
typename T0,
typename T1,
typename T2,
typename T3>
828 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
841 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
855 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
856 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5,
const T6 &a6)
870 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
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)
886 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
887 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)
903 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
904 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)
931 #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.