AbstractData.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/datatype/AbstractData.h
22 
23  \brief A base class for objects that can be retrieved from the data access module.
24 */
25 
26 #ifndef __TERRALIB_DATATYPE_INTERNAL_ABSTRACTDATA_H
27 #define __TERRALIB_DATATYPE_INTERNAL_ABSTRACTDATA_H
28 
29 // TerraLib
30 #include "Config.h"
31 
32 // STL
33 #include <string>
34 
35 // Boost
36 #include <boost/shared_ptr.hpp>
37 
38 namespace te
39 {
40  namespace dt
41  {
42  /*!
43  \class AbstractData
44 
45  \brief A base class for values that can be retrieved from the data access module.
46 
47  This class provides the basic extensibility for data types in the
48  data access module. Through implementing this abstract class you can add
49  new data types to the system and then you can register it in the data source driver.
50 
51  \ingroup datatype
52 
53  \sa DataType, ByteArray, DateTime, SimpleData, CompositeData
54 
55  \todo Add a serialize/deserialize API
56  */
58  {
59  public:
60 
61  /*! \brief Constructor. */
63 
64  /*! \brief Virtual destructor. */
65  virtual ~AbstractData() {}
66 
67  /*!
68  \brief It returns a clone of this object.
69 
70  \return A clone of this object.
71  */
72  virtual AbstractData* clone() const = 0;
73 
74  /*!
75  \brief It returns the data type code associated to the data value.
76 
77  \return The data type code associated to the data value.
78  */
79  virtual int getTypeCode() const = 0;
80 
81  /*!
82  \brief It returns the data value in a string notation.
83 
84  \return The data value in a string notation.
85  */
86  virtual std::string toString() const = 0;
87  };
88 
89  /*!
90  \brief For use with boost conteiners.
91  */
93  {
94  return a.clone();
95  }
96 
97  //Typedef
98  typedef boost::shared_ptr<AbstractData> AbstractDataShrPtr;
99 
100  } // end namespace dt
101 } // end namespace te
102 
103 #endif // __TERRALIB_DATATYPE_INTERNAL_ABSTRACTDATA_H
104 
boost::shared_ptr< AbstractData > AbstractDataShrPtr
Definition: AbstractData.h:98
virtual ~AbstractData()
Virtual destructor.
Definition: AbstractData.h:65
#define TEDATATYPEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Configuration flags for the DataType module of TerraLib.
AbstractData()
Constructor.
Definition: AbstractData.h:62
URI C++ Library.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
virtual AbstractData * clone() const =0
It returns a clone of this object.
AbstractData * new_clone(const AbstractData &a)
For use with boost conteiners.
Definition: AbstractData.h:92