Changeset 184 in pacpusframework for trunk/src/PacpusLib/ComponentManager.cpp


Ignore:
Timestamp:
Oct 23, 2013, 9:34:23 AM (11 years ago)
Author:
morasjul
Message:

Minor fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/PacpusLib/ComponentManager.cpp

    r182 r184  
    1616
    1717using namespace pacpus;
    18 using namespace pacpus;
    1918
    2019DECLARE_STATIC_LOGGER("pacpus.core.ComponentManager");
     
    183182}
    184183
     184bool 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
    185197bool ComponentManager::createConnection(const QString& outputSignature, const QString& inputSignature, const QString& type, int priority = 0)
    186198{
     199    // FIXME: use 2 signatures (output component + output connection) instead of 1 separated by a (".") dot
    187200    QStringList output = outputSignature.split(".");
    188201    QStringList input  = inputSignature.split(".");
    189202
    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    }
    203209    // NOTE Create communicationInterface if needed ??
    204210    return connectInterface(
     
    207213        priority
    208214    );
    209 
    210215}
    211216
Note: See TracChangeset for help on using the changeset viewer.