Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  
igtlMessageHeader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Open IGT Link Library
4  Module: $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlMessageHeader.h $
5  Language: C++
6  Date: $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
7  Version: $Revision: 3460 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notices for more information.
14 
15 =========================================================================*/
16 
17 #ifndef __igtlMessageHeader_h
18 #define __igtlMessageHeader_h
19 
20 //-------------------------------------------------------------------------
21 // The MessageHeader class is used to receive and parse general headers
22 // to prepare for recieving body data. The class is currently just the alias
23 // of MessageBase class. Please refer igtlMessageBase.h for more details and
24 // the implementation of the class.
25 //
26 // The following is the typical unpacking (deserialization) prcedures
27 // using igtl::MessssageHeader class:
28 //
29 // // Create instance and set Device Name
30 // igtl::MessageBase::Pointer headerMsg;
31 // headerMsg = igtl::MessageBase::New();
32 //
33 // // Initialize receive buffer
34 // // Set up memory area to and receive the general header and unpack
35 // headerMsg->InitPack();
36 //
37 // socket->Receive(headerMsg->GetPackPointer(), headerMsg->GetPackSize());
38 // headerMsg->Unpack();
39 //
40 // // Check data type string
41 // if (strcmp(headerMsg->GetDeviceType(), "TRANSFORM"))
42 // {
43 // igtl::TransformMessage::Pointer transMsg;
44 // transMsg = igtl::TransformMessage::New();
45 // transMsg->SetMessageHeader(headerMsg);
46 // transMsg->AllocatePack();
47 //
48 // // Receive transform data from the socket//
49 // socket->Receive(transMsg->GetPackBodyPointer(), transMsg->GetPackBodySize());
50 //
51 // // Deserialize the transform data
52 // transMsg->Unpack();
53 //
54 // // Retrive the transform data
55 // igtl::Matrix4x4 matrix;
56 // transMsg->GetMatrix(matrix);
57 //
58 // ....
59 //
60 // }
61 // else if (strcmp(headerMsg->GetDeviceType(), "IMAGE"))
62 // {
63 // igtl::ImageMessage::Pointer imageMsg;
64 // imageMsg = igtl::ImageMessage::New();
65 // transMsg->SetMessageHeader(headerMsg);
66 // imageMsg->AllocatePack();
67 // socket->Receive(imageMsg->GetPackBodyPointer(), imageMsg->GetPackBodySize());
68 // imageMsg->Unpack();
69 // }
70 // else if (...)
71 // {
72 // ...
73 // }
74 //
75 
76 
77 namespace igtl
78 {
79 
80  class MessageBase;
81  typedef class MessageBase MessageHeader;
82 
83 };
84 
85 #include "igtlMessageBase.h"
86 
87 
88 #endif //__igtlMessageHeader_h
89 

Generated at Thu Mar 20 2014 16:32:06 for OpenIGTLink by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2000