11 #ifndef _LIBALVALUE_ALVALUE_ALVALUE_H_
12 #define _LIBALVALUE_ALVALUE_ALVALUE_H_
27 #ifndef ALVALUE_VERBOSITY
28 # define ALVALUE_VERBOSITY
33 typedef enum ALVALUE_API _TVerbosity {
51 friend void ConvertALValueToSoapXml(
const ALValue *pAlValue,
52 std::string &strToFill,
54 friend class ALNetwork;
180 ALValue(
const std::string &value);
191 ALValue(
const std::vector<std::string> &pListString);
196 ALValue(
const std::vector<float> &pListFloat);
201 ALValue(
const std::vector<int> &pListInt);
208 ALValue(
const void *value,
int nBytes);
214 ALValue(
const char **pArrayOfString,
int nNbrString);
220 ALValue(
const float *pFloat,
int nNbrElement);
226 ALValue(
const int *pInt,
int nNbrElement);
232 ALValue(
const TAlValueBinaryData &rhs);
253 ALValue& operator=(
const bool &rhs);
255 ALValue& operator=(
const int &rhs);
257 ALValue& operator=(
const double &rhs);
259 ALValue& operator=(
const float &rhs);
261 ALValue& operator=(
const char *rhs);
263 ALValue& operator=(
const TAlValueBinaryData &rhs);
270 bool operator==(
ALValue const &other)
const;
276 bool operator!=(
ALValue const &other)
const;
293 operator const bool()
const;
309 operator const int()
const;
325 operator const float()
const;
334 operator const double()
const;
343 operator std::string&();
351 operator const std::string&()
const;
360 operator TAlValueBinaryData&();
368 operator const TAlValueBinaryData&()
const;
376 operator const void*()
const;
425 ALValue& setObject(
const void* pData,
int nDataSizeInBytes);
432 void SetBinary(
const void *rhs,
int nDataSizeInBytes);
439 ALValue& SetBinaryNoCopy(
const void *rhs,
int nDataSizeInBytes);
445 const void* GetBinary()
const;
450 const void* getObject()
const;
456 float *getPtrValue();
468 bool bInsertDefaultOnError =
false)
const;
479 bool bInsertDefaultOnError =
false)
const;
490 bool bInsertDefaultOnError =
false)
const;
507 const ALValue& operator[](
int i)
const;
513 enum Type getType()
const;
519 bool isValid ()
const;
524 bool isArray ()
const;
529 bool isBool ()
const;
539 bool isFloat ()
const;
544 bool isString()
const;
549 bool isObject()
const;
554 bool isBinary()
const;
562 unsigned int getSize()
const;
574 void arrayReserve(
int size);
581 void arraySetSize(
int size);
592 void arrayPush(
const ALValue &pSrcToCopyNotOwned);
601 void arrayPopFront();
613 std::string toString(Verbosity pnVerbosity =
VerbosityMini)
const;
624 std::string toPythonBuffer()
const;
635 bool decodeB64(
const char *pszB64);
646 bool decodeB64Object(
const char *pszB64);
652 void encodeB64(std::string &strOutput)
const;
666 static enum Type deduceType(
const char *szInput,
667 int nLimitToLen = 0x7FFFFFFF);
677 void unSerializeFromText(
const char *szInput,
678 int nLimitToLen = 0x7FFFFFFF);
685 std::string serializeToText(
void)
const;
692 static bool xUnSerializeFromText_InnerTest(
void);
694 template <
typename T0>
695 static ALValue array(
const T0 &a0);
696 template <
typename T0,
typename T1>
697 static ALValue array(
const T0 &a0,
const T1 &a1);
698 template <
typename T0,
typename T1,
typename T2>
699 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2);
700 template <
typename T0,
typename T1,
typename T2,
typename T3>
701 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3);
702 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
703 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4);
704 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
705 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5);
706 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
707 static ALValue array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5,
const T6 &a6);
708 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
709 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);
710 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
711 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);
712 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
713 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);
718 void xAssertCompatibleType(
enum Type pnWantedType);
719 void xAssertType(
enum Type pnWantedType)
const;
720 void xAssertArraySize(
int pnSize)
const;
751 static std::string TypeToString(
enum Type pnType);
755 template <
typename T0>
756 ALValue ALValue::array(
const T0 &a0)
764 template <
typename T0,
typename T1>
765 ALValue ALValue::array(
const T0 &a0,
const T1 &a1)
774 template <
typename T0,
typename T1,
typename T2>
775 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2)
778 result.arraySetSize(3);
785 template <
typename T0,
typename T1,
typename T2,
typename T3>
786 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3)
789 result.arraySetSize(4);
797 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4>
798 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4)
801 result.arraySetSize(5);
810 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5>
811 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5)
814 result.arraySetSize(6);
824 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6>
825 ALValue ALValue::array(
const T0 &a0,
const T1 &a1,
const T2 &a2,
const T3 &a3,
const T4 &a4,
const T5 &a5,
const T6 &a6)
828 result.arraySetSize(7);
839 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7>
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,
const T7 &a7)
843 result.arraySetSize(8);
855 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8>
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,
const T7 &a7,
const T8 &a8)
859 result.arraySetSize(9);
872 template <
typename T0,
typename T1,
typename T2,
typename T3,
typename T4,
typename T5,
typename T6,
typename T7,
typename T8,
typename T9>
873 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)
876 result.arraySetSize(10);
898 #endif // _LIBALVALUE_ALVALUE_ALVALUE_H_