00001 /*========================================================================= 00002 00003 Program: OpenIGTLink Library 00004 Module: $HeadURL: $ 00005 Language: C 00006 Date: $Date: 2010-11-23 14:47:40 -0500 (Tue, 23 Nov 2010) $ 00007 Version: $Revision: 6958 $ 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 __IGTL_STRING_H 00018 #define __IGTL_STRING_H 00019 00020 #include "igtl_win32header.h" 00021 #include "igtl_util.h" 00022 #include "igtl_types.h" 00023 #include "igtl_win32header.h" 00024 00025 #define IGTL_STRING_HEADER_SIZE 4 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 #pragma pack(1) /* For 1-byte boundary in memroy */ 00032 00033 typedef struct { 00034 igtl_uint16 encoding; /* Character encoding type as MIBenum value (defined by IANA). Default=3. */ 00035 /* Please refer http://www.iana.org/assignments/character-sets for detail */ 00036 igtl_uint16 length; /* Length of string */ 00037 } igtl_string_header; 00038 00039 #pragma pack() 00040 00041 /* 00042 * String data size 00043 * 00044 * This function calculates size of the pixel array, which will be 00045 * transferred with the specified header. 00046 */ 00047 00048 igtl_uint32 igtl_export igtl_string_get_string_length(igtl_string_header * header); 00049 00050 /* 00051 * Byte order conversion 00052 * 00053 * This function converts endianness from host byte order to network byte order, 00054 * or vice versa. 00055 * NOTE: It is developer's responsibility to have the string body with BOM 00056 * (byte order mark) or in big endian ordrer. 00057 */ 00058 00059 void igtl_export igtl_string_convert_byte_order(igtl_string_header * header); 00060 00061 /* 00062 * CRC calculation 00063 * 00064 * This function calculates CRC of image data body including header 00065 * and array of pixel data. 00066 * 00067 */ 00068 00069 igtl_uint64 igtl_export igtl_string_get_crc(igtl_string_header * header, void* string); 00070 00071 #ifdef __cplusplus 00072 } 00073 #endif 00074 00075 #endif /* __IGTL_STRING_H */ 00076 00077 00078