ITK Function Reference

(12.1)
Modules | Data Structures | Macros | Typedefs | Functions
Integration Tool Kit

Modules

 As-Maintained
 
 Memory
 
 Product Configurator (CFG0)
 
 Next generation Classification foundation
 
 Diagramming Application
 
 Date
 
 Teamcenter String
 
 Boolean Solve (BSLV)
 
 Edit Context
 
 Image Compression
 
 Traversal Engine
 
 Lifecycle Interoperability Services (LIS) Factory Services ITKs
 
 Mechatronics User Exits
 
 BusinessObject (Metaframework)
 
 Object Import and Export (OBJIO)
 
 Partition User Exits
 
 Partition Template
 
 Publication
 
 Requirements
 
 Team Collaboration Integration APIs
 
 Advanced Product Lifecycle Management Services Configured Search
 
 APIs and data types for Service Forecasting module
 
 Teamcenter Volumes
 
 Distribution List
 
 Error Message Handler (EMH)
 
 Log Manager (LM)
 
 Preferences
 
 Print Using
 
 Teamcenter Arguments
 
 ITK Errors
 
 Teamcenter Macros
 
 Teamcenter Utility
 
 ID Creator
 
 WSOUIF Errors
 
 Application Object Module (AOM)
 
 Propagation Rules
 
 Teamcenter Messages
 
 Teamcenter Parameters
 
 Traversal Rules
 
 Text Server
 
 UI Configuration
 
 User Exits
 
 Visualization
 
 Transformer
 

Data Structures

struct  mdc_sblock
 

Macros

#define ITK_BATCH_TEXT_MODE   0
 
#define ITK_BATCH_TEXT_MODE   0
 
#define MDC_MAXARGS   5
 
#define PROTO(params)   params
 
#define SUCCESS   NULL
 
#define tags_equal(a, b)   ((a)==(b))
 

Typedefs

typedef struct mdc_sblockmdc_status_t
 

Functions

TC_API logical ITK__ask_managed_mode (void)
 
TC_API void ITK__convert_tag_to_uid (tag_t aTag, char **uid)
 
TC_API void ITK__convert_uid_to_tag (const char *uid, tag_t *aTag)
 
TCINIT_API void ITK__initialise_tc (int argc, char **argv)
 
TC_API void ITK__set_managed_mode (logical value)
 
TC_API char * ITK_ask_action (void)
 
TC_API char * ITK_ask_action_argument (const char *key)
 
TC_API int ITK_ask_argument_named_value (const char *argument, char **flag, char **value)
 
TC_API int ITK_ask_bypass (logical *has_bypass)
 
TC_API char * ITK_ask_cli_argument (const char *argument_name)
 
TC_API int ITK_ask_default_date_format (char **date_string)
 
TC_API int ITK_ask_in_ic_context (logical *in_ic_context)
 
TC_API int ITK_ask_object (tag_t *objectId)
 
TC_API int ITK_ask_update_level (int *update_level)
 
TCINIT_API int ITK_auto_login (void)
 
TC_API int ITK_date_to_string (date_t a_date, char **a_string)
 
TCINIT_API int ITK_init_from_cpp (int argc, char **argv)
 
TCINIT_API int ITK_init_module (const char *user_id, const char *user_password, const char *user_group)
 
TC_API int ITK_initialize_text_services (int unused)
 
TC_API int ITK_is_obj_edited_in_ic_context (tag_t obj, logical *res)
 
TCINIT_API void ITK_log_cmdline_args (int argc, char **argv)
 
TC_API int ITK_reset_obj_edited_in_ic_context (tag_t obj)
 
TC_API int ITK_set_bypass (logical on_or_off)
 
TC_API int ITK_set_in_ic_context (logical on_or_off)
 
TC_API int ITK_set_obj_edited_in_ic_context (tag_t obj)
 
TC_API int ITK_string_to_date (const char *a_string, date_t *a_date)
 
int ITK_user_main (int argc, char **argv)
 
TC_API int TC_ask_memory_in_use (void)
 
TC_API int TC_ask_memory_statistics (int *count, char ***names, int **values)
 
