Wolframe, 0.0.3

serializeStack.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 
35 #ifndef _Wolframe_SERIALIZE_STRUCT_SERIALIZE_STACK_HPP_INCLUDED
36 #define _Wolframe_SERIALIZE_STRUCT_SERIALIZE_STACK_HPP_INCLUDED
37 #include "filter/typedfilter.hpp"
38 #include "serialize/mapContext.hpp"
39 #include <vector>
40 #include <cstddef>
41 #include <stdexcept>
42 
43 namespace _Wolframe {
44 namespace serialize {
45 
49 {
50 public:
51  typedef bool (*Fetch)( Context& ctx, std::vector<SerializeState>& stk);
52 
53 public:
55  SerializeState( const SerializeState& o);
56 
58  SerializeState( const char* name_, Fetch p, const void* v);
59 
61  const void* value() const {return m_value;}
63  const char* name() const {return m_name;}
65  Fetch fetch() const {return m_fetch;}
67  std::size_t state() const {return m_stateidx;}
69  void state( std::size_t idx) {m_stateidx = idx;}
70 
71 private:
73  const void* m_value;
74  const char* m_name;
75  std::size_t m_stateidx;
76 };
77 
79 typedef std::vector<SerializeState> SerializeStateStack;
80 
81 }}//namespace
82 #endif
Fetch m_fetch
Definition: serializeStack.hpp:72
void state(std::size_t idx)
Set the internal state of the serialization handled by this state.
Definition: serializeStack.hpp:69
std::size_t state() const
Get the internal state of the serialization handled by this state.
Definition: serializeStack.hpp:67
const void * value() const
Get the base pointer to the value of the object handled by this state.
Definition: serializeStack.hpp:61
SerializeState(const SerializeState &o)
Copy constructor.
Fetch fetch() const
Get the fetch function of the object handled by this state.
Definition: serializeStack.hpp:65
const char * m_name
Definition: serializeStack.hpp:74
const char * name() const
Get the name of the object handled by this state.
Definition: serializeStack.hpp:63
State stack element for an iterator on a structure (serializer)
Definition: serializeStack.hpp:48
Defines the data structure holding the global serialization state variables (without the stack) ...
std::vector< SerializeState > SerializeStateStack
State stack for an iterator on a structure (serializer)
Definition: serializeStack.hpp:79
std::size_t m_stateidx
Definition: serializeStack.hpp:75
Typed interface for input/output filter.
Global state variables of a running serialization/deserialization procedure (without the stack) ...
Definition: mapContext.hpp:46
const void * m_value
Definition: serializeStack.hpp:73
bool(* Fetch)(Context &ctx, std::vector< SerializeState > &stk)
Definition: serializeStack.hpp:51