13 #ifndef TEUCHOS_SERIALIZATION_TRAITS_HPP
14 #define TEUCHOS_SERIALIZATION_TRAITS_HPP
20 #ifdef HAVE_TEUCHOSCORE_QUADMATH
22 #endif // HAVE_TEUCHOSCORE_QUADMATH
24 #ifdef HAVE_TEUCHOS_QD
25 #include <qd/dd_real.h>
26 #include <qd/qd_real.h>
40 static inline T
notDefined() {
return(T::this_type_is_missing_a_specialization());}
97 template <
typename Ordinal,
typename T>
165 (void)count; (void)buffer;
190 (void)count; (void)buffer; (void)bytes; (void)charBuffer;
196 const char charBuffer[]) {
197 (void)bytes; (void)charBuffer;
218 const char charBuffer[],
222 (void)bytes; (void)charBuffer; (void)count; (void)buffer;
243 template <
typename Ordinal,
typename T>
278 template <
typename Ordinal,
typename T>
284 {
return sizeof(T)*count; }
286 {
return reinterpret_cast<char*
>(ptr); }
288 {
return reinterpret_cast<const char*
>(ptr); }
290 {
return count/
sizeof(T); }
292 {
return reinterpret_cast<T*
>(ptr); }
294 {
return reinterpret_cast<const T*
>(ptr); }
299 const Ordinal count,
const T buffer[],
const Ordinal bytes,
char charBuffer[]
308 std::copy(_buffer,_buffer+bytes,charBuffer);
311 const char charBuffer[])
314 const Ordinal bytes,
const char charBuffer[],
const Ordinal count, T buffer[]
321 std::copy(charBuffer,charBuffer+bytes,_buffer);
330 template<
typename Ordinal>
335 template<
typename Ordinal>
340 template<
typename Ordinal>
345 template<
typename Ordinal>
350 template<
typename Ordinal>
355 template<
typename Ordinal>
360 template<
typename Ordinal>
365 template<
typename Ordinal>
370 template<
typename Ordinal>
375 template<
typename Ordinal>
380 template<
typename Ordinal>
385 #ifdef HAVE_TEUCHOS_LONG_DOUBLE
386 template<
typename Ordinal>
394 template<
typename Ordinal,
typename P1,
typename P2>
399 #ifdef HAVE_TEUCHOSCORE_QUADMATH
400 template<
typename Ordinal>
404 #endif // HAVE_TEUCHOSCORE_QUADMATH
406 #ifdef HAVE_TEUCHOS_QD
407 template<
typename Ordinal>
408 class SerializationTraits<Ordinal,dd_real>
409 :
public DirectSerializationTraits<Ordinal,dd_real>
412 template<
typename Ordinal>
413 class SerializationTraits<Ordinal,qd_real>
414 :
public DirectSerializationTraits<Ordinal,qd_real>
418 #ifdef HAVE_TEUCHOS_COMPLEX
420 template<
typename Ordinal>
421 class SerializationTraits<Ordinal,std::complex<float> >
422 :
public DirectSerializationTraits<Ordinal,std::complex<float> >
425 template<
typename Ordinal>
426 class SerializationTraits<Ordinal,std::complex<double> >
427 :
public DirectSerializationTraits<Ordinal,std::complex<double> >
430 #endif // HAVE_TEUCHOS_COMPLEX
437 template<
typename Ordinal>
447 template<
typename Ordinal>
454 #endif // TEUCHOS_SERIALIZATION_TRAITS_HPP
Serialization traits for objects that support direct serialization.
static char * convertToCharPtr(T *ptr)
Convert the pointer type to char*.
static void serialize(const Ordinal count, const T buffer[], const Ordinal bytes, char charBuffer[])
static Ordinal fromCountToIndirectBytes(const Ordinal count, const T buffer[])
static const char * convertToCharPtr(const T *ptr)
Convert the pointer type to const char*.
static Ordinal fromCountToDirectBytes(const Ordinal count)
static T notDefined()
This function should not compile if there is an attempt to instantiate!
static void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, T buffer[])
static Ordinal fromCountToIndirectBytes(const Ordinal count, const T buffer[])
Return the number of bytes for count objects.
static const bool supportsDirectSerialization
Whether the type T supports direct serialization.
Teuchos header file which uses auto-configuration information to include necessary C++ headers...
static void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, T buffer[])
Deserialize from an indirect char[] buffer.
Serialization class for types T that use value semantics.
static Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[])
Return the number of objects for bytes of storage.
static T * convertFromCharPtr(char *ptr)
static T * convertFromCharPtr(char *ptr)
Convert the pointer type from char*.
static char * convertToCharPtr(T *ptr)
static const T * convertFromCharPtr(const char *ptr)
Convert the pointer type from char*.
static const char * convertToCharPtr(const T *ptr)
static const T * convertFromCharPtr(const char *ptr)
static Ordinal fromIndirectBytesToCount(const Ordinal bytes, const char charBuffer[])
Report an error if a specialization of SerializationTraits is missing.
Serialization traits class for types T that use value semantics.
Standard test and throw macros.
static Ordinal fromDirectBytesToCount(const Ordinal count)
static const bool supportsDirectSerialization
static Ordinal fromDirectBytesToCount(const Ordinal bytes)
Return the number of objects for bytes of storage.
static void serialize(const Ordinal count, const T buffer[], const Ordinal bytes, char charBuffer[])
Serialize to an indirect char[] buffer.
#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...
static Ordinal fromCountToDirectBytes(const Ordinal count)
Return the number of bytes for count objects.