source: pacpusframework/trunk/src/PacpusLib/ConnectionManager.cpp

Last change on this file was 206, checked in by Marek Kurdej, 11 years ago

Major: cleaned connection interfaces.

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#include <Pacpus/kernel/ConnectionManager.h>
2#include <Pacpus/kernel/Log.h>
3
4using namespace pacpus;
5
6DECLARE_STATIC_LOGGER("pacpus.core.ConnectionManager");
7
8ConnectionManager::ConnectionManager()
9{
10 LOG_TRACE("constructor");
11}
12
13ConnectionManager::~ConnectionManager()
14{
15 LOG_TRACE("destructor");
16}
17
18ConnectionManager * ConnectionManager::getInstance()
19{
20 LOG_TRACE("getInstance()");
21 LOG_TRACE("before: mInstance = " << mInstance);
22
23 if (!mInstance)
24 {
25 LOG_INFO("creating new instance...");
26 mInstance = new ConnectionManager();
27 LOG_DEBUG("mInstance = " << mInstance);
28 }
29
30 LOG_TRACE("after: mInstance = " << mInstance);
31 return mInstance;
32}
33
34//void ConnectionManager::LoadConnection()
35
36void ConnectionManager::setConnection()
37{
38 LOG_TRACE(Q_FUNC_INFO);
39
40 ComponentManager * mgr = ComponentManager::getInstance();
41
42 // TODO read XML file and build ConnectionList
43 QList<ConnectionDescriptor> ConnectionList;
44 ConnectionList.append(ConnectionDescriptor("testComponent1", "image", "testComponent2", "image", "type"));
45
46 ComponentBase * sender, * receiver;
47 InputInterfaceBase * in;
48 OutputInterfaceBase * out;
49
50 for (QList<ConnectionDescriptor>::iterator i = ConnectionList.begin(); i != ConnectionList.end(); ++i) {
51 // TODO Handle errors
52 sender = mgr->getComponent(i->_outputComponent);
53 out = sender->getOutput(i->_outputName);
54
55 receiver = mgr->getComponent(i->_inputComponent);
56 in = receiver->getInput(i->_inputName);
57
58 //connect(out,SIGNAL(),in,SLOT()); // TODO make connection
59
60 LOG_INFO(" Output " << "out" << " connected to " << "in") // TODO replace out / in
61 }
62
63// CledComponent * cledComponent = (CledComponent*) m_component[cName];
64
65// InputInterface<ScanAlascaData> * in1 = static_cast<InputInterface<ScanAlascaData> *> (cledComponent->input.at(0));
66// OutputInterface<ScanAlascaData> * out1 = static_cast<OutputInterface<ScanAlascaData> *> (cledComponent->output.at(0));
67
68// if(in1->getDataType() != out1->getDataType())
69// LOG_ERROR("Connection Error: Incomaptible dataType between " << cledComponent->getName() << " and " << cledComponent->getName());
70
71
72// PacpusBuffer * buffer = new PacpusBuffer(5,in1->getDataSize());
73// LOG_INFO("Device opened:" << buffer->open(QIODevice::ReadWrite));
74
75// in1->setConnection(buffer,true);
76// out1->setConnection(buffer,true);
77}
Note: See TracBrowser for help on using the repository browser.