Main Page
Namespace List
Class Hierarchy
Alphabetical List
Compound List
File List
Namespace Members
Compound Members
File Members
Source
igtlutil
igtl_bind.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: The OpenIGTLink Library
4
Module: $HeadURL: $
5
Language: C
6
Date: $Date: 2010-11-23 14:47:40 -0500 (Tue, 23 Nov 2010) $
7
Version: $Revision: 6958 $
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 __IGTL_BIND_H
18
#define __IGTL_BIND_H
19
20
#include "
igtl_win32header.h
"
21
#include "
igtl_header.h
"
22
#include "
igtl_util.h
"
23
#include "
igtl_types.h
"
24
#include "
igtl_win32header.h
"
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
29
30
31
/*
32
* The igtl_bind_info structure holds information about a child message in an OpenIGTLink
33
* BIND message. The structure is used for functions defined in igtl_bind.h
34
*/
35
36
typedef
struct
{
37
char
type[
IGTL_HEADER_TYPE_SIZE
+1];
/* Data type (OpenIGTLink Device Type string) */
38
char
name[
IGTL_HEADER_NAME_SIZE
+1];
/* Device name */
39
igtl_uint64
size
;
/* Data size */
40
void
*
ptr
;
/* Pointer to the child message */
41
}
igtl_bind_child_info
;
42
43
typedef
struct
{
44
igtl_uint16
ncmessages
;
/* Number of child message */
45
igtl_bind_child_info
*
child_info_array
;
/* Array of igtl_bind_child_info */
46
igtl_uint64
resol
;
/* Time resolution (used for STT_BIND) */
47
igtl_uint8
request_all
;
/* Flag to request all available data
48
(used for GET_BIND and STT_BIND) */
49
igtl_uint8
status
;
/* Status for RTS message */
50
}
igtl_bind_info
;
51
52
53
/*
54
* Initialize igtl_bind_info
55
*/
56
void
igtl_export
igtl_bind_init_info
(
igtl_bind_info
* bind_info);
57
58
/*
59
* Allocate / free an array of igtl_bind_info structure
60
*
61
* Allocate / free an array of igtl_bind_child_info in bind_info with length of 'ncmessages.'
62
* Return 1 if the array is successfully allocated/freed
63
*/
64
65
int
igtl_export
igtl_bind_alloc_info
(
igtl_bind_info
* bind_info, igtl_uint16 ncmessages);
66
int
igtl_export
igtl_bind_free_info
(
igtl_bind_info
* bind_info);
67
68
/*
69
* Unpack BIND message
70
*
71
* Extract information about child messages in a byte array of BIND messages and store
72
* it in a igtl_bind_info structure. 'type' argument specifies a message type prefix
73
* (none, GET_, STT_, STP_ or RTS_) by IGTL_TYPE_PREFIX_* macro.
74
* Returns 1 if success, otherwise 0.
75
*/
76
77
int
igtl_export
igtl_bind_unpack
(
int
type,
void
* byte_array,
igtl_bind_info
* info, igtl_uint64 size);
78
79
/*
80
* Pack BIND message
81
*
82
* Convert an igtl_bind_info structure to a byte array.
83
* 'byte_array' should be allocated prior to calling igtl_bind_pack() with memory size
84
* calculated by igtl_bind_get_size(). 'type' argument specifies a message type prefix
85
* (none, GET_, STT_, STP_ or RTS_) by IGTL_TYPE_PREFIX_* macro.
86
* Returns 1 if success, otherwise 0.
87
*/
88
89
int
igtl_export
igtl_bind_pack
(
igtl_bind_info
* info,
void
* byte_array,
int
type);
90
91
/*
92
* Bind data size
93
*
94
* igtl_bind_get_size() calculates the size of bind header, consisting of
95
* BIND hearder section (including number of child messages) and
96
* name table section based on a igtl_bind_header.
97
* The size returned from this function does not include size of child message data.
98
* 'type' argument specifies a message type prefix
99
* (none, GET_, STT_, STP_ or RTS_) by IGTL_TYPE_PREFIX_* macro.
100
*/
101
102
igtl_uint64
igtl_export
igtl_bind_get_size
(
igtl_bind_info
* info,
int
type);
103
104
105
/*
106
* CRC calculation
107
*
108
* This function calculates CRC of BIND message. Note that 'info' is used only for
109
* getting size of the message.
110
*
111
*/
112
113
igtl_uint64
igtl_export
igtl_bind_get_crc
(
igtl_bind_info
* info,
int
type,
void
* bind_message);
114
115
#ifdef __cplusplus
116
}
117
#endif
118
119
#endif
/* __IGTL_BIND_H */
120
121
122
Generated at Thu Mar 20 2014 16:32:06 for OpenIGTLink by
1.8.1.2 written by
Dimitri van Heesch
, © 1997-2000