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 FeatureSet;
55 
56  /*!
57  \class AbstractDataHandler
58 
59  \brief This abstract class represents handler to help reading and writing data from/to a dataSource by dividing it into smaller groups
60  */
62  {
63  public:
64  /*! \brief Default constructor. */
66 
67  /*! \brief Virtual destructor. */
68  virtual ~AbstractDataHandler()= default;
69 
70  //!< Initializes the data handler
71  virtual void initialize(const std::vector<te::da::DataAccess*>& vecInputData, const std::vector<te::da::DataAccess*>& vecOutputData, std::size_t maxCoordinates, te::common::TaskProgress* taskProgress);
72 
73  //!< Finalizes the data handler
74  virtual void finalize(te::common::TaskProgress* taskProgress) = 0;
75 
76  //!< Gets the datatype associated with the expected output
77  virtual const te::da::DataSetType* getOutputDataType() const;
78 
79  //!< Returns the number of groups of the data handler
80  virtual std::size_t getGroupCount() const = 0;
81 
82  //!< Returns the number of inputs of the data handler
83  virtual std::size_t getInputCount() const;
84 
85  //!< Returns the number of output of the data handler
86  virtual std::size_t getOutputCount() const;
87 
88  //!< Returns the inputIndex-th featureSet og the groupIndex-th group considering the given filter
89  virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex, const te::gm::Envelope& filter) = 0;
90 
91  //!< Returns the inputIndex-th featureSet og the groupIndex-th group
92  virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex);
93 
94  //!< Adds a featureSet related to groupIndex-th group the to be added to the outputIndex-th output data access
95  virtual void addFeatureSet(std::size_t groupIndex, std::size_t outputIndex, const te::vp::FeatureSet& featureSet) = 0;
96 
97  virtual const std::vector<te::da::DataAccess*>& getInputDataAccessVector() const;
98 
99  virtual const std::vector<te::da::DataAccess*>& getOutputDataAccessVector() const;
100 
101  protected:
102  std::vector<te::da::DataAccess*> m_vecInputData;
103  std::vector<te::da::DataAccess*> m_vecOutputData;
104  };
105 
106  /*!
107  \class DataHandlerFactory
108 
109  \brief Abstract factory used to create Data Handler.
110  */
111  class TEVPEXPORT AbstractDataHandlerFactory : public te::common::AbstractFactory < te::vp::AbstractDataHandler, std::string >
112  {
113  protected:
114 
115  /*!
116  \brief Constructor.
117 
118  \param factoryKey The key that identifies the factory.
119  */
120  AbstractDataHandlerFactory(const std::string& factoryKey);
121 
122  //!< Destructor
123  virtual ~AbstractDataHandlerFactory();
124  };
125  }
126 }
127 
128 #endif //__TERRALIB_VP_INTERNAL_ABSTRACTDATAHANDLER_H
This class defines the interface of abstract factories without initializing parameters.
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
A class that models the description of a dataset.
Definition: DataSetType.h:72
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
This abstract class represents handler to help reading and writing data from/to a dataSource by divid...
An alias for a set of Features.
Definition: Feature.h:60
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
TerraLib.
std::vector< te::da::DataAccess * > m_vecOutputData
Configuration flags for the Terrralib Vector Processing module.
std::vector< te::da::DataAccess * > m_vecInputData