00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __RULBUSINTERFACE_H
00026 #define __RULBUSINTERFACE_H
00027
00028 #ifndef __COMMON_H
00029 #include "Common.h"
00030 #endif
00031
00032 #include "Singleton.h"
00033 #include "RulbusInterfaceFactory.h"
00034
00035 namespace WindowsUtils
00036 {
00037 DECLARE_CLASS( Semaphore );
00038 }
00039
00040 namespace Rulbus
00041 {
00042 DECLARE_CLASS( TheRulbusInterface );
00043
00072 class TheRulbusInterface : public Singleton<TheRulbusInterface>
00073 {
00074 friend class Singleton<TheRulbusInterface>;
00075
00076 public:
00079
00080 static TheRulbusInterfaceRef instance();
00081
00085
00086 int getByte( int rack, int offset ) const;
00087 int putByte( int rack, int offset, int byte ) const;
00088
00092
00093 virtual bool invariant() const;
00094
00098
00099 virtual bool printOn ( std::ostream& stream ) const = 0;
00100
00102
00103 protected:
00106
00107 TheRulbusInterface();
00108 ~TheRulbusInterface();
00109
00112
00113 virtual int getReg (int offset ) const = 0;
00114 virtual int putReg (int offset, int byte) const = 0;
00115
00117
00118 private:
00119 WindowsUtils::SemaphorePtr s;
00120
00121 public:
00122 static const int ANY_RACK = 0xF;
00123 };
00124
00129 inline TheRulbusInterfaceRef TheRulbusInterface::instance()
00130 {
00131 if ( 0 == theInstance )
00132 {
00133 theInstance = RulbusInterfaceFactory::createInterface();
00134 }
00135
00136 return *theInstance;
00137 }
00138
00143 inline bool TheRulbusInterface::invariant() const
00144 {
00145 return true;
00146 }
00147
00148 }
00149
00150 #endif // __RULBUSINTERFACE_H
00151
00152
00153
00154