Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Serializer.h
1 /*
2  * Serializer class interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2006, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef ELM_SERIAL2_SERIALIZER_H
22 #define ELM_SERIAL2_SERIALIZER_H
23 
24 namespace elm {
25 
26 namespace rtti {
27  class Type;
28 };
29 
30 namespace serial2 {
31 
32 /*class AbstractType;
33 class AbstractEnum;*/
34 
35 // Serializer class
36 class Serializer {
37 public:
38  virtual ~Serializer(void) { }
39  virtual void flush(void) = 0;
40 
41  // Complex type serializers
42  virtual void beginObject(const rtti::Type& clazz, const void *object) = 0;
43  virtual void endObject(const rtti::Type& clazz, const void *object) = 0;
44  virtual void beginField(CString name) = 0;
45  virtual void endField(void) = 0;
46  virtual void onPointer(const rtti::Type& clazz, const void *object) = 0;
47  virtual void beginCompound(const void *object) = 0;
48  virtual void onItem(void) = 0;
49  virtual void endCompound(const void*) = 0;
50  virtual void onEnum(const void *address, int value, const rtti::Type& clazz) = 0;
51 
52  // Base value serializers
53  virtual void onValue(const bool& v) = 0;
54  virtual void onValue(const signed int& v) = 0;
55  virtual void onValue(const unsigned int& v) = 0;
56  virtual void onValue(const signed char& v) = 0;
57  virtual void onValue(const unsigned char& v) = 0;
58  virtual void onValue(const signed short& v) = 0;
59  virtual void onValue(const unsigned short& v) = 0;
60  virtual void onValue(const signed long& v) = 0;
61  virtual void onValue(const unsigned long& v) = 0;
62  virtual void onValue(const signed long long& v) = 0;
63  virtual void onValue(const unsigned long long& v) = 0;
64  virtual void onValue(const float& v) = 0;
65  virtual void onValue(const double& v) = 0;
66  virtual void onValue(const long double& v) = 0;
67  virtual void onValue(const CString& v) = 0;
68  virtual void onValue(const String& v) = 0;
69 };
70 
71 } } // elm::serial2
72 
73 #endif // ELM_SERIAL2_SERIALIZER_H
Definition: CString.h:17
Definition: String.h:30
Definition: Type.h:83
Definition: Serializer.h:36
virtual void beginObject(const rtti::Type &clazz, const void *object)=0
virtual void onItem(void)=0
virtual void beginField(CString name)=0
virtual void onValue(const unsigned long &v)=0
virtual void onValue(const signed long long &v)=0
virtual void onValue(const long double &v)=0
virtual void endObject(const rtti::Type &clazz, const void *object)=0
virtual void flush(void)=0
virtual void onValue(const bool &v)=0
virtual void onValue(const unsigned short &v)=0
virtual void endField(void)=0
virtual ~Serializer(void)
Definition: Serializer.h:38
virtual void endCompound(const void *)=0
virtual void onValue(const signed long &v)=0
virtual void beginCompound(const void *object)=0
virtual void onValue(const unsigned int &v)=0
virtual void onValue(const CString &v)=0
virtual void onValue(const unsigned long long &v)=0
virtual void onValue(const double &v)=0
virtual void onValue(const float &v)=0
virtual void onValue(const signed char &v)=0
virtual void onEnum(const void *address, int value, const rtti::Type &clazz)=0
virtual void onValue(const signed int &v)=0
virtual void onValue(const String &v)=0
virtual void onValue(const unsigned char &v)=0
virtual void onValue(const signed short &v)=0
virtual void onPointer(const rtti::Type &clazz, const void *object)=0
Definition: adapter.h:26