Loading...
Searching...
No Matches
Connector.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/Connector.h
22
23 \brief Abstraction that represents a Connector between parameters of a Task
24 */
25
26#ifndef __TERRALIB_PROCESS_INTERNAL_CONNECTOR_H
27#define __TERRALIB_PROCESS_INTERNAL_CONNECTOR_H
28
29 // TerraLib
30#include "Config.h"
31
32//STL include files
33#include <memory>
34#include <string>
35
36namespace te
37{
38 namespace process
39 {
40 class Task;
41
42 /*!
43 \class Connector
44
45 \brief Abstraction that represents a Connector between parameters of a Task
46 */
48 {
49 public:
50
51 /*!
52 \brief It initializes the Connector
53 */
55
56 /*! \brief Virtual destructor. */
57 virtual ~Connector();
58
59 //!< Gets the id of the connector
60 const std::string& getId() const;
61
62 //< Sets the id of the connector. Generally used only of a deserialization
63 void setId(const std::string& id);
64
65 //!< Clears the association
66 void clear();
67
68 //!< Checks if the association is valid
69 bool isValid() const;
70
71 //!< Checks if the parameter from the task from is ready to be pushed into the taskTo
72 bool isReady() const;
73
74 //!< Gets the task 'from'
76
77 //!< Gets the param index 'from'
78 std::size_t getParamIndexFrom() const;
79
80 //!< Gets the task 'to'
82
83 //!< Gets the param index 'to'
84 std::size_t getParamIndexTo() const;
85
86 //!< Check if an a association could be made between tasks and parameters indexes informed
87 static bool canAssociate(te::process::Task* taskFrom, std::size_t paramIndexFrom, te::process::Task* taskTo, std::size_t paramIndexTo, std::string& info);
88
89 //!< Associates the 'paramIndexFrom' output parameter of the 'taskFrom' to the 'paramIndexTo' input parameter of the 'taskTo'
90 void associate(te::process::Task* taskFrom, std::size_t paramIndexFrom, te::process::Task* taskTo, std::size_t paramIndexTo);
91
92 //!< Disassociates this connector from your tasks
94
95 //!< Based on the association, gets the parameter from the taskFrom and pushes it into the taskTo. If the taskFrom is not ready, an exception will be thrown
96 void apply();
97
98 protected:
99
100 std::string m_id; //!< The ID of the connector
102 std::size_t m_paramIndexFrom;
104 std::size_t m_paramIndexTo;
106
107 };
108
109 //Typedef
110 class TEPROCESSEXPORT ConnectorPtr : public std::unique_ptr<Connector>
111 {
112 public:
113 explicit ConnectorPtr(te::process::Connector* pointer = nullptr);
115 };
116
117 class TEPROCESSEXPORT ConnectorSharedPtr : public std::shared_ptr<Connector>
118 {
119 public:
120 explicit ConnectorSharedPtr(te::process::Connector* pointer = nullptr);
122 };
123
124 } // end namespace process
125} // end namespace te
126
127#endif // __TERRALIB_PROCESS_INTERNAL_CONNECTOR_H
ConnectorPtr(te::process::Connector *pointer=nullptr)
ConnectorSharedPtr(te::process::Connector *pointer=nullptr)
Abstraction that represents a Connector between parameters of a Task.
Definition: Connector.h:48
void clear()
Checks if the association is valid.
Connector()
It initializes the Connector.
static bool canAssociate(te::process::Task *taskFrom, std::size_t paramIndexFrom, te::process::Task *taskTo, std::size_t paramIndexTo, std::string &info)
Associates the 'paramIndexFrom' output parameter of the 'taskFrom' to the 'paramIndexTo' input parame...
te::process::Task * m_taskFrom
Definition: Connector.h:101
std::size_t m_paramIndexTo
Definition: Connector.h:104
bool isValid() const
Checks if the parameter from the task from is ready to be pushed into the taskTo.
void associate(te::process::Task *taskFrom, std::size_t paramIndexFrom, te::process::Task *taskTo, std::size_t paramIndexTo)
Disassociates this connector from your tasks.
void disassociate()
Based on the association, gets the parameter from the taskFrom and pushes it into the taskTo....
const std::string & getId() const
const te::process::Task * getTaskTo() const
Gets the param index 'to'.
void setId(const std::string &id)
Clears the association.
const te::process::Task * getTaskFrom() const
Gets the param index 'from'.
std::size_t getParamIndexTo() const
Check if an a association could be made between tasks and parameters indexes informed.
std::size_t getParamIndexFrom() const
Gets the task 'to'.
std::size_t m_paramIndexFrom
Definition: Connector.h:102
std::string m_id
The ID of the connector.
Definition: Connector.h:100
bool isReady() const
Gets the task 'from'.
virtual ~Connector()
Virtual destructor.
te::process::Task * m_taskTo
Definition: Connector.h:103
This class represents the description of a parameter.
Definition: Task.h:54
TerraLib.
#define TEPROCESSEXPORT
Definition: Config.h:47
Proxy configuration file for TerraView (see terraview_config.h).