Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions | Static Public Attributes | List of all members
Teuchos::DirectSerializationTraits< Ordinal, T > Class Template Reference

Serialization traits for objects that support direct serialization. More...

#include <Teuchos_SerializationTraits.hpp>

Inheritance diagram for Teuchos::DirectSerializationTraits< Ordinal, T >:
Inheritance graph
[legend]

Static Public Member Functions

static Ordinal fromCountToDirectBytes (const Ordinal count)
 
static char * convertToCharPtr (T *ptr)
 
static const char * convertToCharPtr (const T *ptr)
 
static Ordinal fromDirectBytesToCount (const Ordinal count)
 
static T * convertFromCharPtr (char *ptr)
 
static const T * convertFromCharPtr (const char *ptr)
 
static Ordinal fromCountToIndirectBytes (const Ordinal count, const T buffer[])
 
static void serialize (const Ordinal count, const T buffer[], const Ordinal bytes, char charBuffer[])
 
static Ordinal fromIndirectBytesToCount (const Ordinal bytes, const char charBuffer[])
 
static void deserialize (const Ordinal bytes, const char charBuffer[], const Ordinal count, T buffer[])
 

Static Public Attributes

static const bool supportsDirectSerialization = true
 

Detailed Description

template<typename Ordinal, typename T>
class Teuchos::DirectSerializationTraits< Ordinal, T >

Serialization traits for objects that support direct serialization.

"Direct" serialization means that you can convert directly between an object of type T and an array of char, of a specific length dependent only on the type T and not on the particular instance. Specifically, it means you can

  1. reinterpret_cast a pointer to an instance of T into an array of char (which array has length dependent only on the type T and not on the specific T instance),
  2. serialize the resulting array of char, and finally
  3. deserialize by reading in the array of char and doing a reinterpret_cast back into a T.

"Indirect" serialization is defined as any serialization method more general than that.

We use partial specializations of DirectSerializationTraits (specialized on certain T types, not Ordinal) as public base classes for the corresponding SerializationTraits specialization. This provides high-performance default implementations of serialization for commonly used types T (including char, int, and double).

Template Parameters
OrdinalThe same template parameter as that of Comm. The integer type used to count the number of packets sent and received.
TThe type of the objects that this class shows how to serialize.

Definition at line 311 of file Teuchos_SerializationTraits.hpp.

Member Function Documentation

template<typename Ordinal, typename T>
static Ordinal Teuchos::DirectSerializationTraits< Ordinal, T >::fromCountToDirectBytes ( const Ordinal  count)
inlinestatic

Definition at line 315 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static char* Teuchos::DirectSerializationTraits< Ordinal, T >::convertToCharPtr ( T *  ptr)
inlinestatic

Definition at line 317 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static const char* Teuchos::DirectSerializationTraits< Ordinal, T >::convertToCharPtr ( const T *  ptr)
inlinestatic

Definition at line 319 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static Ordinal Teuchos::DirectSerializationTraits< Ordinal, T >::fromDirectBytesToCount ( const Ordinal  count)
inlinestatic

Definition at line 321 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static T* Teuchos::DirectSerializationTraits< Ordinal, T >::convertFromCharPtr ( char *  ptr)
inlinestatic

Definition at line 323 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static const T* Teuchos::DirectSerializationTraits< Ordinal, T >::convertFromCharPtr ( const char *  ptr)
inlinestatic

Definition at line 325 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static Ordinal Teuchos::DirectSerializationTraits< Ordinal, T >::fromCountToIndirectBytes ( const Ordinal  count,
const T  buffer[] 
)
inlinestatic

Definition at line 328 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static void Teuchos::DirectSerializationTraits< Ordinal, T >::serialize ( const Ordinal  count,
const T  buffer[],
const Ordinal  bytes,
char  charBuffer[] 
)
inlinestatic

Definition at line 330 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static Ordinal Teuchos::DirectSerializationTraits< Ordinal, T >::fromIndirectBytesToCount ( const Ordinal  bytes,
const char  charBuffer[] 
)
inlinestatic

Definition at line 342 of file Teuchos_SerializationTraits.hpp.

template<typename Ordinal, typename T>
static void Teuchos::DirectSerializationTraits< Ordinal, T >::deserialize ( const Ordinal  bytes,
const char  charBuffer[],
const Ordinal  count,
buffer[] 
)
inlinestatic

Definition at line 345 of file Teuchos_SerializationTraits.hpp.

Member Data Documentation

template<typename Ordinal, typename T>
const bool Teuchos::DirectSerializationTraits< Ordinal, T >::supportsDirectSerialization = true
static

Definition at line 313 of file Teuchos_SerializationTraits.hpp.


The documentation for this class was generated from the following file: