Loading...
Searching...
No Matches
AbstractOp.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/fe/serialization/xml/AbstractOp.h
22
23 \brief Auxiliary classes and functions to serialize filter operations from a XML document.
24*/
25
26#ifndef __TERRALIB_FE_SERIALIZATION_XML_INTERNAL_ABSTRACTOP_H
27#define __TERRALIB_FE_SERIALIZATION_XML_INTERNAL_ABSTRACTOP_H
28
29// TerraLib
30#include "../../../common/Singleton.h"
31#include "../../Config.h"
32
33// STL
34#include <map>
35#include <string>
36
37// Boost
38#include <boost/function.hpp>
39
40namespace te
41{
42 namespace xml
43 {
44 class AbstractWriter;
45 class Reader;
46 }
47
48 namespace fe
49 {
50 class AbstractOp;
51
52 namespace serialize
53 {
54 class TEFEEXPORT AbstractOp : public te::common::Singleton<AbstractOp>
55 {
57
58 public:
59
60 typedef boost::function<te::fe::AbstractOp* (const char* opName, te::xml::Reader&)> AbstractOpReadFnctType;
61 typedef boost::function<void (const te::fe::AbstractOp*, te::xml::AbstractWriter&)> AbstractOpWriteFnctType;
62 typedef std::pair<AbstractOpReadFnctType, AbstractOpWriteFnctType> AbstractOpFnctSerializeType;
63 typedef std::map<std::string, AbstractOpFnctSerializeType> AbstractOpFnctIdxType;
64
65 void reg(const std::string& opName, const AbstractOpFnctSerializeType& fncts);
66
68
69 void write(const te::fe::AbstractOp* op, te::xml::AbstractWriter& writer) const;
70
72
73 protected:
74
76
77 private:
78
80 std::map<std::string, const char*> m_names; //!< Auxiliary map of string to te::fe::Global names pointers.
81 };
82 } // end namespace serialize
83 } // end namespace fe
84} // end namespace te
85
86#endif // __TERRALIB_FE_SERIALIZATION_XML_INTERNAL_ABSTRACTOP_H
A class that models a XML writer object built on top of Xerces-C++.
Template support for singleton pattern.
Definition: Singleton.h:101
An abstract interface for operators.
Definition: AbstractOp.h:48
te::fe::AbstractOp * read(te::xml::Reader &reader) const
std::pair< AbstractOpReadFnctType, AbstractOpWriteFnctType > AbstractOpFnctSerializeType
Definition: AbstractOp.h:62
std::map< std::string, const char * > m_names
Auxiliary map of string to te::fe::Global names pointers.
Definition: AbstractOp.h:80
boost::function< void(const te::fe::AbstractOp *, te::xml::AbstractWriter &)> AbstractOpWriteFnctType
Definition: AbstractOp.h:61
void reg(const std::string &opName, const AbstractOpFnctSerializeType &fncts)
void write(const te::fe::AbstractOp *op, te::xml::AbstractWriter &writer) const
AbstractOpFnctIdxType m_fncts
Definition: AbstractOp.h:79
std::map< std::string, AbstractOpFnctSerializeType > AbstractOpFnctIdxType
Definition: AbstractOp.h:63
boost::function< te::fe::AbstractOp *(const char *opName, te::xml::Reader &)> AbstractOpReadFnctType
Definition: AbstractOp.h:60
This class models a XML writer object.
This class models a XML reader object.
Definition: Reader.h:56
TerraLib.
#define TEFEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:59