TC_API int TC_dump_objects ()
 
TC_API int TC_is_system_running_utf8 (logical *is_running_utf8)
 
TC_API int TC_print_memory_statistics (FILE *output_file)
 
TC_API void TC_report_serious_error (const char *file_name, int line_number, const char *error_message,...)
 
TC_API void TC_write_syslog (const char *control_string,...)
 

Login / Logout

TC_API int ITK_init_to_login (void)
 
TC_API void TC__initialise_tc (int argc, char **argv)
 
TC_API int TC_init_cmain (int argc, char **argv)
 
TC_API int TC_init_module (const char *users_id, const char *users_password, const char *users_group)
 
TC_API int TC_init_module_sponsored (const char *user_id, const char *user_password, const char *sponsored_user, const char *sponsored_user_group)
 
TC_API int TC_auto_login (void)
 
TC_API int ITK_exit_module (logical ignore_unsaved_stuff)
 

Teamcenter Version

TC_API int ITK_ask_full_version (char **release)
 
TC_API int ITK_is_release_at_least (const char *minimum_version, logical *verdict)
 
TC_API int ITK_is_release_at_least_advanced (const char *minimum_version, const logical in_absolute, logical *verdict)
 
TC_API int ITK_ask_version_string (char **version_string)
 
TC_API int ITK_ask_version (int *version_number)
 

Journalling

TC_API int ITK_set_journalling (int on_or_off)
 
TC_API logical ITK_ask_journalling (void)
 

Error message constants

#define ITK_ok   0
 

Detailed Description

Macro Definition Documentation

#define ITK_BATCH_TEXT_MODE   0

Default Text Mode for ITK Batch Program

Definition at line 44 of file tc_startup.h.

#define ITK_BATCH_TEXT_MODE   0

Default Text Mode for ITK Batch Program

Definition at line 194 of file tcinit.h.

#define ITK_ok   0

Definition at line 190 of file tcinit.h.

#define MDC_MAXARGS   5

Definition at line 31 of file tc_basic.h.

#define PROTO (   params)    params

Definition at line 54 of file tc_basic.h.

#define SUCCESS   NULL

Definition at line 30 of file tc_basic.h.

#define tags_equal (   a,
 
)    ((a)==(b))

This macro is obsolescent and is only included for backwards compatability. Please use the == operator directly for all new code.

Definition at line 49 of file tc_basic.h.

Typedef Documentation

typedef struct mdc_sblock * mdc_status_t

Status block which is returned by some subroutines

Function Documentation

TC_API logical ITK__ask_managed_mode ( void  )

Asks the current state of the tcserver managed mode. Returns true if the tcserver is in 4 tier mode

TC_API void ITK__convert_tag_to_uid ( tag_t  aTag,
char **  uid 
)
Parameters
aTag(I)
uid(OF)
TC_API void ITK__convert_uid_to_tag ( const char *  uid,
tag_t aTag 
)
Parameters
uid(I)
aTag(O)
TCINIT_API void ITK__initialise_tc ( int  argc,
char **  argv 
)
TC_API void ITK__set_managed_mode ( logical  value)

Sets the current state of the tcserver managed mode. TC_managed_mode is set to true if the tcserver is in 4 tier mode.

Parameters
value(I) Set to 1 to indicate server is in managed mode.
TC_API char* ITK_ask_action ( void  )

Returns the action passed to the shell program by Application Encapsulation or Release Management (e.g., create, open, save as, etc.). The AE actions are defined in ae.h.

Restrictions:

This function only returns the action code, not any argument to the code. Use ITK_ask_action_argument to get the argument.

Note
Ensure that TC__initialise_tc has been invoked prior to this call.
TC_API char* ITK_ask_action_argument ( const char *  key)

This function returns the argument that was passed to an ITK program from Teamcenter when an external ITK program is invoked through Teamcenter.

There is a special parameter passed to the process that contains the tag of the object being acted on and the action.

In order to get the tag of the dataset, the function should be invoked as follows:

tag_string = ITK_ask_action_argument (NULL);

In order to convert the tag_string to an actual tag, use POM_string_to_tag.

