Changeset 42 in pacpusframework for trunk/src/PacpusLib/ComponentBase.cpp
- Timestamp:
- Jan 8, 2013, 9:44:51 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PacpusLib/ComponentBase.cpp
r31 r42 1 1 /** 2 2 * 3 * Distributed under the UTC Heudiascy Pacpus License, Version 1.0. 4 * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved. 5 * 6 * See the LICENSE file for more information or a copy at: 7 * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt 8 * 3 * This file is part of the PACPUS framework distributed under the 4 * CECILL-C License, Version 1.0. 5 * 6 * @author Samuel Gosselin 7 * @date December, 2012 8 * @version $Id$ 9 * @copyright Copyright (c) UTC/CNRS Heudiasyc 2005 - 2013. All rights reserved. 10 * 9 11 */ 10 12 … … 18 20 19 21 ComponentBase::ComponentBase(const QString& name) 22 : componentName(name) 23 , recording(true) 24 , THREAD_ALIVE(true) 25 , mIsActive(false) 26 , mgr(NULL) 27 , componentState_(NOT_MONITORED) 20 28 { 21 29 LOG_TRACE("constructor"); 22 23 configuration_ = NOT_CONFIGURED; 24 componentName = name; 25 recording = true; 26 THREAD_ALIVE = true; 27 mIsActive = 0; 28 componentState_ = ComponentBase::NOT_MONITORED; 29 30 // we get a pointer on the instance of ComponentManager 30 // Get a pointer on the instance of ComponentManager. 31 31 mgr = ComponentManager::getInstance(); 32 33 LOG_INFO("component " << componentName 34 << " was created" 35 ); 32 LOG_INFO("component " << componentName << " was created"); 36 33 } 37 34 … … 43 40 int ComponentBase::startComponent() 44 41 { 45 if (mIsActive == 0) {46 mIsActive = 1;47 startActivity();48 return 1;49 } else {50 return 0;51 }42 if (mIsActive) 43 return false; 44 45 mIsActive = true; 46 startActivity(); 47 48 return true; 52 49 } 53 50 54 51 int ComponentBase::stopComponent() 55 52 { 56 if ( mIsActive == 1) {57 mIsActive = 0;58 stopActivity(); 59 return 1;60 } else {61 return 0;62 }53 if (!mIsActive) 54 return false; 55 56 mIsActive = false; 57 stopActivity(); 58 59 return true; 63 60 } 64 61 65 62 void ComponentBase::setState(const COMPONENT_STATE state) 66 63 { 67 if (state != componentState_) { 68 componentState_ = state; 69 } 64 componentState_ = state; 70 65 } 71 66 … … 82 77 bool ComponentBase::isConfigured() const 83 78 { 84 return CONFIGURED_OK == configuration_;79 return configuration_ == CONFIGURED_OK; 85 80 }
Note:
See TracChangeset
for help on using the changeset viewer.