GroupThreadManager.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 GroupThreadManager.h
22 
23  \brief Class to manager group values in threads.
24 
25  \ingroup vp
26  */
27 
28 #ifndef __TERRALIB_VP_INTERNAL_GROUP_THREAD_MANAGER_H
29 #define __TERRALIB_VP_INTERNAL_GROUP_THREAD_MANAGER_H
30 
31 #include "Config.h"
32 
33 // STL
34 #include <map>
35 #include <vector>
36 
37 // Boost
38 #include <boost/thread/mutex.hpp>
39 
40 namespace te
41 {
42  namespace common
43  {
44  class TaskProgress;
45  }
46 
47  namespace da
48  {
49  class DataSet;
50  class DataSetType;
51  class DataSource;
52  }
53 
54  namespace mem
55  {
56  class DataSet;
57  class DataSetItem;
58  }
59 
60  namespace gm
61  {
62  class Geometry;
63  }
64 
65  namespace vp
66  {
68  {
69  public:
70 
71  GroupThreadManager( const std::map<std::string, std::vector<int> >& groups
72  , te::da::DataSet* dataSet
73  , te::da::DataSetType* dataSetType
74  , te::mem::DataSet* outputDataSet
75  , te::da::DataSetType* outputDataSetType
76  , te::da::DataSource* outputDataSource
77  , std::map<std::string, te::dt::AbstractData*> specificParams);
78 
79  virtual ~GroupThreadManager() {}
80 
81  bool getNextGroup(std::vector< te::mem::DataSetItem*>& nextGroup);
82 
83  bool getNextOutput(std::vector< te::mem::DataSetItem*>& nextOutput);
84 
85  te::da::DataSetType* getDataSetType();
86 
87  te::da::DataSource* getOutputDataSource();
88 
89  te::da::DataSetType* getOutputDataSetType();
90 
91  std::map<std::string, te::dt::AbstractData*> getSpecificParameters();
92 
93  te::mem::DataSet* getClearOutputDataSet();
94 
95  std::vector<std::string> getWarnings();
96 
97  te::mem::DataSetItem* createOutputItem();
98 
99  void addOutput(std::vector<te::mem::DataSetItem*>& itemGroup);
100 
101  void addWarning(const std::string& warning, const bool& appendIfExists = false);
102 
103  private:
104 
106 
107  const GroupThreadManager& operator=(const GroupThreadManager&);
108 
109  std::map<std::string, std::vector<int> > m_groups;
110  std::size_t m_savedCount;
113 
117 
118  std::map<std::string, te::dt::AbstractData*> m_specificParams;
119 
120  std::map<std::string, std::vector<int> >::iterator m_groupsIterator;
121 
122  std::vector< std::vector<te::mem::DataSetItem*> > m_outputQueue;
124 
125  std::vector<std::string> m_warnings;
126 
127  boost::mutex m_mtx;
128  boost::mutex m_mtxOutput;
129  boost::mutex m_mtxWarning;
130  };
131  }
132 }
133 #endif // __TERRALIB_VP_INTERNAL_GROUP_THREAD_MANAGER_H
#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
te::mem::DataSet * m_outputDataSet
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:53
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:119
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
te::da::DataSetType * m_outputDataSetType
URI C++ Library.
std::vector< std::string > m_warnings
std::map< std::string, std::vector< int > > m_groups
te::da::DataSource * m_outputDataSource
te::common::TaskProgress m_task
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
Definition: DataSetItem.h:56
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
Configuration flags for the Terrralib Vector Processing module.
te::da::DataSetType * m_dataSetType
std::vector< std::vector< te::mem::DataSetItem * > > m_outputQueue
std::map< std::string, std::vector< int > >::iterator m_groupsIterator
std::map< std::string, te::dt::AbstractData * > m_specificParams