Changeset 9 in pacpustutorials


Ignore:
Timestamp:
10/12/15 10:50:39 (9 years ago)
Author:
DHERBOMEZ Gérald
Message:

update tutorials

Files:
8 added
2 edited
6 moved

Legend:

Unmodified
Added
Removed
  • template/component_template/ComponentTemplate.cpp

    r1 r9  
    3333/************************************************************************/
    3434ComponentTemplate::ComponentTemplate(QString name)
    35     : ComponentBase(name)
     35  : ComponentBase(name)
    3636{
    3737
     
    4444ComponentTemplate::~ComponentTemplate()
    4545
    46 }
    47 
    48 /************************************************************************/
    49 /* Start function
    50 /************************************************************************/
    51 void ComponentTemplate::startActivity()
    52 {
    5346
    5447}
    5548
    5649
     50/************************************************************************/
     51/* Start function, called by the ComponentManager when a start()
     52/* command is received
     53/************************************************************************/
     54void ComponentTemplate::startActivity()
     55{
     56  // if you add an ouput, uncomment the line
     57  // out1_ = getTypedOutput<int, ComponentTemplate>("value");
     58}
     59
    5760
    5861/************************************************************************/
    59 /* Stop function
     62/* Stop function, called by the ComponentManager when a stop()
     63/* command is received
    6064/************************************************************************/
    6165void ComponentTemplate::stopActivity()
     
    6569
    6670
     71/************************************************************************/
     72/* Called by the framework at initialization
     73/************************************************************************/
     74void ComponentTemplate::addInputs()
     75{
     76  // uncomment to add an input
     77  // addInput<int, ComponentTemplate>("value", &ComponentTemplate::processInput);
     78}
     79
    6780
    6881/************************************************************************/
    69 /* Configuration of the component
     82/* Called by the framework at initialization
     83/************************************************************************/
     84void ComponentTemplate::addOutputs()
     85{
     86  // empty: no output
     87  // addOutput<int, ProducerExample>("value");
     88}
     89
     90
     91/************************************************************************/
     92/* Example function that produces an output
     93/************************************************************************/
     94// void ComponentTemplate::produceOutput()
     95// {
     96//   int val = 12;
     97//   checkedSend(out1_, val);
     98// }
     99
     100
     101/************************************************************************/
     102/* Example function that processes an input
     103/************************************************************************/
     104// void processInput(const int& value)
     105// {
     106//   
     107// }
     108
     109
     110/************************************************************************/
     111/* Configuration of the component, called by the ComponentManager after
     112/* the construction of the object
    70113/************************************************************************/
    71114ComponentBase::COMPONENT_CONFIGURATION ComponentTemplate::configureComponent(XmlComponentConfig config)
  • template/component_template/ComponentTemplate.h

    r4 r9  
    2121#include "PluginTemplateConfig.h"
    2222
    23 #include "Pacpus/kernel/ComponentBase.h"
    24 #include "Pacpus/kernel/DbiteFile.h"
     23#include <Pacpus/kernel/ComponentBase.h>
     24#include <Pacpus/kernel/InputOutputInterface.h>
     25#include <Pacpus/kernel/DbiteFile.h>
    2526
    26 namespace pacpus {
     27namespace pacpus
     28{
    2729
    28 class PLUGINTEMPLATE_API ComponentTemplate
    29         : public ComponentBase
    30 {
    31         Q_OBJECT
     30  class PLUGINTEMPLATE_API ComponentTemplate
     31  : public QObject
     32  , public ComponentBase
     33  {
     34    Q_OBJECT
    3235
    33 public:
    34   // Specific constructor for pacpus component
    35   ComponentTemplate(QString name);
    36   ~ComponentTemplate();
     36  public:
     37    // Specific constructor for pacpus component
     38    ComponentTemplate(QString name);
     39    ~ComponentTemplate();
    3740
    38   // 3 inherited virtual pure methods
    39   virtual void startActivity();
    40   virtual void stopActivity();
    41   virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
     41    // 3 inherited virtual pure methods
     42    virtual void startActivity();
     43    virtual void stopActivity();
     44    virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
     45
     46    virtual void addInputs();
     47    virtual void addOutputs();
     48
     49    // void produceOutput();
     50    // void processInput(const int& value);
    4251
    4352
    44 private:
    45   // Add here your private variables
    46   unsigned long var_;
    47   unsigned long parameter_;
    48  
    49 }; // end class ComponentTemplate
     53  private:
     54    // Add here your private variables
     55    unsigned long var_;
     56    unsigned long parameter_;
     57
     58    // Declaration of an output
     59    // OutputInterface<int, ComponentTemplate>* out1_;
     60
     61  }; // end class ComponentTemplate
    5062
    5163} // end namespace pacpus
    5264
    53 #endif //__ComponentTemplate_h__
     65#endif
Note: See TracChangeset for help on using the changeset viewer.