Wolframe, 0.0.3

structSerializer.hpp
Go to the documentation of this file.
1 /************************************************************************
2 Copyright (C) 2011 - 2014 Project Wolframe.
3 All rights reserved.
4 
5 This file is part of Project Wolframe.
6 
7 Commercial Usage
8 Licensees holding valid Project Wolframe Commercial licenses may
9 use this file in accordance with the Project Wolframe
10 Commercial License Agreement provided with the Software or,
11 alternatively, in accordance with the terms contained
12 in a written agreement between the licensee and Project Wolframe.
13 
14 GNU General Public License Usage
15 Alternatively, you can redistribute this file and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19 
20 Wolframe is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24 
25 You should have received a copy of the GNU General Public License
26 along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
27 
28 If you have questions regarding the use of this file, please contact
29 Project Wolframe.
30 
31 ************************************************************************/
34 #ifndef _Wolframe_SERIALIZE_STRUCT_SERIALIZER_HPP_INCLUDED
35 #define _Wolframe_SERIALIZE_STRUCT_SERIALIZER_HPP_INCLUDED
37 
38 namespace _Wolframe {
39 namespace serialize {
40 
44 {
45 public:
46  typedef boost::shared_ptr<void> ObjectReference;
47 
49  StructSerializer( const ObjectReference& obj, const StructDescriptionBase* descr);
51  StructSerializer( const void* obj, const StructDescriptionBase* descr);
52 
56  virtual ~StructSerializer(){}
57 
59  static std::string getElementPath( const SerializeStateStack& stk);
60 
63  void reset();
64 
68  bool call();
69 
72  virtual langbind::TypedInputFilter* copy() const;
73 
77 
80  virtual bool setFlags( FilterBase::Flags f);
81 
82 private:
83  const void* m_ptr;
89 };
90 
91 }}//namespace
92 #endif
93 
const ObjectReference m_obj
Definition: structSerializer.hpp:84
const void * m_ptr
Definition: structSerializer.hpp:83
Flags flags() const
Get all flags.
Definition: filterbase.hpp:120
Base class for structure description used for introspection in serialization/deserialization.
Definition: structDescriptionBase.hpp:51
virtual bool setFlags(FilterBase::Flags f)
Set the flags stearing the serialization, implements FilterBase::setFlags(FilterBase::Flags) ...
static std::string getElementPath(const SerializeStateStack &stk)
Get the current element path defined by the stack 'stk' as string for error messages.
const StructDescriptionBase * m_descr
Definition: structSerializer.hpp:85
StructSerializer(const ObjectReference &obj, const StructDescriptionBase *descr)
Constructor.
virtual ~StructSerializer()
Destructor.
Definition: structSerializer.hpp:56
Variant value type that represents a variant copy without content ownership.
Definition: variant.hpp:286
void init(const langbind::TypedOutputFilterR &out, serialize::Flags::Enum flags=serialize::Flags::None)
Serialize start initialization.
SerializeStateStack m_stk
Definition: structSerializer.hpp:88
ElementType
Content element type that describes the role of the element in the structured input.
Definition: filterbase.hpp:66
virtual langbind::TypedInputFilter * copy() const
Get a self copy.
bool call()
Call of one processing step the serializer.
boost::shared_ptr< TypedOutputFilter > TypedOutputFilterR
Shared output filter (langbind::TypedOutputFilter) reference.
Definition: typedfilter.hpp:149
Enum
the enumeration that can also be interpreted as bit set
Definition: flags.hpp:47
std::vector< SerializeState > SerializeStateStack
State stack for an iterator on a structure (serializer)
Definition: serializeStack.hpp:79
Context m_ctx
Definition: structSerializer.hpp:86
Iterator on elements of structures based on a structure description.
Definition: structSerializer.hpp:43
langbind::TypedOutputFilterR m_out
Definition: structSerializer.hpp:87
virtual bool getNext(langbind::FilterBase::ElementType &type, types::VariantConst &value)
Get the next element of the serialization, implements langbind::TypedInputFilter::getNext(langbind::F...
Defines the non intrusive base class of serialization/deserialization of objects interfaced as TypedI...
Empty flag set (no flags set)
Definition: flags.hpp:49
Global state variables of a running serialization/deserialization procedure (without the stack) ...
Definition: mapContext.hpp:46
Input filter with atomic values having a type.
Definition: typedfilter.hpp:48
boost::shared_ptr< void > ObjectReference
Definition: structSerializer.hpp:46