In order to get the format of the dataset, the function can be invoked as follows:

format_string = ITK_ask_action_argument("-f");
Note
Ensure that TC__initialise_tc has been invoked prior to this call.
Parameters
key(I)
TC_API int ITK_ask_argument_named_value ( const char *  argument,
char **  flag,
char **  value 
)

Extracts the switch string and the corresponding value string from the argument string passed into the function.
The format of the switch-value pair must conform to the following pattern: [^=]*=[^=]*.
The switch and the value can be any alpha-numeric string that does not contain the equal (=) character.
The equal (=) character is used to delimit the switch and the value.

Parameters
argument(I)
flag(OF)
value(OF)
TC_API int ITK_ask_bypass ( logical has_bypass)

Checks if bypass is switched on.

Parameters
has_bypass(O) Whether bypass is switched on
TC_API char* ITK_ask_cli_argument ( const char *  argument_name)

Returns the value associated with a command line argument.

Restrictions:

  • The argument argument_name cannot contain a space character as its last character, if the value expected is to follow immediately.
    Whenever the last character is a space, the next argument, if any, is returned as the value of the function.
  • The argument argument_name cannot exceed 255 characters.

Usage:

  • If the program is called with command -i=on, use the call ITK_ask_cli_argument( "-i=" ) to retrieve the value on.
  • If the program is called with command -i on, use the call ITK_ask_cli_argument( "-i " ) to retrieve the value on.
    Note how the string "-i " contains a space character.
Note
Ensure that TC__initialise_tc has been invoked prior to this call.
Parameters
argument_name(I) The name of the argument for which the value is to be returned.
TC_API int ITK_ask_default_date_format ( char **  date_string)

Creates a text string from the current date, using the format defined by the key "DefaultDateFormat" in the localized text resource file "timelocal_locale.xml".

Returns
ITK_ok always
Parameters
date_string(OF)
TC_API int ITK_ask_full_version ( char **  release)

Retrieves the full version of the release (e.g. "10.1.4").

Returns
Parameters
release(OF) A string representing the Teamcenter release
TC_API int ITK_ask_in_ic_context ( logical in_ic_context)
Parameters
in_ic_context(O)
TC_API logical ITK_ask_journalling ( void  )

Asks the current state of the journalling flag as set via ITK_set_journalling. This allows users to develop code that can dynamically switch journalling on or off. Expected use would be in exits and methods.

Returns Journalling_enabled if true; Journalling_suppressed if false.

TC_API int ITK_ask_object ( tag_t objectId)

Returns the tag of the object passed to your program as an argument.
For an Application Encapsulation shell, this is the tag of the selected Dataset.
For a follow-up action, this is the tag of the Job.

Note
Ensure that TC__initialise_tc has been invoked prior to this call.
Parameters
objectId(O)
TC_API int ITK_ask_update_level ( int *  update_level)

Returns the version control information.

Parameters
update_level(O) Version number of the release
TC_API int ITK_ask_version ( int *  version_number)

Returns the version number of the current Teamcenter release.

Deprecated:
Starting Tc10.1.6, use ITK_ask_full_version instead.
Parameters
version_number(O)
TC_API int ITK_ask_version_string ( char **  version_string)

Returns the version number of the current Teamcenter release as a string. The string is MEM_alloc()ed.

Deprecated:
Starting Tc10.1.6, use ITK_ask_full_version instead.
Parameters
version_string(OF) A string representing the version number
TCINIT_API int ITK_auto_login ( void  )

Attempts an automatic login first by assuming sufficient data is available on the command line.

Note
If the site system administrator has set the TC_auto_login preference variable to TRUE in the site .tc_env preference file, the user does not need to enter in a user name, password, or group in the command line. The operating system user name is assumed. However, if the user wants to use a login name other than their operating system name, they may use the command line format:

your_program -u=<user_id> -p=<password> -g=<group>

TC_API int ITK_date_to_string ( date_t  a_date,
char **  a_string 
)

Converts a date_t structure into a text representation.
The date is formatted according to the DefaultDateFormat string defined in timelocal_locale.xml localized text resource file.

