AbstractDataHandler.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 terralin/vp/AbstractDataHandler.h
22 
23  \brief This abstract class represents handler to help reading and writing data from/to a dataSource by dividing it into smaller groups
24  */
25 
26 #ifndef __TERRALIB_VP_INTERNAL_ABSTRACTDATAHANDLER_H
27 #define __TERRALIB_VP_INTERNAL_ABSTRACTDATAHANDLER_H
28 
29 #include "../common/AbstractFactory.h"
30 #include "Config.h"
31 
32 
33 #include <vector>
34 
35 namespace te
36 {
37  namespace common
38  {
39  class TaskProgress;
40  }
41  namespace da
42  {
43  class DataAccess;
44  class DataSetType;
45  }
46 
47  namespace gm
48  {
49  class Envelope;
50  }
51 
52  namespace vp
53  {
54  class AbstractParameters;
55  class FeatureSet;
56 
57  /*!
58  \class AbstractDataHandler
59 
60  \brief This abstract class represents handler to help reading and writing data from/to a dataSource by dividing it into smaller groups
61  */
63  {
64  public:
65  /*! \brief Default constructor. */
67 
68  /*! \brief Virtual destructor. */
69  virtual ~AbstractDataHandler()= default;
70 
71  //!< Initializes the data handler
72  virtual void initialize(te::vp::AbstractParameters* absParams, te::common::TaskProgress* taskProgress);
73 
74  //!< Finalizes the data handler
75  virtual void finalize(te::common::TaskProgress* taskProgress);
76 
77  //!< Gets the datatype associated with the expected output
78  virtual const te::da::DataSetType* getOutputDataType() const;
79 
80  //!< Returns the number of groups of the data handler
81  virtual std::size_t getGroupCount() const = 0;
82 
83  //!< Returns the number of inputs of the data handler
84  virtual std::size_t getInputCount() const;
85 
86  //!< Returns the number of output of the data handler
87  virtual std::size_t getOutputCount() const;
88 
89  //!< Returns the inputIndex-th featureSet og the groupIndex-th group considering the given filter
90  virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex, const te::gm::Envelope& filter) = 0;
91 
92  //!< Returns the inputIndex-th featureSet og the groupIndex-th group
93  virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex);
94 
95  //!< Adds a featureSet related to groupIndex-th group the to be added to the outputIndex-th output data access
96  virtual void addFeatureSet(std::size_t groupIndex, std::size_t outputIndex, const te::vp::FeatureSet& featureSet) = 0;
97 
98  virtual const std::vector<te::da::DataAccess*>& getInputDataAccessVector() const;
99 
100  virtual const std::vector<te::da::DataAccess*>& getOutputDataAccessVector() const;
101 
102  protected:
103  std::vector<te::da::DataAccess*> m_vecInputData;
104  std::vector<te::da::DataAccess*> m_vecOutputData;
105  std::size_t m_maxCoordinates;
106  };
107 
108  /*!
109  \class DataHandlerFactory
110 
111  \brief Abstract factory used to create Data Handler.
112  */
113  class TEVPEXPORT AbstractDataHandlerFactory : public te::common::AbstractFactory < te::vp::AbstractDataHandler, std::string >
114  {
115  protected:
116 
117  /*!
118  \brief Constructor.
119 
120  \param factoryKey The key that identifies the factory.
121  */
122  AbstractDataHandlerFactory(const std::string& factoryKey);
123 
124  //!< Destructor
126  };
127  }
128 }
129 
130 #endif //__TERRALIB_VP_INTERNAL_ABSTRACTDATAHANDLER_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::common::AbstractFactory
This class defines the interface of abstract factories without initializing parameters.
Definition: AbstractFactory.h:70
te::vp::AbstractDataHandler::getOutputDataType
virtual const te::da::DataSetType * getOutputDataType() const
Returns the number of groups of the data handler.
te::vp::AbstractParameters
Abstract class used to define the input/ ouptut parameters for TerraAmazon Operations.
Definition: AbstractOperation.h:66
te::vp::AbstractDataHandler::m_maxCoordinates
std::size_t m_maxCoordinates
Definition: AbstractDataHandler.h:105
te::vp::AbstractDataHandler::getFeatureSet
virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex, const te::gm::Envelope &filter)=0
Returns the inputIndex-th featureSet og the groupIndex-th group.
te::vp::AbstractDataHandler::addFeatureSet
virtual void addFeatureSet(std::size_t groupIndex, std::size_t outputIndex, const te::vp::FeatureSet &featureSet)=0
te::vp::AbstractDataHandler::m_vecOutputData
std::vector< te::da::DataAccess * > m_vecOutputData
Definition: AbstractDataHandler.h:104
te::vp::AbstractDataHandlerFactory::~AbstractDataHandlerFactory
virtual ~AbstractDataHandlerFactory()
te::vp::AbstractDataHandler::initialize
virtual void initialize(te::vp::AbstractParameters *absParams, te::common::TaskProgress *taskProgress)
Finalizes the data handler.
TEVPEXPORT
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
te::vp::AbstractDataHandler::getFeatureSet
virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex)
Adds a featureSet related to groupIndex-th group the to be added to the outputIndex-th output data ac...
te::vp::AbstractDataHandler::AbstractDataHandler
AbstractDataHandler()
Default constructor.
te::vp::AbstractDataHandler::getOutputCount
virtual std::size_t getOutputCount() const
Returns the inputIndex-th featureSet og the groupIndex-th group considering the given filter.
te::vp::AbstractDataHandler::getInputCount
virtual std::size_t getInputCount() const
Returns the number of output of the data handler.
te::vp::AbstractDataHandler::~AbstractDataHandler
virtual ~AbstractDataHandler()=default
Virtual destructor.
te::vp::AbstractDataHandlerFactory::AbstractDataHandlerFactory
AbstractDataHandlerFactory(const std::string &factoryKey)
Constructor.
te::vp::AbstractDataHandler::m_vecInputData
std::vector< te::da::DataAccess * > m_vecInputData
Definition: AbstractDataHandler.h:103
te::vp::AbstractDataHandler::getInputDataAccessVector
virtual const std::vector< te::da::DataAccess * > & getInputDataAccessVector() const
te::vp::AbstractDataHandler
This abstract class represents handler to help reading and writing data from/to a dataSource by divid...
Definition: AbstractDataHandler.h:63
te::vp::FeatureSet
An alias for a set of Features.
Definition: Feature.h:60
te::common::TaskProgress
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:54
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::vp::AbstractDataHandler::getOutputDataAccessVector
virtual const std::vector< te::da::DataAccess * > & getOutputDataAccessVector() const
te::da::DataSetType
A class that models the description of a dataset.
Definition: DataSetType.h:73
te::vp::AbstractDataHandler::finalize
virtual void finalize(te::common::TaskProgress *taskProgress)
Gets the datatype associated with the expected output.
te::vp::AbstractDataHandler::getGroupCount
virtual std::size_t getGroupCount() const =0
Returns the number of inputs of the data handler.
te::vp::AbstractDataHandlerFactory
Definition: AbstractDataHandler.h:114