All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Layer.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2011 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 Layer.h
22 
23  \brief Auxiliary classes and functions to read layer information from a XML document.
24 */
25 
26 #ifndef __TERRALIB_SERIALIZATION_MAPTOOLS_INTERNAL_LAYER_H
27 #define __TERRALIB_SERIALIZATION_MAPTOOLS_INTERNAL_LAYER_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 
40 namespace te
41 {
42  namespace map { class AbstractLayer; }
43 
44  namespace xml
45  {
46  class Reader;
47  class Writer;
48  }
49 
50  namespace serialize
51  {
53  {
55 
56  public:
57 
58  typedef boost::function<te::map::AbstractLayer* (te::xml::Reader&)> LayerReadFnctType;
59  typedef boost::function<void (const te::map::AbstractLayer*, te::xml::Writer&)> LayerWriteFnctType;
60  typedef std::pair<LayerReadFnctType, LayerWriteFnctType> LayerFnctSerializeType;
61  typedef std::map<std::string, LayerFnctSerializeType> LayerFnctIdxType;
62 
63  void reg(const std::string& layerType, const LayerFnctSerializeType& fncts);
64 
65  te::map::AbstractLayer* read(te::xml::Reader& reader) const;
66 
67  void write(const te::map::AbstractLayer* alayer, te::xml::Writer& writer) const;
68 
69  ~Layer();
70 
71  protected:
72 
73  Layer();
74 
75  private:
76 
78  };
79 
80  } // end namespace serialize
81 } // end namespace te
82 
83 #endif // __TERRALIB_SERIALIZATION_MAPTOOLS_INTERNAL_LAYER_H
84 
Template support for singleton pattern.
Definition: Singleton.h:100
This is the base class for layers.
Definition: AbstractLayer.h:76
This class models a XML reader object.
Definition: Reader.h:55
#define TESERIALIZATIONEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:98
boost::function< te::map::AbstractLayer *(te::xml::Reader &)> LayerReadFnctType
Definition: Layer.h:58
std::pair< LayerReadFnctType, LayerWriteFnctType > LayerFnctSerializeType
Definition: Layer.h:60
LayerFnctIdxType m_fncts
Definition: Layer.h:77
std::map< std::string, LayerFnctSerializeType > LayerFnctIdxType
Definition: Layer.h:61
boost::function< void(const te::map::AbstractLayer *, te::xml::Writer &)> LayerWriteFnctType
Definition: Layer.h:59
This class models a XML writer object.
Definition: Writer.h:52