Parameters
a_date(I) Supplied date_t structure
a_string(OF) Text representation of specified date
TC_API int ITK_exit_module ( logical  ignore_unsaved_stuff)

Exits this module.

Parameters
ignore_unsaved_stuff(I) This flag is passed to POM_stop. If false, an error is returned if there are unsaved modified objects.
TCINIT_API int ITK_init_from_cpp ( int  argc,
char **  argv 
)

This function initializes the Teamcenter environment for all ITK programs.

Restrictions:

If an ITK program has its own main() routine, this ITK function must be called before any other ITK routines. Otherwise, the ITK program must linked with the ITK_main.o module which performs the same function as this routine.

Parameters
argc(I) Argument count from the main() routine
argv(I) argc Array of arguments from the main() routine
TCINIT_API int ITK_init_module ( const char *  user_id,
const char *  user_password,
const char *  user_group 
)

Attempts a login with the passed-in information.

Parameters
user_id(I) The ID of the user to log-in
user_password(I) The associated password
user_group(I) The group in which to log-in the user
TC_API int ITK_init_to_login ( void  )

This function calls as much initialisation code as possible without actually logging in with a user name and password. Calling this before ITK_init_module may make ITK_init_module faster.

TC_API int ITK_initialize_text_services ( int  unused)

Initializes the Teamcenter text services. This is necessary to get the correct error strings when you use EMH_get_error_string, or by certain other Teamcenter functions that make use of text services, like forms.

Parameters
unused(I) The value is not used anymore
TC_API int ITK_is_obj_edited_in_ic_context ( tag_t  obj,
logical res 
)
Parameters
obj(I)
res(O)
TC_API int ITK_is_release_at_least ( const char *  minimum_version,
logical verdict 
)

Determines if the current Teamcenter release is higher or equal to the specified release.

Returns
  • ITK_ok on success.
  • SS_NOSUCHFILE if the resource file that contains the information cannot be retrieved.
  • CAE_XML_failed_to_parse_xml_file if the parsing of the file that contains the version information has failed.
  • ITK_invalid_version_format if minimum_version or the determined version release is not in the expected format (integers separated by the '.' character, e.g. "10.1.6.1").
Parameters
minimum_version(I) A string representing the minimum Teamcenter version, e.g. "10.1.4".
The string is composed of at least one group and up to 4 groups separated by the '.' character: the major version (mandatory), the minor version, the service pack, the patch.
If either the service pack or the patch information is missing (e.g. "10.1.4" or "10.1"), the assumed value is "0".
If the string is null or empty, the verdict is "true" and no error is returned.
Note
If the string contains a final period (e.g. "10.1."), the character is not taken into account (e.g. same as if the entered string is "10.1").
Parameters
verdict(O) "true" if the current Platform release is minimum_version or higher.
TC_API int ITK_is_release_at_least_advanced ( const char *  minimum_version,
const logical  in_absolute,
logical verdict 
)

Determines if the current Teamcenter release is higher or equal to the specified release in the given release stream or in the absolute.

logical verdict = false;
if( ITK_ok == ITK_is_release_at_least_advanced( "10.1.5", false, &verdict ) && verdict )
{
//The code in here will be run with 10.1.5, 10.1.5.1, 10.1.7 (for example), but not for 11.2.1.
}
if( ITK_ok == ITK_is_release_at_least_advanced( "10.1.5", true, &verdict ) && verdict )
{
//The code in here will be run with 10.1.5, 10.1.5.1, 10.1.7 (for example), as well as 11.2.1, 11.2.2, etc.
}
Note
Calling this API with in_absolute equal to true is the same as invoking ITK_is_release_at_least.
Returns
  • ITK_ok on success.
  • SS_NOSUCHFILE if the resource file that contains the information cannot be retrieved.
  • CAE_XML_failed_to_parse_xml_file if the parsing of the file that contains the version information has failed.
  • ITK_invalid_version_format if minimum_version or the determined version release is not in the expected format (integers separated by the '.' character, e.g. "10.1.6.1").
