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