Direct.hh

00001 /*
00002 ** Stechec project is free software; you can redistribute it and/or modify
00003 ** it under the terms of the GNU General Public License as published by
00004 ** the Free Software Foundation; either version 2 of the License, or
00005 ** (at your option) any later version.
00006 **
00007 ** The complete GNU General Public Licence Notice can be found as the
00008 ** `NOTICE' file in the root directory.
00009 **
00010 ** Copyright (C) 2006, 2007 Prologin
00011 */
00012 
00013 #ifndef DIRECT_HH_
00014 # define DIRECT_HH_
00015 
00016 # include "Cx.hh"
00017 
00019 enum eCxWhoIAm {
00020   CXD_IS_SERVER,
00021   CXD_IS_COACH1,
00022   CXD_IS_COACH2
00023 };
00024 
00026 class DirectCx : public Cx
00027 {
00028 public:
00029   DirectCx(eCxWhoIAm w);
00030   virtual ~DirectCx();
00031 
00032 protected:
00033   virtual bool pollInternal(int* timeout = 0);
00034   virtual int recvData(bool use_exception);
00035   virtual void sendData(unsigned char* data, unsigned size);
00036   
00037 private:
00038   void lock(bool lock_server);
00039   void unlock(bool unlock_server);
00040 
00041   eCxWhoIAm w_;
00042 
00043   static DirectCx* inst_client_[2];
00044   static DirectCx* inst_server_;
00045 };
00046 
00047 #endif /* !DIRECT_HH_ */

Generated on Sat Jun 23 16:07:23 2007 for Stechec/TBT by  doxygen 1.4.7