Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlPositionMessage.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: The OpenIGTLink Library
4 Language: C++
5 Web page: http://openigtlink.org/
6
7 Copyright (c) Insight Software Consortium. All rights reserved.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notices for more information.
12
13=========================================================================*/
14
15#ifndef __igtlPositionMessage_h
16#define __igtlPositionMessage_h
17
18#include "igtlObject.h"
19#include "igtlMath.h"
20#include "igtlMessageBase.h"
21#include "igtlTypes.h"
22
23namespace igtl
24{
25
33{
34public:
35
40 enum {
41 POSITION_ONLY = 1,
44 };
45
46public:
51
54
55public:
56
58 void Init();
59
61 void SetPackType(int t); /* POSITION_ONLY / WITH_QUATERNION3 / ALL */
62
64 int GetPackType() { return m_PackType; };
65
68
70 void SetPosition(const float* pos);
71
73 void SetPosition(float x, float y, float z);
74
76 void SetQuaternion(const float* quat);
77
79 void SetQuaternion(float ox, float oy, float oz, float w);
80
82 void GetPosition(float* pos);
83
85 void GetPosition(float* x, float* y, float* z);
86
88 void GetQuaternion(float* quat);
89
91 void GetQuaternion(float* ox, float* oy, float* oz, float* w);
92
94 // TODO: Is this needed or integrated in igtlMessageBase?
95 virtual int SetMessageHeader(const MessageHeader* mb);
96
97protected:
100
101protected:
102
103 virtual int GetBodyPackSize();
104 virtual int PackBody();
105 virtual int UnpackBody();
106
108 igtlInt32 m_PackType;
109
111 igtlFloat32 m_Position[3];
112
114 igtlFloat32 m_Quaternion[4];
115
116};
117
118
119} // namespace igtl
120
121#endif // _igtlPositionMessage_h
122
123
124
int GetPackType()
Gets the type of the pack. The returned value must be either POSITION_ONLY, WITH_QUATERNION3,...
SmartPointer< Self > Pointer
virtual int PackBody()
Packs (serialize) the body. Must be implemented in a child class.
igtlNewMacro(igtl::PositionMessage)
void GetQuaternion(float *ox, float *oy, float *oz, float *w)
Gets the quaternion. The function substitutes the elements of the quaternion in 'ox',...
void SetPosition(const float *pos)
Sets the position by 3-element array of x, y, and z coordinates.
virtual int GetBodyPackSize()
Gets the size of the serialized body.
void SetQuaternion(const float *quat)
Sets the quaternion by 4-element array.
igtlTypeMacro(igtl::PositionMessage, igtl::MessageBase)
void GetQuaternion(float *quat)
Gets the quaternion. The function substitutes the array of elements of the quaternion in 'quat'.
virtual int UnpackBody()
Unpacks (deserialize) the body. Must be implemented in a child class.
int SetPackTypeByBodySize(int s)
Specifies the pack type by body size (in most case obtained from general header).
void SetQuaternion(float ox, float oy, float oz, float w)
Sets the quaternion by elements of the quaternion (ox, oy, oz and w).
void Init()
Initializes the class.
virtual int SetMessageHeader(const MessageHeader *mb)
Sets the message header.
void SetPackType(int t)
Sets the type of the pack. 't' must be either POSITION_ONLY, WITH_QUATERNION3, or ALL.
SmartPointer< const Self > ConstPointer
void GetPosition(float *pos)
Gets the position. The function substitutes 3-element array of x, y and z coordinates in 'pos'.
igtlInt32 m_PackType
The type of message formats (either POSITION_ONLY, WITH_QUATERNION3, or ALL).
void SetPosition(float x, float y, float z)
Sets the position by x, y, and z coordinates.
void GetPosition(float *x, float *y, float *z)
Gets the position. The function substitutes the coordinates in 'x', 'y', and 'z'.
Implements transparent reference counting.
#define IGTLCommon_EXPORT
The "igtl" namespace contains all OpenIGTLink classes. There are several nested namespaces within the...
class MessageBase MessageHeader

Generated for OpenIGTLink by Doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2012