Parameters
minimum_version(I) A string representing the minimum Teamcenter version, e.g. "10.1.4".
The string is composed of at least one group and up to 4 groups separated by the '.' character: the major version (mandatory), the minor version, the service pack, the patch.
If either the service pack or the patch information is missing (e.g. "10.1.4" or "10.1"), the assumed value is "0".
If the string is null or empty, the verdict is "true" and no error is returned.
Note
If the string contains a final period (e.g. "10.1."), the character is not taken into account (e.g. same as if the entered string is "10.1").
Parameters
in_absolute(I) Determines if the check is made in the absolute (true) or only against the the major release (i.e. the first portion minimum_version; false).
verdict(O) "true" if the current Platform release is minimum_version or higher.
TCINIT_API void ITK_log_cmdline_args ( int  argc,
char **  argv 
)

This function can be used to print command line arguments in syslog for ITK programs.

Parameters
argc(I) Argument count from the main() routine
argv(I) argc Array of arguments from the main() routine
TC_API int ITK_reset_obj_edited_in_ic_context ( tag_t  obj)
Parameters
obj(I)
TC_API int ITK_set_bypass ( logical  on_or_off)

Allows a system administrator to bypass Access Manager controls on objects.
Switching the bypass on typically allows the system administrator to modify, delete, or otherwise access objects at will.



When using the old AM, all access control is disabled by the bypass facility. However, the effect of bypass in the new AM is dependent on the Has Teamcenter::Bypass rule in the AM Rules Tree.

Note
It is recommended to use the C++ Bypass class object instead of this API. This class has a destructor which will reset the bypass when the object goes out of scope. This improves the handling of error conditions and reduces the chances that the bypass will last too long.

The user must be a Teamcenter system administrator.

Parameters
on_or_off(I) Whether to switch bypass on (true) or off (false)
TC_API int ITK_set_in_ic_context ( logical  on_or_off)
Parameters
on_or_off(I)
TC_API int ITK_set_journalling ( int  on_or_off)

Sets journalling for the ITK, WSOM, AOM, and FL functions of Teamcenter.

Note
This function does not control normal journalling that takes place in a Teamcenter session - it only controls additional journalling that takes place inside your custom ITK code.
Parameters
on_or_off(I) Set to 0 to turn journalling off, or to non-zero to turn journalling on.
TC_API int ITK_set_obj_edited_in_ic_context ( tag_t  obj)
Parameters
obj(I)
TC_API int ITK_string_to_date ( const char *  a_string,
date_t a_date 
)

Converts a text string into a date_t structure.
The string is assumed to be formatted according to the DefaultDateFormat value in time.uil.

Returns
Parameters
a_string(I) Specified date string
a_date(O) Date as a date_t structure
int ITK_user_main ( int  argc,
char **  argv 
)

Main functions for all ITK utility.


Create your own implementation of this utility to address your needs. The utility will need to be linked with itk_main.o, which is done if the linkitk.sh or linkitk.bat script from ADK (Application Development Kit) is called.


The Teamcenter infrastructure will call your utility ITK_user_main upon execution.

Parameters
[in]argcThe number of input arguments
[in]argvThe array of input arguments
TC_API void TC__initialise_tc ( int  argc,
char **  argv 
)

Initializes different key modules in the Teamcenter server.
It internally calls TC_init_cmain.

Note
Ensure that this ITK is called prior to calling ITK_ask_cli_argument
ITK_user_main already calls TC__initialise_tc.
TC_API int TC_ask_memory_in_use ( void  )

Reports SM+OM in-use space. Ignores OM-UNDO

TC_API int TC_ask_memory_statistics ( int *  count,
char ***  names,
int **  values 
)

Implemented in memorymonitorwindow.cxx

Returns virtual memory use under various categories (some CPU types give more data than others) (These numbers may be of interest to ITK programmers, but probably not to system administrators)

Parameters
count(O)
names(OF) count
values(OF) count
TC_API int TC_auto_login ( void  )

ITK_init_module attempts an automatic login first by assuming sufficient data is available on the command line.

Note
If the site system administrator has set the TC_auto_login preference variable to TRUE, the user does not need to enter in a user name, password, or group in the command line. The operating system user name is assumed.
However, if the user wants to use a login name other than their operating system name, they may use the command line format:
your_program -u=<user_id> -p=<password> -g=<group>

