00001 /*========================================================================= 00002 00003 Program: OpenIGTLink Library 00004 Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink2_beta/Source/igtlSensorMessage.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 __igtlSensorMessage_h 00018 #define __igtlSensorMessage_h 00019 00020 #include <string> 00021 00022 #include "igtlObject.h" 00023 #include "igtlMath.h" 00024 #include "igtlMessageBase.h" 00025 #include "igtlTypes.h" 00026 00027 #include "igtlUnit.h" 00028 00029 namespace igtl 00030 { 00031 00032 class IGTLCommon_EXPORT SensorMessage: public MessageBase 00033 { 00034 public: 00035 typedef SensorMessage Self; 00036 typedef MessageBase Superclass; 00037 typedef SmartPointer<Self> Pointer; 00038 typedef SmartPointer<const Self> ConstPointer; 00039 00040 igtlTypeMacro(igtl::SensorMessage, igtl::MessageBase); 00041 igtlNewMacro(igtl::SensorMessage); 00042 00043 public: 00044 00045 int SetLength(unsigned int n); 00046 unsigned int GetLength(); 00047 00048 //int SetStatus(int i); 00049 int SetUnit(igtlUnit unit); 00050 int SetUnit(igtl::Unit * unit); 00051 igtlUnit GetUnit(); 00052 int GetUnit(igtl::Unit * unit); 00053 00054 int SetValue(igtlFloat64 * data); // Set sensor values from array of 64-bit floating data 00055 int SetValue(unsigned int i, igtlFloat64 value); // Set i-th sensor value 00056 igtlFloat64 GetValue(unsigned int i); // Get i-th sensor value 00057 00058 protected: 00059 SensorMessage(); 00060 ~SensorMessage(); 00061 00062 protected: 00063 00064 virtual int GetBodyPackSize(); 00065 virtual int PackBody(); 00066 virtual int UnpackBody(); 00067 00068 igtlUint8 m_Length; // Length of sensor array 00069 igtlUint8 m_Status; // Sensor status (Reserved) 00070 igtlUnit m_Unit; // Unit (generated by igtl::Unit::Pack()) 00071 00072 std::vector<igtlFloat64> m_Array; 00073 00074 }; 00075 00076 00077 } // namespace igtl 00078 00079 #endif // _igtlSensorMessage_h 00080 00081 00082