10 #ifndef TEUCHOS_SERIALIZER_HELPERS_HPP
11 #define TEUCHOS_SERIALIZER_HELPERS_HPP
13 #include "Teuchos_Serializer.hpp"
21 template <
typename Ordinal,
typename T>
27 ,
const Ordinal count, T*
const buffer[]
51 template <
typename Ordinal,
typename T>
57 ,
const Ordinal count,
const T*
const buffer[]
70 const T*
const *buffer_;
83 template <
typename Ordinal,
typename T>
89 ,
const Ordinal bytes,
char charBuffer[]
117 template <
typename Ordinal,
typename T>
123 ,
const Ordinal bytes,
const char charBuffer[]
138 const char *charBuffer_;
154 template <
typename Ordinal,
typename T>
157 ,
const Ordinal count, T*
const buffer[]
159 :serializer_(serializer), count_(count), buffer_(buffer)
161 const Ordinal bytes = serializer_.getBufferSize(count_);
162 charBuffer_.
resize(bytes);
163 serializer_.serialize(count_,buffer_,bytes,&charBuffer_[0]);
166 template <
typename Ordinal,
typename T>
169 serializer_.deserialize(charBuffer_.size(),&charBuffer_[0],count_,buffer_);
172 template <
typename Ordinal,
typename T>
176 return &(
const_cast<this_ptr_t
>(
this)->charBuffer_)[0];
181 template <
typename Ordinal,
typename T>
184 return charBuffer_.size();
191 template <
typename Ordinal,
typename T>
194 ,
const Ordinal count,
const T*
const buffer[]
196 serializer_(serializer),
201 const Ordinal bytes = serializer_.getBufferSize(count_);
202 charBuffer_.
resize(bytes);
203 serializer_.serialize(count_,buffer_,bytes,&charBuffer_[0]);
206 template <
typename Ordinal,
typename T>
212 template <
typename Ordinal,
typename T>
215 return &charBuffer_[0];
218 template <
typename Ordinal,
typename T>
221 return charBuffer_.size();
228 template <
typename Ordinal,
typename T>
231 ,
const Ordinal bytes,
char charBuffer[]
233 :serializer_(serializer),bytes_(bytes),charBuffer_(charBuffer)
235 const Ordinal extent = serializer_.getBufferSize(1);
236 const Ordinal count = bytes_ / extent;
240 buffer_ptr_.
resize(count);
242 for(
int i = 0; i < count; ++i ) {
243 buffer_ptr_[i] = serializer_.createObj();
244 buffer_[i] = &*buffer_ptr_[i];
246 serializer_.deserialize(
247 bytes_,charBuffer_,count,&buffer_[0]
251 template <
typename Ordinal,
typename T>
254 serializer_.serialize(
255 buffer_.size(),&buffer_[0],bytes_,charBuffer_
259 template <
typename Ordinal,
typename T>
263 return &(
const_cast<this_ptr_t
>(
this)->buffer_)[0];
268 template <
typename Ordinal,
typename T>
271 return buffer_.size();
278 template <
typename Ordinal,
typename T>
281 ,
const Ordinal bytes,
const char charBuffer[]
283 :serializer_(serializer),bytes_(bytes),charBuffer_(charBuffer)
285 const Ordinal extent = serializer_.getBufferSize(1);
286 const Ordinal count = bytes_ / extent;
290 buffer_ptr_.
resize(count);
292 for(
int i = 0; i < count; ++i ) {
293 buffer_ptr_[i] = serializer_.createObj();
294 buffer_[i] = &*buffer_ptr_[i];
296 serializer_.deserialize(
297 bytes_,charBuffer_,count,&buffer_[0]
301 template <
typename Ordinal,
typename T>
307 template <
typename Ordinal,
typename T>
313 template <
typename Ordinal,
typename T>
316 return buffer_.size();
321 #endif // TEUCHOS_SERIALIZER_HELPERS_HPP
Strategy interface for the indirect serializing and deserializing objects of a given type handled usi...
Encapsulate how an array of non-const objects with reference sematics is deserialized from a char[] a...
Encapsulate how an array of non-const objects with reference sematics is serialized into a char[] arr...
Encapsulate how an array of onst objects with reference sematics is deserialized from a char[] array ...
const char * getCharBuffer() const
const T *const * getBuffer() const
~ReferenceTypeDeserializationBuffer()
Reserialize back to the char[] buffer from the internal T*[] buffer.
Encapsulate how an array of const objects with reference sematics is serialized into a char[] array...
~ConstReferenceTypeDeserializationBuffer()
Reserialize back to the char[] buffer from the internal T*[] buffer.
~ConstReferenceTypeSerializationBuffer()
Free the internal char[] buffer (no data to be written back).
void resize(size_type new_size, const value_type &x=value_type())
char * getCharBuffer() const
Templated array class derived from the STL std::vector.
T *const * getBuffer() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call...
~ReferenceTypeSerializationBuffer()
Deserialize from the interal char[] buffer back to the original T*[] buffer.