/* Copyright 2020 Siemens Digital Industries Software ================================================== Copyright 2016. Siemens Product Lifecycle Management Software Inc. All Rights Reserved. ================================================== Copyright 2020 Siemens Digital Industries Software */ /** @file XFORMER module definitions file */ #ifndef TEAMCENTER_XFORMER_H #define TEAMCENTER_XFORMER_H #include #include /** @defgroup XFORMER Transformer @ingroup TC Provides functions to transform data model from one format to another. The XFORMER functions include: @{ */ #ifdef __cplusplus extern "C"{ #endif /** @name Transformer External Function definition methods Example for implementing Transformer External Function @code extern int func_ext_example ( void* scope ) { // Get arguments unsigned int cnt = 0; char** args = NULL; int ifail = XFORMER_get_scope_arguments( scope, &cnt, &args ); if ( ifail != ITK_ok ) { return ifail; } // Evaluate // NOTE: better to do argList chcek before go to this step std::string val(args[0]); val.append("_test"); // Deallocate arguments MEM_free(args); // Apply Result ifail = XFORMER_set_scope_return_value( val.c_str(), scope ); return ifail; } @endcode @{ */ /** Teamcenter Transformer external function definition.
The function is used to implement specific Transformer function logic in C/C++. */ typedef int (*XFORMER_custom_function_fn_t) ( void* /**< (O) XFormer Function Scope for storing local variable */ ); /** Retrieves the input arguments in a specific Transformer Function Scope. @returns */ extern XFORMER_API int XFORMER_get_scope_arguments ( const void* scope, /**< (I) XFormer Function Scope */ unsigned int* n_arguments, /**< (O) Number of input arguments */ char*** arguments /**< (OF) n_arguments Input arguments.
The array is packed, which means it is to be deallocated by calling #MEM_free on the container only. */ ); /** Sets the return value to a specific Transformer Function Scope. @returns */ extern XFORMER_API int XFORMER_set_scope_return_value ( const char* value, /**< (I) Value as string */ void* scope /**< (I/O) XFormer Function Scope. The return value is saved in the scope */ ); /** Set return values as string list to specific Transformer Function Scope. @returns */ extern XFORMER_API int XFORMER_set_scope_return_values ( const unsigned int n_values, /**< (I) Number of values */ const char** values, /**< (I) n_values Values as string list */ void* scope /**< (I/O) XFormer Function Scope. The return values are saved in the scope */ ); /** @} */ /** @name Transformer Function evaluation methods @{ */ /** Creates a Transformer Function Scope.
The scope can be used for applying transformer rule in C++ context. @returns #ITK_ok always. */ extern XFORMER_API int XFORMER_create_function_scope ( void** scope /**< (OF) XFormer Function Scope */ ); /** Deletes Transformer Function Scope and frees the memory. @returns #ITK_ok always. */ extern XFORMER_API int XFORMER_delete_function_scope ( void** scope /**< (OF) XFormer Function Scope */ ); /** Evaluates a Function Expression using a specific Transformer Function Scope. @returns */ extern XFORMER_API int XFORMER_evaluate_expression ( const char* expression, /**< (I) The expression to evaluate. */ void* scope, /**< (I/O) XFormer Function Scope. The expression evaluation may change the scope */ char** value /**< (OF) The result of the evaluation. */ ); /** @} */ /** @name Transform ITK @{ */ /** Transforms XML files to a unique object graph, then transforms this graph to an output file in a format driven by Transformer rules in a rule file. @returns */ extern XFORMER_API int XFORMER_transform_xml ( unsigned int n_xml_files, /**< (I) Number of XML files to process */ const char** xml_files, /**< (I) n_xml_files Paths to the XML files */ unsigned int n_options, /**< (I) Number of session options. */ const char** options, /**< (I) n_options Session option names. */ const char** option_values, /**< (I) n_options Session option values. */ const char* rule_file, /**< (I) Path to the Transformer rule file. */ const char* output_file, /**< (I) Path to the output file. It will be overwritten if the file already exists in the location. */ const char* log_file /**< (I) Path to the log file. It will be overwritten if the file already exists. The log will be printed to the syslog if the @p log_file is not specified.*/ ); /** Transforms XML files to a unique object graph, then transforms this graph to an output file in a format driven by Transformer rules in one or more rule file. @returns */ extern XFORMER_API int XFORMER_transform_xml2( unsigned int n_xml_files, /**< (I) Number of XML files to process */ const char** xml_files, /**< (I) n_xml_files Paths to the XML files */ unsigned int n_options, /**< (I) Number of session options. */ const char** options, /**< (I) n_options Session option names. */ const char** option_values, /**< (I) n_options Session option values. */ unsigned int n_rule_files, /**< (I) Number of rule files to apply */ const char** rule_files, /**< (I) n_rule_files Paths to the Transformer rule files. */ const char* output_file, /**< (I) Path to the output file. It will be overwritten if the file already exists in the location. */ const char* log_file /**< (I) Path to the log file. It will be overwritten if the file already exists. The log will be printed to the syslog if the @p log_file is not specified.*/ ); /** @} */ #ifdef __cplusplus } #endif /** @} */ #include #endif