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

SourceForge.net Logo
Project
Download
Mailing lists

 

         

hydrolibs/hydroiceutil/subsystemthread.h

00001 /*
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 HYDROICEUTIL_SUBSYSTEM_THREAD_H
00012 #define HYDROICEUTIL_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 hydroiceutil {
00020 
00054 class SubsystemThread : public gbxiceutilacfr::Thread
00055 {
00056 public:
00058     SubsystemThread( gbxutilacfr::Tracer& tracer,
00059                      gbxutilacfr::Status& status,
00060                      const std::string& subsysName="SubsystemThread",
00061                      double maxHeartbeatIntervalSec=-1.0 );
00062 
00063     ~SubsystemThread();
00064 
00066     gbxutilacfr::Tracer& tracer() { return tracer_; };
00067 
00069     void setMaxHeartbeatInterval( double interval );
00070 
00072     void setSubsystemType( gbxutilacfr::SubsystemType type );
00073 
00075     std::string subsysName() const;
00076 
00078     gbxutilacfr::SubHealth& health() { return health_; };
00079 
00080     // from IceUtil::Thread
00081     // This implementation calls protectedRun(), catches all possible exceptions, prints out
00082     // errors and waits for someone to call stop().
00083     virtual void run();
00084 
00085 private:
00086 
00087     // implementation note: FSM actions are private so that the derived class
00088     // can re-implement them but cannot call them.
00089 
00092     virtual void initialise() {};
00093 
00096     virtual void work() {};
00097 
00100     virtual void finalise() {};
00101 
00102     // this private function is not virtual!
00103     // it's part of internal implementation.
00104     // implements the state machine.
00105     void protectedRun();
00106 
00107     gbxutilacfr::Tracer& tracer_;
00108     gbxutilacfr::Status& status_;
00109     gbxutilacfr::SubHealth health_;
00110 };
00112 typedef IceUtil::Handle<SubsystemThread> SubsystemThreadPtr;
00113 
00114 }
00115 
00116 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5