• [服务器端ITK] teamcenter ITK二次开发源码分享: 创建一个工作流


    /*HEAD CREATE_A_PROCESS CCC ITK */ 
    #include <stdlib.h> 
    #include <TCcore/aom.h> 
    #include <tc/emh.h> 
    #include <tc/tc.h> 
    #include <sa/tcfile.h> 
    
    #include <itk/mem.h> 
    #define ERROR_CHECK(X) (report_error( __FILE__, __LINE__, #X, (X))) 
    static void report_error( char *file, int line, char *function, int return_code) {
        if (return_code != ITK_ok) {
            char *error_message_string; 
            EMH_get_error_string (NULLTAG, return_code, &error_message_string); 
            printf ("ERROR: %d ERROR MSG: %s.
    ", return_code, error_message_string); 
            printf ("FUNCTION: %s
    FILE: %s LINE: %d
    ", function, file, line); 
            if(error_message_string){
                MEM_free(error_message_string); 
            }
            printf("
    Exiting program!
    "); 
            exit (EXIT_FAILURE); 
        }
    }
    
    #define EXIT_IF_NULL(X) (check_value(#X, (X))) 
    static void check_value( char *function, int value ) {
        if (value == 0) {
            printf ("	%s is NULL
    ", function); 
            printf("
    Exiting program!
    "); 
            exit (EXIT_FAILURE); 
        }
    }
    
    static void do_it(void) {
        int attach_types[1] = {1}; 
        tag_t rev = NULLTAG, 
        process_template = NULLTAG, 
        process = NULLTAG; 
        ERROR_CHECK( ITEM_find_rev("000206", "A", &rev) ); 
        EXIT_IF_NULL( rev );
    
        ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); 
        ERROR_CHECK( EPM_find_process_template("oneStepWithStatus", &process_template) ); 
        
        ERROR_CHECK( EPM_create_process("5421377", "desc", process_template, 1, &rev, 
        attach_types, &process) ); 
        EXIT_IF_NULL( process );     
    }
    
    int ITK_user_main(int argc, char* argv[]) {
        int status = 0; 
        
        ITK_initialize_text_services( ITK_BATCH_TEXT_MODE ); 
        status = ITK_auto_login(); 
        
        if ((status != ITK_ok)) printf("
    Login Failed!
    
    "); 
        else {
            printf("
    Login successful!
    
    "); 
            ITK_set_journalling(TRUE); 
            do_it(); 
        }
        ITK_exit_module(TRUE);
        return status;
    }
  • 相关阅读:
    Linux下让一个程序开机自动启动
    Heartbeat高可用解决方案
    NFS文件共享
    清除系统日志的三个脚本
    nfs+rsync+inotify实现文件的实时同步
    安装配置rsync服务端
    shell中如何进行算术运算
    linux下查看账号密码的过期时间和设置时间
    配置Nginx作为web server详解
    [LeetCode] 398. Random Pick Index ☆☆☆
  • 原文地址:https://www.cnblogs.com/wwssgg/p/14915815.html
Copyright © 2020-2023  润新知