1 | #ifndef __XMLIO_CLinearBuffer__ |
---|
2 | #define __XMLIO_CLinearBuffer__ |
---|
3 | |
---|
4 | /// xmlioserver headers /// |
---|
5 | #include "xmlioserver_spl.hpp" |
---|
6 | #include "buffer.hpp" |
---|
7 | |
---|
8 | #define _NULL_ARG xmlioserver::comm::CLinearBuffer::NULL_ARG |
---|
9 | |
---|
10 | namespace xmlioserver |
---|
11 | { |
---|
12 | namespace comm |
---|
13 | { |
---|
14 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
15 | class CLinearBuffer |
---|
16 | : public CBuffer |
---|
17 | { |
---|
18 | /// Définition de type /// |
---|
19 | typedef CBuffer SuperClass; |
---|
20 | |
---|
21 | public /* static */ : |
---|
22 | |
---|
23 | static long int * NULL_ARG; |
---|
24 | friend class CMPIManager; |
---|
25 | |
---|
26 | public : |
---|
27 | |
---|
28 | /// Construteurs /// |
---|
29 | |
---|
30 | explicit CLinearBuffer(StdSize size = BUFFER_CLIENT_SIZE); |
---|
31 | CLinearBuffer(char * data, StdSize size); |
---|
32 | CLinearBuffer(const CLinearBuffer & lbuffer); |
---|
33 | CLinearBuffer(const CLinearBuffer * const lbuffer); |
---|
34 | |
---|
35 | /// Accesseurs /// |
---|
36 | StdSize getUsedSize(void) const; |
---|
37 | StdSize getUnusedSize(void) const; |
---|
38 | |
---|
39 | StdSize getNumberOfStoredData(void) const; |
---|
40 | std::vector<StdSize> getPositionsOfStoredData(void) const; |
---|
41 | std::vector<StdSize> getSizesOfStoredData(void) const; |
---|
42 | std::vector<std::pair<CBufferDataType, bool> > getTypesOfStoredData(void) const; |
---|
43 | |
---|
44 | //-------------------------------------------------------------- |
---|
45 | char getChar (StdSize position) const; |
---|
46 | bool getBool (StdSize position) const; |
---|
47 | float getFloat (StdSize position) const; |
---|
48 | double getDouble(StdSize position) const; |
---|
49 | long int getInt (StdSize position) const; |
---|
50 | |
---|
51 | StdString getString(StdSize position) const; |
---|
52 | |
---|
53 | ARRAY(char, 1) getCharArray (StdSize position) const; |
---|
54 | ARRAY(bool, 1) getBoolArray (StdSize position) const; |
---|
55 | ARRAY(float, 1) getFloatArray (StdSize position) const; |
---|
56 | ARRAY(double, 1) getDoubleArray(StdSize position) const; |
---|
57 | ARRAY(long int, 1) getIntArray (StdSize position) const; |
---|
58 | |
---|
59 | //-------------------------------------------------------------- |
---|
60 | |
---|
61 | void getRequestInfos(StdSize position, |
---|
62 | long int & managerId, long int & methodId, long int & nbargs); |
---|
63 | |
---|
64 | //-------------------------------------------------------------- |
---|
65 | /// Mutateurs /// |
---|
66 | void appendChar (char value) ; |
---|
67 | void appendBool (bool value) ; |
---|
68 | void appendFloat (float value) ; |
---|
69 | void appendDouble(double value) ; |
---|
70 | void appendInt (long int value) ; |
---|
71 | |
---|
72 | void appendString(const StdString & value) ; |
---|
73 | |
---|
74 | void appendCharArray (ARRAY(char, 1) value) ; |
---|
75 | void appendBoolArray (ARRAY(bool, 1) value) ; |
---|
76 | void appendFloatArray (ARRAY(float, 1) value) ; |
---|
77 | void appendDoubleArray(ARRAY(double, 1) value) ; |
---|
78 | void appendIntArray (ARRAY(long int, 1) value) ; |
---|
79 | |
---|
80 | //-------------------------------------------------------------- |
---|
81 | |
---|
82 | void appendRequestInfos(const long int & managerId, |
---|
83 | const long int & methodId, |
---|
84 | const long int & nbargs); |
---|
85 | |
---|
86 | //-------------------------------------------------------------- |
---|
87 | virtual void clear(void); |
---|
88 | |
---|
89 | /// Test /// |
---|
90 | template <typename A1, typename A2, typename A3, typename A4> |
---|
91 | inline StdSize getRequestedSize(A1 * arg1 = NULL_ARG, |
---|
92 | A2 * arg2 = NULL_ARG, |
---|
93 | A3 * arg3 = NULL_ARG, |
---|
94 | A4 * arg4 = NULL_ARG) const; |
---|
95 | |
---|
96 | /// Sortie fichier ascii /// |
---|
97 | virtual void printToTextFile (const StdString & filename); |
---|
98 | virtual void printToTextStream (StdOStream & ostr); |
---|
99 | |
---|
100 | /// Destructeur /// |
---|
101 | virtual ~CLinearBuffer(void); |
---|
102 | |
---|
103 | protected : |
---|
104 | |
---|
105 | /// Accesseurs protégés /// |
---|
106 | template <class T> |
---|
107 | inline void getLData(T & data, StdSize position) const; |
---|
108 | template <class T> |
---|
109 | inline void getLDataArray(ARRAY(T, 1) data, StdSize position) const; |
---|
110 | |
---|
111 | /// Mutateurs protégés /// |
---|
112 | template <class T> |
---|
113 | inline void appendLData(const T & data); |
---|
114 | template <class T> |
---|
115 | inline void appendLDataArray(ARRAY(T, 1) data); |
---|
116 | |
---|
117 | private : |
---|
118 | |
---|
119 | /// Traitement /// |
---|
120 | void computeBufferData(void); |
---|
121 | |
---|
122 | /// Propriétés privées /// |
---|
123 | std::vector<StdSize> bdata; |
---|
124 | StdSize p_write; |
---|
125 | |
---|
126 | }; // class CLinearBuffer |
---|
127 | |
---|
128 | ///---------------------------------------------------------------- |
---|
129 | |
---|
130 | } // namespace comm |
---|
131 | } // namespace xmlioserver |
---|
132 | |
---|
133 | #endif // __XMLIO_CLinearBuffer__ |
---|