ITK Function Reference

(V10000.1.0.60_20160308.00)
tc_macros.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 TC_MACROS_H
15 #define TC_MACROS_H
16 
17 #include <tc/tc_startup.h>
18 #include <tc/emh.h>
19 #include <itk/mem.h>
20 #include <fclasses/tc_stdarg.h>
21 #include <fclasses/tc_string.h>
22 
33 #define DATE_IS_NULL(d1) \
34  ((d1.year == NULLDATE.year ) ? \
35  ((d1.month == NULLDATE.month) ? \
36  ((d1.day == NULLDATE.day ) ? \
37  ((d1.hour == NULLDATE.hour) ? \
38  ((d1.minute == NULLDATE.minute) ? \
39  ((d1.second == NULLDATE.second) ? 1 \
40  : 0) \
41  : 0) \
42  : 0) \
43  : 0) \
44  : 0) \
45  : 0)
46 
47 #define STRLEN(a) tc_strlen(a)
48 
49 #define STRCPY(a, b) tc_strcpy(a, b)
50 
51 #define STRNCPY(a,b,s) tc_strncpy(a, b, s)
52 
53 #define ITKCALL( argument ) \
54 { \
55  int retcode = argument; \
56  if ( retcode != ITK_ok ) { \
57  char* s; \
58  printf( " "#argument "\n" ); \
59  printf( " returns [%d]\n", retcode ); \
60  EMH_ask_error_text (retcode, &s); \
61  printf( " Teamcenter ERROR: [%s]\n", s); \
62  printf( " in file ["__FILE__"], line [%d]\n\n", __LINE__ ); \
63  if (s != 0) MEM_free (s); \
64  } \
65 }
66 
69 #define ITKCHECK(x) \
70 { \
71  if ( retCode == ITK_ok ) \
72  { \
73  if ( ( retCode = (x)) != ITK_ok ) \
74  { \
75  char *errstring = NULL; \
76  EMH_ask_error_text ( retCode, &errstring ); \
77  lprintf ( "+++ Error %d: %s\n", retCode , errstring ); \
78  if ( errstring != NULL ) SM_free ( errstring ); \
79  lprintf ( "Function %s: Line %d in %s\n ", #x, __LINE__, __FILE__); \
80  } \
81  } \
82 }
83 
84 #endif