This method also leverages calls made using a password file through the '-pf=' parameter.
your_program -u=<user_id> -pf=<path_to_password_file> -g=<group>

This method is now in libtcinit, and calls register_init_functions() followed by a call to TC_init_module, which is the old ITK_init_module() in infomanager_itk.cxx

TC_API int TC_dump_objects ( )
Deprecated:
It will be removed in Tc10.1 There is no output.
TC_API int TC_init_cmain ( int  argc,
char **  argv 
)

Routine to initialize the basic system service routines from SYSS module. It also initializes the Preferences module.

TC_API int TC_init_module ( const char *  users_id,
const char *  users_password,
const char *  users_group 
)

The original method, ITK_init_module, initializes the Integration Tool Kit (ITK) for use. \
For convenience, also logs into the POM.
This m ethod is now in libtcinit, and calls register_init_functions() followed by a call toTC_init_module.
TC_init_module is the rest of the method that was not moved to tcinit.

Warning
ITK_init_module or ITK_auto_login must be called before calling any other ITK functions, unless otherwise stated in the description of specific ITK functions.
Parameters
users_id(I)
users_password(I)
users_group(I)
TC_API int TC_init_module_sponsored ( const char *  user_id,
const char *  user_password,
const char *  sponsored_user,
const char *  sponsored_user_group 
)

Initializes TC for sponsored login

Warning
TC_init_module_sponsored or ITK_auto_login must be called before calling any other ITK functions, unless otherwise stated in the description of specific ITK functions.
Returns
Parameters
user_id(I) User id of the sponsoring user
user_password(I) Password of the sponsoring user
sponsored_user(I) User id of the sponsored user
sponsored_user_group(I) Sponsored user's group
TC_API int TC_is_system_running_utf8 ( logical is_running_utf8)

Checks if the Teamcenter system is configured for UTF-8 encoding, and is running as such.
The system comprises the server and the database.

Returns
  • ITK_ok on success
  • TC_mismatch_utf8_settings if Teamcenter server is running in UTF-8 database and there is a mismatch in UTF-8 settings for environment variables TC_XML_ENCODING and UGII_UTF8_MODE.
    This is only applicable to Windows platform.
Parameters
is_running_utf8(O) Determines if system is running in utf8. The value is true if the Teamcenter system is properly configured for UTF-8 encoding, and is running as such. false if the Teamcenter system is not configured for UTF-8 encoding.
TC_API int TC_print_memory_statistics ( FILE *  output_file)

Prints the current memory statistics into a specified file.

Parameters
output_file- File pointer to an already opened output file where the memory statistics will be written out
Returns
ITK_ok on success, on error returns ITK_internal_error
Parameters
output_file(I) File pointer to an already opened output file where the memory statistics will be written out
TC_API void TC_report_serious_error ( const char *  file_name,
int  line_number,
const char *  error_message,
  ... 
)

Raises an exception (ERROR_raise) using the error ITK_internal_error as well as a given message.

Note
The macro ERROR_line can be used to substitute both file_name and line_number parameters.
Parameters
file_name(I) The file where the error has occurred.
line_number(I) The line where the error has occurred.
error_message(I) The potentially parameterized message to be associated with the exception.
%s indicates a string parameter, %d a digit, etc.
The parameters are to be provided as subsequent arguments of this API.
TC_API void TC_write_syslog ( const char *  control_string,
  ... 
)

Loads the data from the given locations, converts them to character string equivalents and writes the results to the syslog file.

Parameters
control_string(I) Pointer to a null-terminated string specifying how to interpret the data. The format string consists of ordinary characters (except %), which are copied unchanged into the syslog file, and conversion specifications. Each conversion specification (% and characters following) has the format as specificed in std::printf.
All arguments following the control_string specify the data to print. If any argument after default conversions is not the type expected by the corresponding conversion specifier, or if there are fewer arguments than required by control_string, the behavior is undefined. If there are more arguments than required by control_string, the extraneous arguments are evaluated and ignored.