10 #ifndef TEUCHOS_SERIALIZER_HELPERS_HPP
11 #define TEUCHOS_SERIALIZER_HELPERS_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[]
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[]
154 template <
typename Ordinal,
typename T>
157 ,
const Ordinal count, T*
const buffer[]
159 :serializer_(serializer), count_(count), buffer_(buffer)
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),
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;
242 for(
int i = 0; i < count; ++i ) {
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;
292 for(
int i = 0; i < count; ++i ) {
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...
const Serializer< Ordinal, T > & serializer_
Array< RCP< T > > buffer_ptr_t
Encapsulate how an array of non-const objects with reference sematics is deserialized from a char[] a...
ConstReferenceTypeSerializationBuffer()
Encapsulate how an array of non-const objects with reference sematics is serialized into a char[] arr...
Array< char > charBuffer_
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
ReferenceTypeSerializationBuffer & operator=(const ReferenceTypeSerializationBuffer &)
ReferenceTypeSerializationBuffer()
~ReferenceTypeDeserializationBuffer()
Reserialize back to the char[] buffer from the internal T*[] buffer.
ConstReferenceTypeDeserializationBuffer & operator=(const ConstReferenceTypeDeserializationBuffer &)
Encapsulate how an array of const objects with reference sematics is serialized into a char[] array...
ReferenceTypeDeserializationBuffer()
~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
Array< RCP< T > > buffer_ptr_t
ConstReferenceTypeSerializationBuffer & operator=(const ConstReferenceTypeSerializationBuffer &)
Templated array class derived from the STL std::vector.
ReferenceTypeDeserializationBuffer & operator=(const ReferenceTypeDeserializationBuffer &)
Array< char > charBuffer_
T *const * getBuffer() const
const Serializer< Ordinal, T > & serializer_
const Serializer< Ordinal, T > & serializer_
const Serializer< Ordinal, T > & serializer_
#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.
ConstReferenceTypeDeserializationBuffer()