00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __igstkCommunication_h
00019 #define __igstkCommunication_h
00020
00021
00022 #include "igstkObject.h"
00023 #include "igstkMacros.h"
00024 #include "igstkStateMachine.h"
00025
00026
00027 namespace igstk
00028 {
00037 class Communication : public Object
00038 {
00039
00040 public:
00041
00043 igstkStandardClassTraitsMacro( Communication, Object )
00044
00045 public:
00046
00047 typedef enum
00048 {
00049 FAILURE=0,
00050 SUCCESS=1,
00051 TIMEOUT=2
00052 } ResultType;
00053
00056 virtual ResultType OpenCommunication( void );
00057
00059 virtual ResultType CloseCommunication( void );
00060
00065 igstkSetMacro( TimeoutPeriod, unsigned int );
00066 igstkGetMacro( TimeoutPeriod, unsigned int );
00067
00071 igstkSetMacro( ReadTerminationCharacter, char );
00072 igstkGetMacro( ReadTerminationCharacter, char );
00073
00076 igstkSetMacro( UseReadTerminationCharacter, bool );
00077 igstkGetMacro( UseReadTerminationCharacter, bool );
00078
00080 virtual ResultType Write( const char *data,
00081 unsigned int numberOfBytes ) { return SUCCESS; }
00082
00084 virtual ResultType Read( char *data,
00085 unsigned int numberOfBytes,
00086 unsigned int &bytesRead ) { return SUCCESS; }
00087
00088 protected:
00089
00092 Communication( void );
00093
00094 virtual ~Communication( void );
00095
00097 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
00098
00099 private:
00100
00101 unsigned int m_TimeoutPeriod;
00102
00103 char m_ReadTerminationCharacter;
00104
00105 bool m_UseReadTerminationCharacter;
00106 };
00107
00108 }
00109
00110 #endif //__igstk_Communication_h_