Index: branches/2.0-beta1/include/Pacpus/kernel/ComponentBase.h
===================================================================
--- branches/2.0-beta1/include/Pacpus/kernel/ComponentBase.h	(revision 138)
+++ branches/2.0-beta1/include/Pacpus/kernel/ComponentBase.h	(revision 152)
@@ -38,4 +38,10 @@
 class ComponentManager;
 
+template <typename T, class C>
+class InputInterface;
+
+template <typename T, class C>
+class OutputInterface;
+
 /** ComponentBase
  * @brief Base class of a Pacpus component.
@@ -44,4 +50,5 @@
 {
     friend class ComponentManager;
+
 public:
     /**
@@ -87,9 +94,10 @@
      * @return Name of the component.
      */
+    QString name() const;
     QString getName() const;
 
-    InputInterfaceBase * getInput(QString) const;
-
-    OutputInterfaceBase * getOutput(QString) const;
+    InputInterfaceBase * getInput(QString name) const;
+
+    OutputInterfaceBase * getOutput(QString name) const;
 
 protected:
@@ -115,33 +123,58 @@
     // virtual QString getType() = 0;
 
-    virtual void addInput();
-
-    virtual void addOutput();
+    virtual void addInputs() = 0;
+    virtual void addOutputs() = 0;
+
+protected:
+    typedef QMap<QString, InputInterfaceBase *> InputsMap;
+    typedef QMap<QString, OutputInterfaceBase *> OutputsMap;
+
+    // TODO: use std::function<void (const DataType &)>
+    // TODO: use std::mem_fun<void (const DataType &)>
+    template <typename DataType, class ComponentType, typename Function>
+    void addInput(const char * name, Function function)
+    {
+        typedef InputInterface<DataType, ComponentType> InputType;
+        InputType * connection = new InputType(name, dynamic_cast<ComponentType *>(this), function);
+        inputs().insert(name, connection);
+    }
+
+    template <typename DataType, class ComponentType>
+    void addOutput(const char * name)
+    {
+        typedef OutputInterface<DataType, ComponentType> OutputType;
+        OutputType * connection = new OutputType(name, dynamic_cast<ComponentType *>(this));
+        outputs().insert(name, connection);
+    }
+
+    template <typename DataType, class ComponentType>
+    InputInterface<DataType, ComponentType> *
+        getTypedInput(const char * name) const
+    {
+        return dynamic_cast<InputInterface<DataType, ComponentType> *>(getInput(name));
+    }
+
+    template <typename DataType, class ComponentType>
+    OutputInterface<DataType, ComponentType> *
+        getTypedOutput(const char * name) const
+    {
+        return dynamic_cast<OutputInterface<DataType, ComponentType> *>(getOutput(name));
+    }
+
+    bool isActive() const;
+    void setActive(bool isActive);
+    bool isRecording() const;
+    void setRecording(bool isRecording);
+
+    InputsMap & inputs();
+    const InputsMap & inputs() const;
+    OutputsMap & outputs();
+    const OutputsMap & outputs() const;
+
+    COMPONENT_CONFIGURATION configurationState() const;
+    void setConfigurationState(COMPONENT_CONFIGURATION state);
+
+    const XmlComponentConfig xmlParameters() const;
     
-protected:
-    /// The XML node that is got in the configureComponent method
-    XmlComponentConfig param;
-
-    /// the name of the component. It is this one in the XML config file
-    QString componentName;
-
-    /// is the component is recording data?
-    bool recording;
-
-    /// provided for compatibility with old DBITE framework
-    bool THREAD_ALIVE;
-
-    /// is the component active?
-    bool mIsActive;
-
-    /// a pointer to the manager of components
-    ComponentManager * mgr;
-
-    QMap<QString, InputInterfaceBase *> input;
-    QMap<QString, OutputInterfaceBase *> output;
-
-    /// a pointer to an optional widget
-    QWidget *   ui;
-
 private:
     /// called by the ComponentManager to start the component
@@ -151,12 +184,33 @@
     int stopComponent();
 
+private:
+    /// The XML node that is got in the configureComponent method
+    XmlComponentConfig param;
+
+    /// the name of the component. It is this one in the XML config file
+    QString m_componentName;
+    
+    /// is the component active?
+    volatile bool m_isActive;
+
+    /// is the component is recording data?
+    bool m_isRecording;
+
+    /// a pointer to the manager of components
+    ComponentManager * m_manager;
+
+    InputsMap m_inputs;
+    OutputsMap m_outputs;
+
+    /// a pointer to an optional widget
+    QWidget * m_ui;
+
     /// store the state of the component
-    COMPONENT_STATE componentState_;
+    COMPONENT_STATE m_componentState;
 
     /// is the component configured (ie configureComponent method was called)
-    COMPONENT_CONFIGURATION configuration_;
+    COMPONENT_CONFIGURATION m_configurationState;
 };
 
-
 } // pacpus
 
