INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
libs/orcaice/subsystemthread.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp 00005 * 00006 * This copy of Orca is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 00011 #ifndef ORCAICE_SUBSYSTEM_THREAD_H 00012 #define ORCAICE_SUBSYSTEM_THREAD_H 00013 00014 #include <gbxsickacfr/gbxiceutilacfr/thread.h> 00015 #include <gbxutilacfr/subhealth.h> 00016 #include <gbxutilacfr/status.h> 00017 #include <gbxutilacfr/tracer.h> 00018 00019 namespace orcaice { 00020 00051 class SubsystemThread : public gbxiceutilacfr::Thread 00052 { 00053 public: 00055 SubsystemThread( gbxutilacfr::Tracer& tracer, 00056 gbxutilacfr::Status& status, 00057 const std::string& subsysName="SubsystemThread", 00058 double maxHeartbeatIntervalSec=-1.0 ); 00059 00060 ~SubsystemThread(); 00061 00063 gbxutilacfr::Tracer& tracer() { return tracer_; }; 00064 00066 void setMaxHeartbeatInterval( double interval ); 00067 00069 void setSubsystemType( gbxutilacfr::SubsystemType type ); 00070 00072 std::string subsysName() const; 00073 00075 gbxutilacfr::SubHealth& health() { return health_; }; 00076 00077 // from IceUtil::Thread 00078 // This implementation calls protectedRun(), catches all possible exceptions, prints out 00079 // errors and waits for someone to call stop(). 00080 virtual void run(); 00081 00082 private: 00083 00084 // implementation note: FSM actions are private so that the derived class 00085 // can re-implement them but cannot call them. 00086 00089 virtual void initialise() {}; 00090 00093 virtual void work() {}; 00094 00097 virtual void finalise() {}; 00098 00099 // this private function is not virtual! 00100 // it's part of internal implementation. 00101 // implements the state machine. 00102 void protectedRun(); 00103 00104 gbxutilacfr::Tracer& tracer_; 00105 gbxutilacfr::Status& status_; 00106 gbxutilacfr::SubHealth health_; 00107 }; 00109 typedef IceUtil::Handle<SubsystemThread> SubsystemThreadPtr; 00110 00111 } 00112 00113 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)