source: pacpusframework/trunk/src/PacpusLib/ComponentBase.cpp@ 65

Last change on this file since 65 was 64, checked in by Marek Kurdej, 12 years ago

Modified property: added svn:keywords=Id.

  • Property svn:keywords set to Id
File size: 1.5 KB
RevLine 
[62]1// This file is part of the PACPUS framework distributed under the
2// CECILL-C License, Version 1.0.
3//
4/// @version $Id: ComponentBase.cpp 64 2013-01-09 16:41:12Z kurdejma $
[3]5
[30]6#include <Pacpus/kernel/ComponentBase.h>
7#include <Pacpus/kernel/ComponentManager.h>
8#include <Pacpus/kernel/Log.h>
[3]9
[30]10using namespace pacpus;
[3]11
12DECLARE_STATIC_LOGGER("pacpus.core.ComponentBase");
13
[30]14ComponentBase::ComponentBase(const QString& name)
[42]15 : componentName(name)
16 , recording(true)
17 , THREAD_ALIVE(true)
18 , mIsActive(false)
19 , mgr(NULL)
20 , componentState_(NOT_MONITORED)
[3]21{
22 LOG_TRACE("constructor");
[42]23 // Get a pointer on the instance of ComponentManager.
[3]24 mgr = ComponentManager::getInstance();
[42]25 LOG_INFO("component " << componentName << " was created");
[3]26}
27
28ComponentBase::~ComponentBase()
29{
30 LOG_TRACE("destructor");
31}
32
33int ComponentBase::startComponent()
34{
[42]35 if (mIsActive)
36 return false;
37
38 mIsActive = true;
39 startActivity();
40
41 return true;
[3]42}
43
44int ComponentBase::stopComponent()
45{
[42]46 if (!mIsActive)
47 return false;
48
49 mIsActive = false;
50 stopActivity();
51
52 return true;
[3]53}
54
55void ComponentBase::setState(const COMPONENT_STATE state)
56{
[42]57 componentState_ = state;
[3]58}
59
[30]60// FIXME: this should be const.
[3]61ComponentBase::COMPONENT_STATE ComponentBase::getState()
62{
63 COMPONENT_STATE state = componentState_;
64 if (ComponentBase::NOT_MONITORED != componentState_) {
65 componentState_ = ComponentBase::MONITOR_NOK;
66 }
67 return state;
68}
69
[30]70bool ComponentBase::isConfigured() const
71{
[42]72 return configuration_ == CONFIGURED_OK;
[30]73}
Note: See TracBrowser for help on using the repository browser.