Changeset 6922 for source/ariba/utility/serialization
- Timestamp:
- Nov 13, 2009, 8:05:41 PM (15 years ago)
- Location:
- source/ariba/utility/serialization
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/serialization/Data.hpp
r6786 r6922 44 44 #include <iostream> 45 45 #include <boost/cstdint.hpp> 46 #include <boost/type_traits/make_unsigned.hpp> 46 47 47 48 // forward declaration … … 119 120 template<typename X> 120 121 finline void get(X& value, size_t length = sizeof(X) * 8, if_int(X)) const { 121 _unsigned(value) = bitget<X> (bits.buffer(), index, length); 122 typedef typename boost::make_unsigned<X>::type unsigned_type; 123 _unsigned(value) = bitget<unsigned_type> (bits.buffer(), index, length); 122 124 } 123 125 -
source/ariba/utility/serialization/DataStream.hpp
r6921 r6922 543 543 544 544 sznMethodBegin(X) 545 for (size_t i=0; i<l; i++) X && v[i];545 for (size_t i=0; i<l; i++) X && v[i]; 546 546 sznMethodEnd() 547 547 }; -
source/ariba/utility/serialization/TestSerialization.cpp
r3690 r6922 37 37 // [License] 38 38 39 #include "TestSerialization.h" 39 40 #include "Data.hpp" 40 41 #include "DataStream.hpp" … … 54 55 Aclass* vclass; 55 56 bool vcls; 57 uint8_t* static_array; 56 58 57 59 Aclass(bool vcls = false) { 58 60 text = new char[80]; 61 static_array = new uint8_t[20]; 62 for (size_t i=0; i<20; i++) static_array[i] = i; 59 63 strcpy(text, "Hallo!"); 60 64 str = "std::string:)"; … … 94 98 95 99 sznBeginDefault( Aclass, X ){ 100 double xpos; 96 101 X && x && b && I(y,6) && T(text) && T(str) && A(v,4) && I(z) && vcls; 102 X && static_A(static_array,20); 103 X && static_A( (uint8_t*)&xpos, 8 ); 97 104 if (vcls) X && VO(vclass); 98 105 }sznEnd() … … 100 107 vsznDefault( Aclass ); 101 108 102 int main() {109 int test_serialization() { 103 110 using namespace std; 104 111
Note:
See TracChangeset
for help on using the changeset viewer.