ITK Function Reference
(V10000.1.0.60_20160308.00)
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
tccore
method.h
Go to the documentation of this file.
1
/*==============================================================================
2
Copyright (c) 2003-2005 UGS Corporation
3
Unpublished - All Rights Reserved
4
==============================================================================*/
5
12
/* */
13
14
#ifndef METHOD_H
15
#define METHOD_H
16
17
#include <
unidefs.h
>
18
#include <
tc/emh.h
>
19
#include <
tc/tc_startup.h
>
20
#include <
tc/tc_arguments.h
>
21
#include <
fclasses/tc_stdarg.h
>
22
#include <tccore/libtccore_exports.h>
23
44
typedef
struct
METHOD_id_s
45
{
46
int
reserved
;
47
void
*
id
;
48
}
METHOD_id_t
;
49
53
typedef
struct
METHOD_message_s
54
{
55
tag_t
object
;
56
METHOD_id_t
method
;
57
void
*
system_data
;
58
TC_argument_list_t
*
user_args
;
59
tag_t
object_tag
;
60
const
char
*
prop_name
;
61
void
*
imanProp
;
62
void
*
propDesc
;
63
}
METHOD_message_t
;
64
71
typedef
int (*
METHOD_function_t
)(
72
METHOD_message_t
*,
73
va_list
74
);
75
76
typedef
enum
METHOD_action_type_e
77
{
78
METHOD_pre_action_type
,
79
METHOD_post_action_type
80
}
METHOD_action_type_t
;
81
91
#ifdef __cplusplus
92
extern
"C"
{
93
#endif
94
106
extern
TCCORE_API
int
METHOD_get_message_id
(
107
const
char
* msg_name,
109
int
* msg_id
110
);
111
112
extern
TCCORE_API
int
METHOD_get_message_name
(
int
msg_id,
char
**method_name );
113
114
extern
TCCORE_API
int
METHOD_get_prop_message_name
(
int
msg_id,
const
char
*property_name,
char
**method_name );
115
116
#ifdef __cplusplus
117
}
118
#endif
119
125
#define METHOD_SETUP_MESSAGE(msg_name,msg_id) \
126
static int (msg_id) = 0; \
127
if ( (msg_id) == 0 ) \
128
{ \
129
int setup_err = METHOD_get_message_id( (msg_name), &(msg_id) ); \
130
if ( setup_err != ITK_ok ) \
131
{ \
132
TC_write_syslog ("No method defined for message name '%s'\n", msg_name); \
133
EMH_store_error( EMH_severity_error, setup_err ); \
134
return setup_err; \
135
} \
136
}
137
145
#ifdef __cplusplus
146
extern
"C"
{
147
#endif
148
158
extern
TCCORE_API
int
METHOD_attach_action
(
159
const
char
* typeName,
160
const
char
* methodName,
161
int
prePostFlag,
162
METHOD_function_t
fn,
163
TC_argument_list_t
* userData
165
);
166
174
extern
TCCORE_API
int
METHOD_register_method
(
175
const
char
* type_name,
176
const
char
* msg_name,
177
METHOD_function_t
base_action,
178
TC_argument_list_t
* user_args,
180
METHOD_id_t
* method_id
182
);
183
189
extern
TCCORE_API
int
METHOD_add_pre_condition
(
190
METHOD_id_t
method_id,
191
METHOD_function_t
pre_condition_handler,
192
TC_argument_list_t
* user_args
194
);
195
200
extern
TCCORE_API
int
METHOD_add_action
(
201
METHOD_id_t
method_id,
202
METHOD_action_type_t
action_type,
203
METHOD_function_t
action_handler,
204
TC_argument_list_t
* user_args
206
);
207
216
extern
TCCORE_API
int
METHOD_add_action2
(
217
METHOD_id_t
method_id,
218
METHOD_action_type_t
action_type,
219
METHOD_function_t
action_handler,
220
TC_argument_list_t
* user_args,
222
logical
auto_dispatched
223
);
224
243
extern
TCCORE_API
int
METHOD_find_method
(
244
const
char
* type_name,
245
const
char
* msg_name,
246
METHOD_id_t
* method_id
247
);
248
249
254
extern
TCCORE_API
int
METHOD_find_dynamic_method
(
255
const
char
* type_name,
256
const
char
* msg_name,
257
METHOD_id_t
* method_id
258
);
259
271
extern
TCCORE_API
int
METHOD_execute
(
272
tag_t
object
,
273
int
msg_id,
274
...
275
);
276
284
extern
TCCORE_API
int
METHOD_execute_using
(
285
tag_t
object
,
288
tag_t
tc_type,
289
int
msg_id,
290
...
291
);
292
299
extern
TCCORE_API
int
METHOD_check_pre_conditions
(
300
tag_t
object
,
301
int
msg_id,
302
...
303
);
304
314
extern
TCCORE_API
int
METHOD_check_pre_conditions_message
(
315
tag_t
object
,
316
int
msg_id,
317
...
318
);
319
323
extern
TCCORE_API
int
METHOD_call_pre_action
(
324
tag_t
object
,
325
int
msg_id,
326
...
327
);
328
338
extern
TCCORE_API
int
METHOD_call_pre_action_message
(
339
tag_t
object
,
340
int
msg_id,
341
...
342
);
343
351
extern
TCCORE_API
int
METHOD_register_prop_method
(
352
const
char
* type_name,
354
const
char
* property_name,
355
const
char
* msg_name,
356
METHOD_function_t
base_action,
357
TC_argument_list_t
* user_args,
359
METHOD_id_t
* method_id
361
);
362
367
extern
TCCORE_API
int
METHOD_find_prop_method
(
368
const
char
* type_name,
369
const
char
* property_name,
370
const
char
* msg_name,
371
METHOD_id_t
* method_id
372
);
373
385
extern
TCCORE_API
int
METHOD_get_prop_message_id
(
386
const
char
* msg_name,
388
const
char
* property_name,
389
int
* msg_id
390
);
391
396
extern
TCCORE_API
int
METHOD_merge_prop_message_id
(
397
int
merge_msg_id,
398
const
char
* property_name,
399
int
* msg_id
400
);
401
402
extern
TCCORE_API
int
METHOD__is_prop_registered
(
403
tag_t
objTag,
404
const
char
* methodName,
405
const
char
* propName,
406
logical
* registered
407
);
408
412
extern
TCCORE_API
int
METHOD_call_post_action
413
(
tag_t
object
,
414
int
msg_id,
415
...
416
);
417
427
extern
TCCORE_API
int
METHOD_call_post_action_message
428
(
tag_t
object
,
429
int
msg_id,
430
...
431
);
432
433
extern
TCCORE_API
int
METHOD__register_operationFn
(
434
const
char
* type_name,
435
const
char
* msg_name,
436
METHOD_function_t
base_action,
437
TC_argument_list_t
* user_args,
439
METHOD_id_t
* method_id
441
);
442
443
extern
TCCORE_API
int
METHOD__register_prop_operationFn
(
444
const
char
* type_name,
446
const
char
* property_name,
447
const
char
* msg_name,
448
METHOD_function_t
base_action,
449
TC_argument_list_t
* user_args,
451
METHOD_id_t
* method_id
453
);
454
468
extern
TCCORE_API
int
METHOD_get_message_property_descriptor
(
469
const
METHOD_message_t
* message,
470
tag_t
* property_descriptor
471
);
472
473
#ifdef __cplusplus
474
}
475
#endif
476
480
#define METHOD_SETUP_PROP_MESSAGE(msg_name,property_name,msg_id) \
481
static int (msg_id) = 0; \
482
if ( (msg_id) == 0 ) \
483
{ \
484
int setup_err = METHOD_get_prop_message_id( (msg_name), (property_name), &(msg_id) ); \
485
if ( setup_err != ITK_ok ) return setup_err; \
486
else if ((msg_id) == 0) \
487
{ TC_write_syslog ("File %s; Line # %d; no message '%s' registered for property '%s'", \
488
__FILE__, __LINE__, (msg_name), (property_name)); \
489
return ITK_general_user_error; \
490
} \
491
} \
492
else \
493
{ \
494
int setup_err = METHOD_merge_prop_message_id( (msg_id), (property_name), &(msg_id) ); \
495
if ( setup_err != ITK_ok ) return setup_err; \
496
}
497
498
#define METHOD_PROP_MESSAGE_OBJECT(msg, objectTag) (objectTag) = (msg)->object_tag;
499
500
#define METHOD_PROP_MESSAGE_PROP_NAME(msg, propName) (propName) = (msg)->prop_name;
501
504
#include <tccore/libtccore_undef.h>
505
#endif