Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_Serializer.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_SERIALIZER_HPP
11 #define TEUCHOS_SERIALIZER_HPP
12 
13 #include "Teuchos_RCP.hpp"
14 
15 namespace Teuchos {
16 
24 template<typename Ordinal, typename T>
25 class Serializer {
26 public:
27 
29  virtual ~Serializer() {}
30 
34  virtual Ordinal getBufferSize(const Ordinal count) const = 0;
35 
54  virtual void serialize(
55  const Ordinal count
56  ,const T * const objs[]
57  ,const Ordinal bytes
58  ,char charBuffer[]
59  ) const = 0;
60 
61  // const ArrayView<const Ptr<const T> >& objs
62  // std::ostream& oStream
63 
66  virtual RCP<T> createObj() const = 0;
67 
86  virtual void deserialize(
87  const Ordinal bytes
88  ,const char charBuffer[]
89  ,const Ordinal count
90  ,T * const objs[]
91  ) const = 0;
92 
93  // const ArrayView<const Ptr<T> >& objs
94  // std::istream& iStream
95 
96 };
97 
98 } // namespace Teuchos
99 
100 #endif // TEUCHOS_SERIALIZER_HPP
Strategy interface for the indirect serializing and deserializing objects of a given type handled usi...
virtual void deserialize(const Ordinal bytes, const char charBuffer[], const Ordinal count, T *const objs[]) const =0
Deserialize an object from a char[] buffer.
virtual Ordinal getBufferSize(const Ordinal count) const =0
Return an estimate for the maximum storage for count objects to be serialized.
virtual void serialize(const Ordinal count, const T *const objs[], const Ordinal bytes, char charBuffer[]) const =0
Serialize an object to a char[] buffer.
Smart reference counting pointer class for automatic garbage collection.
virtual RCP< T > createObj() const =0
Create an object of type T to be serialized into.
Reference-counted pointer class and non-member templated function implementations.