42 #ifndef TEUCHOS_SERIALIZER_HELPERS_HPP
43 #define TEUCHOS_SERIALIZER_HELPERS_HPP
45 #include "Teuchos_Serializer.hpp"
53 template <
typename Ordinal,
typename T>
59 ,
const Ordinal count, T*
const buffer[]
83 template <
typename Ordinal,
typename T>
89 ,
const Ordinal count,
const T*
const buffer[]
102 const T*
const *buffer_;
115 template <
typename Ordinal,
typename T>
121 ,
const Ordinal bytes,
char charBuffer[]
149 template <
typename Ordinal,
typename T>
155 ,
const Ordinal bytes,
const char charBuffer[]
170 const char *charBuffer_;
186 template <
typename Ordinal,
typename T>
189 ,
const Ordinal count, T*
const buffer[]
191 :serializer_(serializer), count_(count), buffer_(buffer)
193 const Ordinal bytes = serializer_.getBufferSize(count_);
194 charBuffer_.
resize(bytes);
195 serializer_.serialize(count_,buffer_,bytes,&charBuffer_[0]);
198 template <
typename Ordinal,
typename T>
201 serializer_.deserialize(charBuffer_.size(),&charBuffer_[0],count_,buffer_);
204 template <
typename Ordinal,
typename T>
208 return &(
const_cast<this_ptr_t
>(
this)->charBuffer_)[0];
213 template <
typename Ordinal,
typename T>
216 return charBuffer_.size();
223 template <
typename Ordinal,
typename T>
226 ,
const Ordinal count,
const T*
const buffer[]
228 serializer_(serializer),
233 const Ordinal bytes = serializer_.getBufferSize(count_);
234 charBuffer_.
resize(bytes);
235 serializer_.serialize(count_,buffer_,bytes,&charBuffer_[0]);
238 template <
typename Ordinal,
typename T>
244 template <
typename Ordinal,
typename T>
247 return &charBuffer_[0];
250 template <
typename Ordinal,
typename T>
253 return charBuffer_.size();
260 template <
typename Ordinal,
typename T>
263 ,
const Ordinal bytes,
char charBuffer[]
265 :serializer_(serializer),bytes_(bytes),charBuffer_(charBuffer)
267 const Ordinal extent = serializer_.getBufferSize(1);
268 const Ordinal count = bytes_ / extent;
272 buffer_ptr_.
resize(count);
274 for(
int i = 0; i < count; ++i ) {
275 buffer_ptr_[i] = serializer_.createObj();
276 buffer_[i] = &*buffer_ptr_[i];
278 serializer_.deserialize(
279 bytes_,charBuffer_,count,&buffer_[0]
283 template <
typename Ordinal,
typename T>
286 serializer_.serialize(
287 buffer_.size(),&buffer_[0],bytes_,charBuffer_
291 template <
typename Ordinal,
typename T>
295 return &(
const_cast<this_ptr_t
>(
this)->buffer_)[0];
300 template <
typename Ordinal,
typename T>
303 return buffer_.size();
310 template <
typename Ordinal,
typename T>
313 ,
const Ordinal bytes,
const char charBuffer[]
315 :serializer_(serializer),bytes_(bytes),charBuffer_(charBuffer)
317 const Ordinal extent = serializer_.getBufferSize(1);
318 const Ordinal count = bytes_ / extent;
322 buffer_ptr_.
resize(count);
324 for(
int i = 0; i < count; ++i ) {
325 buffer_ptr_[i] = serializer_.createObj();
326 buffer_[i] = &*buffer_ptr_[i];
328 serializer_.deserialize(
329 bytes_,charBuffer_,count,&buffer_[0]
333 template <
typename Ordinal,
typename T>
339 template <
typename Ordinal,
typename T>
345 template <
typename Ordinal,
typename T>
348 return buffer_.size();
353 #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.