IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkCommunication.h,v $ 00005 Language: C++ 00006 Date: $Date: 2011-01-18 21:40:16 $ 00007 Version: $Revision: 1.24 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 } // end of namespace igstk 00109 00110 #endif //__igstk_Communication_h_