ReaderFactory.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/xml/ReaderFactory.h
22 
23  \brief This is the abstract factory for XML readers.
24 */
25 
26 #ifndef __TERRALIB_XML_INTERNAL_READERFACTORY_H
27 #define __TERRALIB_XML_INTERNAL_READERFACTORY_H
28 
29 // TerraLib
30 #include "../common/AbstractFactory.h"
31 #include "Reader.h"
32 
33 namespace te
34 {
35  namespace xml
36  {
37 
38  /*!
39  \class ReaderFactory
40 
41  \brief This is the abstract factory for XML readers.
42 
43  This is an abstract factory, so you will need to call the static method make
44  as follow:
45 
46  \code
47  Reader* reader = ReaderFactory::make("XERCES");
48  \endcode
49 
50  or
51 
52  \code
53  // for a default reader
54  Reader* reader = ReaderFactory::make();
55  \endcode
56 
57  \ingroup xml
58 
59  \sa Reader
60  */
61  class TEXMLEXPORT ReaderFactory : public te::common::AbstractFactory<te::xml::Reader, std::string>
62  {
63  public:
64 
65  /*!
66  \brief It creates a new XML reader using the dafault implementation.
67 
68  \return A new XML reader using the dafault implementation.
69  */
70  static te::xml::Reader* make();
71 
72  /*!
73  \brief It creates a new XML reader.
74 
75  \param readerType The type of XML reader to be created.
76 
77  \return A new XML reader.
78  */
79  static te::xml::Reader* make(const std::string& readerType);
80 
81  /*!
82  \brief It sets the default driver used to create the XML reader objects.
83 
84  \param readerType The default driver name for creating XML reader objects.
85  */
86  static void setDefaultReader(const std::string& readerType);
87 
88  /*!
89  \brief Virtual destructor.
90 
91  \note It will automatically unregister the factory from the dictionary.
92  */
93  virtual ~ReaderFactory() {}
94 
95  protected:
96 
97  /*!
98  \brief It creates the factory.
99 
100  The key of a ReaderFactory is a string.
101 
102  \param factoryKey The key that identifies the factory.
103  */
104  ReaderFactory(const std::string& factoryKey);
105 
106  private:
107 
108  static std::string sm_defaultReaderType; //!< The type of the reader to be created if no type is informed.
109  };
110 
111  } // end namespace xml
112 } // end namespace te
113 
114 #endif // __TERRALIB_XML_INTERNAL_READERFACTORY_H
115 
This class defines the interface of abstract factories without initializing parameters.
This class models a XML reader object.
Definition: Reader.h:55
This class models a XML reader object.
virtual ~ReaderFactory()
Virtual destructor.
Definition: ReaderFactory.h:93
This is the abstract factory for XML readers.
Definition: ReaderFactory.h:61
URI C++ Library.
#define TEXMLEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:88
static std::string sm_defaultReaderType
The type of the reader to be created if no type is informed.