00001 /*========================================================================= 00002 00003 Program: The OpenIGTLink Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlStringMessage.h $ 00005 Language: C++ 00006 Date: $Date: 2009-12-16 23:58:02 -0500 (Wed, 16 Dec 2009) $ 00007 Version: $Revision: 5466 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notices for more information. 00014 00015 =========================================================================*/ 00016 00017 #ifndef __igtlStringMessage_h 00018 #define __igtlStringMessage_h 00019 00020 #include <string> 00021 00022 #include "igtlObject.h" 00023 #include "igtlMath.h" 00024 #include "igtlMessageBase.h" 00025 #include "igtlTypes.h" 00026 00027 #define IGTL_STRING_MESSAGE_DEFAULT_ENCODING 3 /* Default encoding -- ANSI-X3.5-1968 */ 00028 00029 namespace igtl 00030 { 00031 00032 class IGTLCommon_EXPORT StringMessage: public MessageBase 00033 { 00034 public: 00035 typedef StringMessage Self; 00036 typedef MessageBase Superclass; 00037 typedef SmartPointer<Self> Pointer; 00038 typedef SmartPointer<const Self> ConstPointer; 00039 00040 igtlTypeMacro(igtl::StringMessage, igtl::MessageBase); 00041 igtlNewMacro(igtl::StringMessage); 00042 00043 public: 00044 00045 int SetString(const char* string); 00046 int SetString(std::string & string); 00047 int SetEncoding(igtlUint16 enc); 00048 00049 const char* GetString(); 00050 igtlUint16 GetEncoding(); 00051 00052 protected: 00053 StringMessage(); 00054 ~StringMessage(); 00055 00056 protected: 00057 00058 virtual int GetBodyPackSize(); 00059 virtual int PackBody(); 00060 virtual int UnpackBody(); 00061 00062 igtlUint16 m_Encoding; 00063 00064 //BTX 00065 std::string m_String; 00066 //ETX 00067 00068 }; 00069 00070 00071 } // namespace igtl 00072 00073 #endif // _igtlStringMessage_h 00074 00075 00076 00077