source: pacpusframework/trunk/src/_NewComponent/NewComponent.cpp.in@ 369

Last change on this file since 369 was 332, checked in by phudelai, 10 years ago

_NewComponent function autoStart added

File size: 2.4 KB
RevLine 
[147]1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %pacpus:license}
5
6#include "@PACPUS_COMPONENT_NAME@.h"
[216]7#include "@PACPUS_COMPONENT_NAME@Impl.h"
[147]8
[192]9#include <Pacpus/kernel/ComponentFactory.h>
[147]10#include <Pacpus/kernel/Log.h>
11
12using namespace pacpus;
13using namespace std;
14
[216]15DECLARE_STATIC_LOGGER("pacpus.@PACPUS_COMPONENT_NAME@");
[147]16
17/// Constructs a static component factory
18static ComponentFactory<@PACPUS_COMPONENT_NAME@> sFactory("@PACPUS_COMPONENT_NAME@");
19
20//////////////////////////////////////////////////////////////////////////
21@PACPUS_COMPONENT_NAME@::@PACPUS_COMPONENT_NAME@(QString name)
22 : ComponentBase(name)
23{
24 LOG_TRACE("constructor(" << name << ")");
[192]25
[218]26 mImpl.reset(new Impl(this));
27
[192]28 //addParameters()
[216]29 //("parameter-name", value<ParameterType>(&mImpl->mParameterVariable)->required(), "parameter description")
30 //("parameter-name", value<ParameterType>(&mImpl->mParameterVariable)->default_value(0), "parameter description")
[192]31 //;
[147]32}
33
34@PACPUS_COMPONENT_NAME@::~@PACPUS_COMPONENT_NAME@()
35{
36 LOG_TRACE("destructor");
37}
38
39//////////////////////////////////////////////////////////////////////////
[193]40void @PACPUS_COMPONENT_NAME@::addInputs()
41{
[194]42 // must inherit from QObject to use addInput
[193]43 //addInput<InputType, @PACPUS_COMPONENT_NAME@>("input-name", &@PACPUS_COMPONENT_NAME@::processInput);
44}
45
46void @PACPUS_COMPONENT_NAME@::addOutputs()
47{
[194]48 // must inherit from QObject to use addOutput
[193]49 //addOutput<OutputType, @PACPUS_COMPONENT_NAME@>("output-name");
50}
51
52//////////////////////////////////////////////////////////////////////////
[147]53void @PACPUS_COMPONENT_NAME@::startActivity()
54{
[216]55 mImpl->start();
[147]56}
57
58void @PACPUS_COMPONENT_NAME@::stopActivity()
59{
[216]60 mImpl->stop();
[147]61}
62
63//////////////////////////////////////////////////////////////////////////
64ComponentBase::COMPONENT_CONFIGURATION @PACPUS_COMPONENT_NAME@::configureComponent(XmlComponentConfig config)
65{
[332]66 bool autoStart = false;
67 if (config.getProperty("autoStart") != QString::null)
68 autoStart = config.getProperty("autoStart").toBool());
69
70 if (autoStart)
71 this->startActivity();
[147]72 return ComponentBase::CONFIGURED_OK;
73}
[216]74
75//////////////////////////////////////////////////////////////////////////
76//void @PACPUS_COMPONENT_NAME@::processInput(InputType const& input)
77//{
78// mImpl->processInput(input);
79//}
Note: See TracBrowser for help on using the repository browser.