10#ifndef TEUCHOS_SERIALIZER_HELPERS_HPP 
   11#define TEUCHOS_SERIALIZER_HELPERS_HPP 
   13#include "Teuchos_Serializer.hpp" 
   21template <
typename Ordinal, 
typename T>
 
   27    ,
const Ordinal count, 
T*
const buffer[]
 
 
   51template <
typename Ordinal, 
typename T>
 
   57    ,
const Ordinal count, 
const T*
const buffer[]
 
   70  const T*
const                *buffer_;
 
 
   83template <
typename Ordinal, 
typename T>
 
  117template <
typename Ordinal, 
typename T>
 
  138  const char                   *charBuffer_;
 
 
  154template <
typename Ordinal, 
typename T>
 
  157  ,
const Ordinal count, 
T*
const buffer[]
 
  161  const Ordinal 
bytes = serializer_.getBufferSize(count_);
 
  163  serializer_.serialize(count_,buffer_,
bytes,&charBuffer_[0]);
 
 
  166template <
typename Ordinal, 
typename T>
 
  169  serializer_.deserialize(charBuffer_.size(),&charBuffer_[0],count_,buffer_);
 
 
  172template <
typename Ordinal, 
typename T>
 
  176  return &(
const_cast<this_ptr_t>(
this)->charBuffer_)[0];
 
 
  181template <
typename Ordinal, 
typename T>
 
  184  return charBuffer_.size();
 
 
  191template <
typename Ordinal, 
typename T>
 
  194  ,
const Ordinal count, 
const T*
const buffer[]
 
  201  const Ordinal 
bytes = serializer_.getBufferSize(count_);
 
  203  serializer_.serialize(count_,buffer_,
bytes,&charBuffer_[0]);
 
 
  206template <
typename Ordinal, 
typename T>
 
  212template <
typename Ordinal, 
typename T>
 
  215  return &charBuffer_[0];
 
 
  218template <
typename Ordinal, 
typename T>
 
  221  return charBuffer_.size();
 
 
  228template <
typename Ordinal, 
typename T>
 
  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]
 
 
  251template <
typename Ordinal, 
typename T>
 
  254  serializer_.serialize(
 
  255    buffer_.size(),&buffer_[0],bytes_,charBuffer_
 
 
  259template <
typename Ordinal, 
typename T>
 
  263  return &(
const_cast<this_ptr_t>(
this)->buffer_)[0];
 
 
  268template <
typename Ordinal, 
typename T>
 
  271  return buffer_.size();
 
 
  278template <
typename Ordinal, 
typename T>
 
  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]
 
 
  301template <
typename Ordinal, 
typename T>
 
  307template <
typename Ordinal, 
typename T>
 
  313template <
typename Ordinal, 
typename T>
 
  316  return buffer_.size();
 
 
Templated array class derived from the STL std::vector.
 
void resize(size_type new_size, const value_type &x=value_type())
 
Encapsulate how an array of onst objects with reference sematics is deserialized from a char[] array ...
 
const T *const * getBuffer() const
 
~ConstReferenceTypeDeserializationBuffer()
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.
 
const char * getCharBuffer() const
 
~ConstReferenceTypeSerializationBuffer()
Free the internal char[] buffer (no data to be written back).
 
Smart reference counting pointer class for automatic garbage collection.
 
Encapsulate how an array of non-const objects with reference sematics is deserialized from a char[] a...
 
T *const * getBuffer() const
 
~ReferenceTypeDeserializationBuffer()
Reserialize back to the char[] buffer from the internal T*[] buffer.
 
Encapsulate how an array of non-const objects with reference sematics is serialized into a char[] arr...
 
~ReferenceTypeSerializationBuffer()
Deserialize from the interal char[] buffer back to the original T*[] buffer.
 
char * getCharBuffer() 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.
 
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...