Index: trunk/src/PacpusLib/ComponentManager.cpp
===================================================================
--- trunk/src/PacpusLib/ComponentManager.cpp	(revision 204)
+++ trunk/src/PacpusLib/ComponentManager.cpp	(revision 206)
@@ -22,4 +22,14 @@
 using namespace pacpus;
 
+//template <typename _Elem, typename _Traits, typename _ListElem>
+//std::basic_ostream<_Elem, _Traits> & operator<<(std::basic_ostream<_Elem, _Traits> & os, const QList<_ListElem> & list)
+//{
+//    typedef QList<_ListElem> ListType;
+//    for (ListType::const_iterator it = list.cbegin(), itend = list.cend(); it != itend; ++it) {
+//        os << *it << "\n";
+//    }
+//    return os;
+//}
+
 template <typename _Elem, typename _Traits, typename _ListElem>
 std::basic_ostream<_Elem, _Traits> & operator<<(std::basic_ostream<_Elem, _Traits> & os, const QList<_ListElem> & list)
@@ -36,4 +46,6 @@
 ////////////////////////////////////////////////////////////////////////////////
 
+/// Connects OutputInterfaceBase @b out to InputInterfaceBase @b in using given priority and reading mode.
+/// @returns @b true if connection has been added successfully, @b false otherwise.
 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode = InputInterfaceBase::GetLast);
 
@@ -42,17 +54,30 @@
 bool connectInterface(OutputInterfaceBase * out, InputInterfaceBase * in, int priority, InputInterfaceBase::ReadingMode mode)
 {
-    if ((out->getDataType() == in->getDataType())
-            || (out->getDataType() == typeid(QByteArray))
-            || (in->getDataType() == typeid(QByteArray))) {
-        // Add connection
-        out->addConnection(ConnectionBase(in, priority));  // TODO make connect function
-        in->addConnection(ConnectionBase(out, priority));
-        in->setReadingMode(mode);
-        //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());
-        return true;
-    } else {
-        //LOG_WARN("connecting " << out->getSignature() << ":" << out->getDataType() << " to " << in->getSignature() << ":" << in->getDataType() << " failled : DataType incompatible " <<  QString(typeid(QByteArray).name()));
-        return false;
-    }
+    // check connections
+    if (!out || !in) {
+        LOG_WARN("null connection");
+        return false;
+    }
+
+    // check if connection type are compatible
+    // FIXME: it should permit an OutputType to be a type conversible to InputType
+    if (out->getDataType() != in->getDataType()) {
+        LOG_WARN("connection types do not match: "
+            << out->getSignature() << "." << out->getDataType().name()
+            << " -> "
+            << in->getSignature() << "." << in->getDataType().name()
+        );
+        return false;
+    }
+    //if ((out->getDataType() == in->getDataType())
+    //        || (out->getDataType() == typeid(QByteArray))
+    //        || (in->getDataType() == typeid(QByteArray))) {
+    
+    // add connection
+    out->addConnection(ConnectionBase(in, priority));  // TODO make connect function
+    in->addConnection(ConnectionBase(out, priority));
+    in->setReadingMode(mode);
+    //LOG_INFO("connection : Output " << out->getSignature() << " => Input " << in->getSignature());
+    return true;
 }
 
@@ -145,6 +170,5 @@
     LOG_TRACE("registerComponent(name="<< name << ")");
 
-    if (componentMap_.contains(name))
-    {
+    if (componentMap_.contains(name)) {
         LOG_WARN("cannot register component '" << name << "'. A component with the same name exists already");
         return false;
@@ -235,5 +259,5 @@
 }
 
-bool ComponentManager::createConnection(const QString& outputSignature, const QString& inputSignature, const QString& type, int priority = 0)
+bool ComponentManager::createConnection(const QString & outputSignature, const QString & inputSignature, const QString & type, int priority = 0)
 {
     // FIXME: use 2 signatures (output component + output connection) instead of 1 separated by a (".") dot
@@ -247,5 +271,5 @@
         return false;
     }
-    // NOTE Create communicationInterface if needed ??
+    // FIXME: Create communicationInterface if needed ??
     return connectInterface(
         getComponent(output[0])->getOutput(output[1]), 
