42 #ifndef TEUCHOS_SERIALIZATION_TRAITS_HELPERS_HPP
43 #define TEUCHOS_SERIALIZATION_TRAITS_HELPERS_HPP
46 #include "Teuchos_ArrayView.hpp"
69 template <
typename Ordinal,
typename T>
94 template <
typename Ordinal,
typename T,
typename Serializer,
95 bool direct = Serializer::supportsDirectSerialization>
105 template <
typename Ordinal,
typename T,
typename Serializer,
106 bool direct = Serializer::supportsDirectSerialization>
117 template <
typename Ordinal,
typename T,
typename Serializer,
118 bool direct = Serializer::supportsDirectSerialization>
129 template <
typename Ordinal,
typename T,
typename Serializer,
130 bool direct = Serializer::supportsDirectSerialization>
138 template <
typename Ordinal,
typename T,
typename Serializer>
143 const Ordinal count, T buffer[],
151 char* getCharBuffer()
const;
153 Ordinal getBytes()
const;
173 template <
typename Ordinal,
typename T,
typename Serializer>
178 const Ordinal count,
const T buffer[],
186 const char* getCharBuffer()
const;
188 Ordinal getBytes()
const;
195 const char *charBuffer_;
209 template <
typename Ordinal,
typename T,
typename Serializer>
214 const Ordinal bytes,
char charBuffer[],
222 T* getBuffer()
const;
224 Ordinal getCount()
const;
243 template <
typename Ordinal,
typename T,
typename Serializer>
248 const Ordinal bytes,
const char charBuffer[],
256 const T* getBuffer()
const;
258 Ordinal getCount()
const;
261 const char *charBuffer_;
276 template <
typename Ordinal,
typename T,
typename Serializer>
281 const Ordinal count, T buffer[],
289 char* getCharBuffer()
const;
291 Ordinal getBytes()
const;
311 template <
typename Ordinal,
typename T,
typename Serializer>
316 const Ordinal count,
const T buffer[],
324 const char* getCharBuffer()
const;
326 Ordinal getBytes()
const;
347 template <
typename Ordinal,
typename T,
typename Serializer>
352 const Ordinal bytes,
char charBuffer[],
360 T* getBuffer()
const;
362 Ordinal getCount()
const;
381 template <
typename Ordinal,
typename T,
typename Serializer>
386 const Ordinal bytes,
const char charBuffer[],
394 const T* getBuffer()
const;
396 Ordinal getCount()
const;
399 const char *charBuffer_;
413 template <
typename Ordinal,
typename T,
421 const Ordinal count, T buffer[],
423 ) :
Base(count,buffer,serializer) {}
429 template <
typename Ordinal,
typename T,
430 typename Serializer =
typename DefaultSerializer<Ordinal,T>::DefaultSerializerType>
437 const Ordinal count,
const T buffer[],
439 ) :
Base(count,buffer,serializer) {}
446 template <
typename Ordinal,
typename T,
447 typename Serializer =
typename DefaultSerializer<Ordinal,T>::DefaultSerializerType>
454 const Ordinal bytes,
char charBuffer[],
456 ) :
Base(bytes,charBuffer,serializer) {}
463 template <
typename Ordinal,
typename T,
464 typename Serializer =
typename DefaultSerializer<Ordinal,T>::DefaultSerializerType>
471 const Ordinal bytes,
const char charBuffer[],
473 ) :
Base(bytes,charBuffer,serializer) {}
482 template <
typename Ordinal,
typename T>
491 const Ordinal count, T buffer[],
493 ) :
Base(count,buffer,serializer) {}
502 template <
typename Ordinal,
typename T>
511 const Ordinal count,
const T buffer[],
513 ) :
Base(count,buffer,serializer) {}
523 template <
typename Ordinal,
typename T>
532 const Ordinal bytes,
char charBuffer[],
534 ) :
Base(bytes,charBuffer,serializer) {}
544 template <
typename Ordinal,
typename T>
553 const Ordinal bytes,
const char charBuffer[],
555 ) :
Base(bytes,charBuffer,serializer) {}
565 template <
typename Ordinal,
typename T,
typename Serializer>
566 ValueTypeSerializationBufferImp<Ordinal,T,Serializer,true>::
567 ValueTypeSerializationBufferImp(
570 :count_(count), buffer_(buffer), serializer_(serializer)
572 bytes_ = serializer_->fromCountToDirectBytes(count_);
573 charBuffer_ = serializer_->convertToCharPtr(buffer_);
576 template <
typename Ordinal,
typename T,
typename Serializer>
583 template <
typename Ordinal,
typename T,
typename Serializer>
590 template <
typename Ordinal,
typename T,
typename Serializer>
598 template <
typename Ordinal,
typename T,
typename Serializer>
603 return arrayView(charBuffer_, bytes_);
611 template <
typename Ordinal,
typename T,
typename Serializer>
616 :count_(count), buffer_(buffer), serializer_(serializer)
618 bytes_ = serializer_->fromCountToDirectBytes(count_);
619 charBuffer_ = serializer_->convertToCharPtr(buffer_);
622 template <
typename Ordinal,
typename T,
typename Serializer>
629 template <
typename Ordinal,
typename T,
typename Serializer>
636 template <
typename Ordinal,
typename T,
typename Serializer>
643 template <
typename Ordinal,
typename T,
typename Serializer>
648 return arrayView(charBuffer_, bytes_);
655 template <
typename Ordinal,
typename T,
typename Serializer>
660 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
662 count_ = serializer_->fromDirectBytesToCount(bytes_);
663 buffer_ = serializer_->convertFromCharPtr(charBuffer_);
666 template <
typename Ordinal,
typename T,
typename Serializer>
673 template <
typename Ordinal,
typename T,
typename Serializer>
680 template <
typename Ordinal,
typename T,
typename Serializer>
691 template <
typename Ordinal,
typename T,
typename Serializer>
696 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
698 count_ = serializer_->fromDirectBytesToCount(bytes_);
699 buffer_ = serializer_->convertFromCharPtr(charBuffer_);
702 template <
typename Ordinal,
typename T,
typename Serializer>
709 template <
typename Ordinal,
typename T,
typename Serializer>
716 template <
typename Ordinal,
typename T,
typename Serializer>
731 template <
typename Ordinal,
typename T,
typename Serializer>
736 :count_(count), buffer_(buffer), serializer_(serializer)
738 bytes_ = serializer_->fromCountToIndirectBytes(count_, buffer_);
739 charBuffer_.resize(bytes_);
740 serializer_->serialize(count_, buffer_, bytes_, &charBuffer_[0]);
743 template <
typename Ordinal,
typename T,
typename Serializer>
747 serializer_->deserialize(bytes_, &charBuffer_[0], count_, buffer_);
750 template <
typename Ordinal,
typename T,
typename Serializer>
754 return &charBuffer_[0];
757 template <
typename Ordinal,
typename T,
typename Serializer>
764 template <
typename Ordinal,
typename T,
typename Serializer>
769 return charBuffer_.view(0, bytes_);
777 template <
typename Ordinal,
typename T,
typename Serializer>
782 :count_(count), buffer_(buffer), serializer_(serializer)
784 bytes_ = serializer_->fromCountToIndirectBytes(count_, buffer_);
785 charBuffer_.resize(bytes_);
786 serializer_->serialize(count_, buffer_, bytes_, &charBuffer_[0]);
789 template <
typename Ordinal,
typename T,
typename Serializer>
795 template <
typename Ordinal,
typename T,
typename Serializer>
799 return &charBuffer_[0];
802 template <
typename Ordinal,
typename T,
typename Serializer>
809 template <
typename Ordinal,
typename T,
typename Serializer>
814 return charBuffer_.view(0, bytes_);
821 template <
typename Ordinal,
typename T,
typename Serializer>
826 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
828 count_ = serializer_->fromIndirectBytesToCount(bytes_, charBuffer_);
829 buffer_.resize(count_);
830 serializer_->deserialize(bytes_, charBuffer_, count_, &buffer_[0]);
833 template <
typename Ordinal,
typename T,
typename Serializer>
837 serializer_->serialize(count_, &buffer_[0], bytes_, charBuffer_);
840 template <
typename Ordinal,
typename T,
typename Serializer>
847 template <
typename Ordinal,
typename T,
typename Serializer>
858 template <
typename Ordinal,
typename T,
typename Serializer>
863 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
865 count_ = serializer_->fromIndirectBytesToCount(bytes_, charBuffer_);
866 buffer_.resize(count_);
867 serializer_->deserialize(bytes_, charBuffer_, count_, &buffer_[0]);
870 template <
typename Ordinal,
typename T,
typename Serializer>
876 template <
typename Ordinal,
typename T,
typename Serializer>
883 template <
typename Ordinal,
typename T,
typename Serializer>
892 #endif // TEUCHOS_SERIALIZATION_TRAITS_HELPERS_HPP
A class for instantiating a default serialization object.
Strategy interface for the indirect serializing and deserializing objects of a given type handled usi...
ConstValueTypeSerializationBuffer(const Ordinal count, const T buffer[], const RCP< const Serializer > &serializer)
Serialize to an internally stored char[] buffer.
ValueTypeSerializationBuffer(const Ordinal count, T buffer[], const RCP< const Serializer > &serializer=DS::getDefaultSerializerRCP())
Serialize to an internally stored char[] buffer.
SerializationTraits< Ordinal, T > DefaultSerializerType
Typename of default serializer.
ValueTypeDeserializationBuffer(const Ordinal bytes, char charBuffer[], const RCP< const Serializer > &serializer)
Serialize to an internally stored char[] buffer.
ValueTypeSerializationBuffer(const Ordinal count, T buffer[], const RCP< const Serializer > &serializer)
Serialize to an internally stored char[] buffer.
Encapsulate how an array of non-const serialized objects with value sematics stored in a char[] array...
static DefaultSerializerType getDefaultSerializer()
Return an instance of the default serializer.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
ValueTypeDeserializationBuffer(const Ordinal bytes, char charBuffer[], const RCP< const Serializer > &serializer=DS::getDefaultSerializerRCP())
Serialize to an internally stored char[] buffer.
Encapsulate how an array of non-const serialized objects with value sematics stored in a char[] array...
Encapsulate how an array of non-const objects with value sematics is serialized into a char[] array...
ConstValueTypeDeserializationBuffer(const Ordinal bytes, const char charBuffer[], const RCP< const Serializer > &serializer=DS::getDefaultSerializerRCP())
Serialize to an internally stored char[] buffer.
Templated array class derived from the STL std::vector.
Serialization traits class for types T that use value semantics.
ConstValueTypeDeserializationBuffer(const Ordinal bytes, const char charBuffer[], const RCP< const Serializer > &serializer)
Serialize to an internally stored char[] buffer.
ConstValueTypeSerializationBuffer(const Ordinal count, const T buffer[], const RCP< const Serializer > &serializer=DS::getDefaultSerializerRCP())
Serialize to an internally stored char[] buffer.
static Teuchos::RCP< DefaultSerializerType > getDefaultSerializerRCP()
Return an RCP of an instance of the default serializer.
Teuchos::SerializationTraits and Teuchos::DirectSerializationTraits definitions.
Encapsulate how an array of const objects with value sematics is serialized into a const char[] array...
Smart reference counting pointer class for automatic garbage collection.
Encapsulate how an array of non-const serialized objects with value sematics stored in a char[] array...
Encapsulate how an array of non-const serialized objects with value sematics stored in a char[] array...
Encapsulate how an array of non-const objects with value sematics is serialized into a char[] array...
Encapsulate how an array of const objects with value sematics is serialized into a const char[] array...