Changeset 184 in pacpusframework
- Timestamp:
- Oct 23, 2013, 9:34:23 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/Pacpus/kernel/ComponentBase.h
r182 r184 45 45 namespace pacpus { 46 46 47 // Forward declarations.48 47 class ComponentManager; 48 49 class InputInterfaceBase; 50 class OutputInterfaceBase; 49 51 50 52 template <typename T, class C> 51 53 class InputInterface; 52 53 54 template <typename T, class C> 54 55 class OutputInterface; -
trunk/include/Pacpus/kernel/ComponentManager.h
r146 r184 119 119 bool createComponent(const QString& type, const QString& name); 120 120 121 bool checkComponentConnection(const QString& componentName, const QString& connectionName); 121 122 bool createConnection(const QString& type, const QString& name, const QString& , int ); 122 123 -
trunk/include/Pacpus/kernel/InputOutputInterface.h
r182 r184 39 39 } 40 40 41 void customEvent(QEvent * event)41 void customEvent(QEvent * event) 42 42 { 43 43 // TODO check component state started … … 86 86 } 87 87 88 88 // Add here new event type if needed 89 89 90 90 default: … … 112 112 { 113 113 public: 114 OutputInterface(QString name, C * component):OutputInterfaceBase(name,component,component) {} 114 OutputInterface(QString name, C * component) 115 :OutputInterfaceBase(name,component,component) 116 {} 115 117 ~OutputInterface() {} 116 118 117 119 // Used by Components to send data througth typed output 118 void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0) 120 void send(const T & data, road_time_t t = road_time(), road_timerange_t tr = 0); 121 122 void send(const T & data, road_time_t t, road_timerange_t tr) 119 123 { 120 124 // FIXME Data Shared … … 138 142 }; 139 143 140 141 144 } // namespace pacpus 142 145 -
trunk/src/PacpusLib/ComponentManager.cpp
r182 r184 16 16 17 17 using namespace pacpus; 18 using namespace pacpus;19 18 20 19 DECLARE_STATIC_LOGGER("pacpus.core.ComponentManager"); … … 183 182 } 184 183 184 bool ComponentManager::checkComponentConnection(const QString& componentName, const QString& connectionName) 185 { 186 if (NULL == getComponent(componentName)) { 187 LOG_WARN("cannot make connection : component " << componentName << " not found"); 188 return false; 189 } 190 if (NULL == getComponent(componentName)->getOutput(connectionName)) { 191 LOG_WARN("cannot make connection : component " << componentName << " does not have input/output " << connectionName); 192 return false; 193 } 194 return true; 195 } 196 185 197 bool ComponentManager::createConnection(const QString& outputSignature, const QString& inputSignature, const QString& type, int priority = 0) 186 198 { 199 // FIXME: use 2 signatures (output component + output connection) instead of 1 separated by a (".") dot 187 200 QStringList output = outputSignature.split("."); 188 201 QStringList input = inputSignature.split("."); 189 202 190 if (getComponent(output[0])==NULL) { 191 LOG_WARN("cannot make connection : component " << output[0] << " not found"); 192 return false;} 193 if (getComponent(output[0])->getOutput(output[1]) == NULL) { 194 LOG_WARN("cannot make connection : component " << output[0] << " doesn't have output " << output[1]); 195 return false;} 196 if (getComponent(input[0])==NULL) { 197 LOG_WARN("cannot make connection : component " << input[0] << " not found"); 198 return false;} 199 if (getComponent(input[0])->getInput(input[1]) == NULL) { 200 LOG_WARN("cannot make connection : component " << input[0] << " doesn't have intput " << input[1]); 201 return false;} 202 203 if (!checkComponentConnection(output[0], output[1])) { 204 return false; 205 } 206 if (!checkComponentConnection(input[0], input[1])) { 207 return false; 208 } 203 209 // NOTE Create communicationInterface if needed ?? 204 210 return connectInterface( … … 207 213 priority 208 214 ); 209 210 215 } 211 216
Note:
See TracChangeset
for help on using the changeset viewer.