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.
00001 /*=========================================================================
00002 
00003   Program:   Open IGT Link Library
00004   Module:    $HeadURL: http://svn.na-mic.org/NAMICSandBox/trunk/OpenIGTLink/Source/igtlMessageHeader.h $
00005   Language:  C++
00006   Date:      $Date: 2008-12-22 19:05:42 -0500 (Mon, 22 Dec 2008) $
00007   Version:   $Revision: 3460 $
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 __igtlMessageHeader_h
00018 #define __igtlMessageHeader_h
00019 
00020 //-------------------------------------------------------------------------
00021 // The MessageHeader class is used to receive and parse general headers
00022 // to prepare for recieving body data. The class is currently just the alias
00023 // of MessageBase class. Please refer igtlMessageBase.h for more details and
00024 // the implementation of the class.
00025 //
00026 // The following is the typical unpacking (deserialization) prcedures
00027 // using igtl::MessssageHeader class:
00028 //
00029 //     // Create instance and set Device Name
00030 //     igtl::MessageBase::Pointer headerMsg;
00031 //     headerMsg = igtl::MessageBase::New();
00032 //
00033 //     // Initialize receive buffer
00034 //     // Set up memory area to and receive the general header and unpack
00035 //     headerMsg->InitPack();
00036 //
00037 //     socket->Receive(headerMsg->GetPackPointer(), headerMsg->GetPackSize());
00038 //     headerMsg->Unpack();
00039 //
00040 //     // Check data type string
00041 //     if (strcmp(headerMsg->GetDeviceType(), "TRANSFORM"))
00042 //       {
00043 //         igtl::TransformMessage::Pointer transMsg;
00044 //         transMsg = igtl::TransformMessage::New();
00045 //         transMsg->SetMessageHeader(headerMsg);
00046 //         transMsg->AllocatePack();
00047 //
00048 //         // Receive transform data from the socket//
00049 //         socket->Receive(transMsg->GetPackBodyPointer(), transMsg->GetPackBodySize());
00050 //
00051 //         // Deserialize the transform data
00052 //         transMsg->Unpack();
00053 //
00054 //         // Retrive the transform data
00055 //         igtl::Matrix4x4 matrix;
00056 //         transMsg->GetMatrix(matrix);
00057 //
00058 //         ....
00059 //
00060 //       }
00061 //     else if (strcmp(headerMsg->GetDeviceType(), "IMAGE"))
00062 //       {
00063 //         igtl::ImageMessage::Pointer imageMsg;
00064 //         imageMsg = igtl::ImageMessage::New();
00065 //         transMsg->SetMessageHeader(headerMsg);
00066 //         imageMsg->AllocatePack();
00067 //         socket->Receive(imageMsg->GetPackBodyPointer(), imageMsg->GetPackBodySize());
00068 //         imageMsg->Unpack();
00069 //       }
00070 //     else if (...)
00071 //       {
00072 //          ...
00073 //       }
00074 //
00075 
00076 
00077 namespace igtl
00078 {
00079 
00080   class MessageBase;
00081   typedef class MessageBase MessageHeader;
00082 
00083 };
00084 
00085 #include "igtlMessageBase.h"
00086 
00087 
00088 #endif //__igtlMessageHeader_h
00089 

Generated at Sat May 9 04:47:23 2009 for OpenIGTLink by doxygen 1.5.9 written by Dimitri van Heesch, © 1997-2000