10 #ifndef TEUCHOS_SERIALIZATION_TRAITS_HELPERS_HPP
11 #define TEUCHOS_SERIALIZATION_TRAITS_HELPERS_HPP
14 #include "Teuchos_ArrayView.hpp"
37 template <
typename Ordinal,
typename T>
62 template <
typename Ordinal,
typename T,
typename Serializer,
63 bool direct = Serializer::supportsDirectSerialization>
73 template <
typename Ordinal,
typename T,
typename Serializer,
74 bool direct = Serializer::supportsDirectSerialization>
85 template <
typename Ordinal,
typename T,
typename Serializer,
86 bool direct = Serializer::supportsDirectSerialization>
97 template <
typename Ordinal,
typename T,
typename Serializer,
98 bool direct = Serializer::supportsDirectSerialization>
106 template <
typename Ordinal,
typename T,
typename Serializer>
111 const Ordinal count, T buffer[],
119 char* getCharBuffer()
const;
121 Ordinal getBytes()
const;
141 template <
typename Ordinal,
typename T,
typename Serializer>
146 const Ordinal count,
const T buffer[],
154 const char* getCharBuffer()
const;
156 Ordinal getBytes()
const;
163 const char *charBuffer_;
177 template <
typename Ordinal,
typename T,
typename Serializer>
182 const Ordinal bytes,
char charBuffer[],
190 T* getBuffer()
const;
192 Ordinal getCount()
const;
211 template <
typename Ordinal,
typename T,
typename Serializer>
216 const Ordinal bytes,
const char charBuffer[],
224 const T* getBuffer()
const;
226 Ordinal getCount()
const;
229 const char *charBuffer_;
244 template <
typename Ordinal,
typename T,
typename Serializer>
249 const Ordinal count, T buffer[],
257 char* getCharBuffer()
const;
259 Ordinal getBytes()
const;
279 template <
typename Ordinal,
typename T,
typename Serializer>
284 const Ordinal count,
const T buffer[],
292 const char* getCharBuffer()
const;
294 Ordinal getBytes()
const;
315 template <
typename Ordinal,
typename T,
typename Serializer>
320 const Ordinal bytes,
char charBuffer[],
328 T* getBuffer()
const;
330 Ordinal getCount()
const;
349 template <
typename Ordinal,
typename T,
typename Serializer>
354 const Ordinal bytes,
const char charBuffer[],
362 const T* getBuffer()
const;
364 Ordinal getCount()
const;
367 const char *charBuffer_;
381 template <
typename Ordinal,
typename T,
389 const Ordinal count, T buffer[],
391 ) :
Base(count,buffer,serializer) {}
397 template <
typename Ordinal,
typename T,
398 typename Serializer =
typename DefaultSerializer<Ordinal,T>::DefaultSerializerType>
405 const Ordinal count,
const T buffer[],
407 ) :
Base(count,buffer,serializer) {}
414 template <
typename Ordinal,
typename T,
415 typename Serializer =
typename DefaultSerializer<Ordinal,T>::DefaultSerializerType>
422 const Ordinal bytes,
char charBuffer[],
424 ) :
Base(bytes,charBuffer,serializer) {}
431 template <
typename Ordinal,
typename T,
432 typename Serializer =
typename DefaultSerializer<Ordinal,T>::DefaultSerializerType>
439 const Ordinal bytes,
const char charBuffer[],
441 ) :
Base(bytes,charBuffer,serializer) {}
450 template <
typename Ordinal,
typename T>
459 const Ordinal count, T buffer[],
461 ) :
Base(count,buffer,serializer) {}
470 template <
typename Ordinal,
typename T>
479 const Ordinal count,
const T buffer[],
481 ) :
Base(count,buffer,serializer) {}
491 template <
typename Ordinal,
typename T>
500 const Ordinal bytes,
char charBuffer[],
502 ) :
Base(bytes,charBuffer,serializer) {}
512 template <
typename Ordinal,
typename T>
521 const Ordinal bytes,
const char charBuffer[],
523 ) :
Base(bytes,charBuffer,serializer) {}
533 template <
typename Ordinal,
typename T,
typename Serializer>
534 ValueTypeSerializationBufferImp<Ordinal,T,Serializer,true>::
535 ValueTypeSerializationBufferImp(
538 :count_(count), buffer_(buffer), serializer_(serializer)
540 bytes_ = serializer_->fromCountToDirectBytes(count_);
541 charBuffer_ = serializer_->convertToCharPtr(buffer_);
544 template <
typename Ordinal,
typename T,
typename Serializer>
551 template <
typename Ordinal,
typename T,
typename Serializer>
558 template <
typename Ordinal,
typename T,
typename Serializer>
566 template <
typename Ordinal,
typename T,
typename Serializer>
571 return arrayView(charBuffer_, bytes_);
579 template <
typename Ordinal,
typename T,
typename Serializer>
584 :count_(count), buffer_(buffer), serializer_(serializer)
586 bytes_ = serializer_->fromCountToDirectBytes(count_);
587 charBuffer_ = serializer_->convertToCharPtr(buffer_);
590 template <
typename Ordinal,
typename T,
typename Serializer>
597 template <
typename Ordinal,
typename T,
typename Serializer>
604 template <
typename Ordinal,
typename T,
typename Serializer>
611 template <
typename Ordinal,
typename T,
typename Serializer>
616 return arrayView(charBuffer_, bytes_);
623 template <
typename Ordinal,
typename T,
typename Serializer>
628 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
630 count_ = serializer_->fromDirectBytesToCount(bytes_);
631 buffer_ = serializer_->convertFromCharPtr(charBuffer_);
634 template <
typename Ordinal,
typename T,
typename Serializer>
641 template <
typename Ordinal,
typename T,
typename Serializer>
648 template <
typename Ordinal,
typename T,
typename Serializer>
659 template <
typename Ordinal,
typename T,
typename Serializer>
664 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
666 count_ = serializer_->fromDirectBytesToCount(bytes_);
667 buffer_ = serializer_->convertFromCharPtr(charBuffer_);
670 template <
typename Ordinal,
typename T,
typename Serializer>
677 template <
typename Ordinal,
typename T,
typename Serializer>
684 template <
typename Ordinal,
typename T,
typename Serializer>
699 template <
typename Ordinal,
typename T,
typename Serializer>
704 :count_(count), buffer_(buffer), serializer_(serializer)
706 bytes_ = serializer_->fromCountToIndirectBytes(count_, buffer_);
707 charBuffer_.resize(bytes_);
708 serializer_->serialize(count_, buffer_, bytes_, &charBuffer_[0]);
711 template <
typename Ordinal,
typename T,
typename Serializer>
715 serializer_->deserialize(bytes_, &charBuffer_[0], count_, buffer_);
718 template <
typename Ordinal,
typename T,
typename Serializer>
722 return &charBuffer_[0];
725 template <
typename Ordinal,
typename T,
typename Serializer>
732 template <
typename Ordinal,
typename T,
typename Serializer>
737 return charBuffer_.view(0, bytes_);
745 template <
typename Ordinal,
typename T,
typename Serializer>
750 :count_(count), buffer_(buffer), serializer_(serializer)
752 bytes_ = serializer_->fromCountToIndirectBytes(count_, buffer_);
753 charBuffer_.resize(bytes_);
754 serializer_->serialize(count_, buffer_, bytes_, &charBuffer_[0]);
757 template <
typename Ordinal,
typename T,
typename Serializer>
763 template <
typename Ordinal,
typename T,
typename Serializer>
767 return &charBuffer_[0];
770 template <
typename Ordinal,
typename T,
typename Serializer>
777 template <
typename Ordinal,
typename T,
typename Serializer>
782 return charBuffer_.view(0, bytes_);
789 template <
typename Ordinal,
typename T,
typename Serializer>
794 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
796 count_ = serializer_->fromIndirectBytesToCount(bytes_, charBuffer_);
797 buffer_.resize(count_);
798 serializer_->deserialize(bytes_, charBuffer_, count_, &buffer_[0]);
801 template <
typename Ordinal,
typename T,
typename Serializer>
805 serializer_->serialize(count_, &buffer_[0], bytes_, charBuffer_);
808 template <
typename Ordinal,
typename T,
typename Serializer>
815 template <
typename Ordinal,
typename T,
typename Serializer>
826 template <
typename Ordinal,
typename T,
typename Serializer>
831 :bytes_(bytes), charBuffer_(charBuffer), serializer_(serializer)
833 count_ = serializer_->fromIndirectBytesToCount(bytes_, charBuffer_);
834 buffer_.resize(count_);
835 serializer_->deserialize(bytes_, charBuffer_, count_, &buffer_[0]);
838 template <
typename Ordinal,
typename T,
typename Serializer>
844 template <
typename Ordinal,
typename T,
typename Serializer>
851 template <
typename Ordinal,
typename T,
typename Serializer>
860 #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...