Loading...
Searching...
No Matches
Process.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/process/Process.h
22
23 \brief This class represents a container of tasks and connectors and is responsible for controlling its execution flow
24 */
25
26#ifndef __TERRALIB_PROCESS_INTERNAL_PROCESS_H
27#define __TERRALIB_PROCESS_INTERNAL_PROCESS_H
28
29 // TerraLib
30#include "Config.h"
31
32//STL include files
33#include <memory>
34#include <thread>
35#include <string>
36#include <vector>
37
38namespace te
39{
40 namespace process
41 {
42 class ConnectorSharedPtr;
43 class ProcessListener;
44 class TaskSharedPtr;
45
46 /*!
47 \class Progress
48
49 \brief This class represents a container of tasks and connectors and is responsible for controlling its execution flow
50 */
52 {
53 public:
54
55 /*!
56 \brief Constructor
57 */
59
60 /*! \brief Virtual destructor. */
61 virtual ~Process();
62
63 //!< Clears the association
64 void clear();
65
66 //!< Checks if the process is valid
68
69 //!< Adds a task to the process. Process will be the holder of the given shared pointers
71
72 //!< Adds a connector to the process. Process will be the holder of the given shared pointers
74
75 //!< Gets the task associated to the given id
76 te::process::TaskSharedPtr getTask(const std::string& id) const;
77
78 //!< Gets the connector associated to the given id
79 te::process::ConnectorSharedPtr getConnector(const std::string& id) const;
80
81 //!< Removed the task associated to the given id
82 void removeTask(const std::string& id);
83
84 //!< Removes the connector associated to the given id
85 void removeConnector(const std::string& id);
86
87 //!< Gets all taks from the process
88 const std::vector<te::process::TaskSharedPtr>& getTasks() const;
89
90 //!< Gets all connectors from the process
91 const std::vector<te::process::ConnectorSharedPtr>& getConnectors() const;
92
93 //!< Runs the process synchronously
95
96 //!< Runs the process asynchronously
98
99 //!< Requests that the asynchronously execution be stopped
101
102 protected:
103
104 //!< Gets all tasks that are ready to rund
105 std::vector<te::process::TaskSharedPtr> getReadyToRunTasks() const;
106
107 protected:
108 std::thread* m_thread;
109 std::vector<te::process::TaskSharedPtr> m_vecTasks;
110 std::vector<te::process::ConnectorSharedPtr> m_vecConnectors;
111
112 };
113 } // end namespace process
114} // end namespace te
115
116#endif // __TERRALIB_PROCESS_INTERNAL_PROCESS_H
This abstract class a listener to the process flow.
void removeTask(const std::string &id)
Removes the connector associated to the given id.
std::vector< te::process::TaskSharedPtr > m_vecTasks
Definition: Process.h:109
void addConnector(te::process::ConnectorSharedPtr connectorPtr)
Gets the task associated to the given id.
Process()
Constructor.
std::vector< te::process::ConnectorSharedPtr > m_vecConnectors
Definition: Process.h:110
virtual ~Process()
Virtual destructor.
const std::vector< te::process::ConnectorSharedPtr > & getConnectors() const
Runs the process synchronously.
void addTask(te::process::TaskSharedPtr taskPtr)
Adds a connector to the process. Process will be the holder of the given shared pointers.
void clear()
Checks if the process is valid.
std::thread * m_thread
Definition: Process.h:108
std::vector< te::process::TaskSharedPtr > getReadyToRunTasks() const
< Gets all tasks that are ready to rund
void removeConnector(const std::string &id)
Gets all taks from the process.
bool run(te::process::ProcessListener *listener)
Runs the process asynchronously.
te::process::TaskSharedPtr getTask(const std::string &id) const
Gets the connector associated to the given id.
te::process::ConnectorSharedPtr getConnector(const std::string &id) const
Removed the task associated to the given id.
bool isValid(te::process::ProcessListener *listener) const
Adds a task to the process. Process will be the holder of the given shared pointers.
const std::vector< te::process::TaskSharedPtr > & getTasks() const
Gets all connectors from the process.
void runAsync(te::process::ProcessListener *listener)
Requests that the asynchronously execution be stopped.
TerraLib.
#define TEPROCESSEXPORT
Definition: Config.h:47
Proxy configuration file for TerraView (see terraview_config.h).