CCAFFEINE  0.8.8
GoThreadComponent.h
00001 #ifndef __GOTHREADCOMPONENT_HH__
00002 #define __GOTHREADCOMPONENT_HH__
00003 
00004 
00010 class GoThreadComponent : public virtual classic::gov::cca::Component {
00011 
00012  private:
00013 
00014 
00015   classic::gov::cca::Services *svc;
00016   classic::gov::cca::StringConsumerPort *out;
00017 
00018   // thread management
00019   class GoPort_go : public virtual classic::gov::cca::GoPort {
00020   private:
00021 
00022     GoThreadComponent *  myGoThreadComponent;
00023 
00024   public:
00025     /*
00026      * We must access the state of the GoThreadComponent
00027      * to figure out whether the Go is running or not.
00028      */
00029     GoPort_go(GoThreadComponent * myGoThreadComponent);
00030     virtual ~GoPort_go(){}
00031     virtual int go();
00032   };
00033 
00034   class GoPort_stop : public virtual classic::gov::cca::GoPort {
00035   private:
00036 
00037     GoThreadComponent *  myGoThreadComponent;
00038 
00039   public:
00044     GoPort_stop(GoThreadComponent * myGoThreadComponent);
00045     virtual ~GoPort_stop(){}
00051     virtual int go();
00052   };
00053 
00054   int isRunning;
00055   GoPort_go * go;
00056   GoPort_stop * stop;
00057 
00058  public:
00059 
00060   GoThreadComponent();
00061   virtual ~GoThreadComponent();
00062 
00063 
00064   virtual void setServices(classic::gov::cca::Services *cc);
00065 #if (defined(__GNUC__)&&(__GNUC__<3))
00066   friend class GoPort_go ;
00067   friend class GoPort_stop ;
00068 #endif
00069 };
00070 
00071 
00072 #endif