Sample ITK Code, Item and Dataset
Sample ITK Code, Item and Dataset
Sample ITK Code, Item and Dataset
Solution:
#include"TC_Data_Report.h"
#include<iostream>
using namespace std;
int iNumErrs = 0;
const int *pSevLst = 0;
const int *pErrCdeLst = 0;
const char **pMsgLst = NULL;
register int i = 0;
//getchar();
AE_reference_type_t reftype;
(void)argc;
(void)argv;
int secondaryobjectcount = 0;
int referencenumberfound = 0;
int statuscount = 0;
int istatus = ITK_ok;
int n_item = 0;
int iFail = ITK_ok;
int retcode = ITK_ok;
auto t = std::time(nullptr);
auto tm = *std::localtime(&t);
ITK_initialize_text_services( 0 );
istatus = ITK_init_module( userId , password , group );
//istatus = ITK_init_module("infodba","infodba","dba");
if ( istatus != ITK_ok)
{
EMH_ask_error_text( istatus, &errormsg);
printf("Error with ITK_init_module: %s \n",errormsg);
MEM_free(errormsg);
return istatus;
}
ITEM_ask_latest_rev( item_tags[i],&titem_rev );
if (AOM_ask_value_string(titem_rev,"item_revision_id",&revisionid)!=
ITK_ok )PrintErrorStack();
//cout<<"Revision id is "<<revisionid<<endl;
AOM_UIF_ask_value(titem_rev,"last_release_status",&release_status_list);
//cout<<"release_status_list is "<<release_status_list<<endl;
GRM_list_secondary_objects_only
(titem_rev,NULLTAG,&secondaryobjectcount,&secondary_objects);
//cout<<"Dataset count is "<<secondaryobjectcount<<endl;
for(int datasetcount=0;datasetcount<secondaryobjectcount;datasetcount++)
{
if
(TCTYPE_ask_object_type(secondary_objects[datasetcount],&objTypeTag)!
=ITK_ok)PrintErrorStack();
if (TCTYPE_ask_name(objTypeTag,type_name)!
=ITK_ok)PrintErrorStack();
//cout<<"type_name is "<<type_name<<endl;
if( (strcmp(type_name,"UGMASTER") == 0)||
(strcmp(type_name,"MSExcelX") ==0 ) || (strcmp(type_name,"DirectModel") == 0 )
)
{
if
(AE_ask_dataset_ref_count(secondary_objects[datasetcount],&referencenumberfoun
d)!=ITK_ok)PrintErrorStack();
if ( referencenumberfound > 0 )
{
AOM_ask_name (secondary_objects[datasetcount],&datasetname);
fprintf (out_Datasefile_fp , "%s,%s,%s,",
objectname,revisionid,datasetname);
strcpy(orig_name,"");
strcpy(path_name,"");
strcpy(relative_path,"");
if
(AE_find_dataset_named_ref(secondary_objects[datasetcount],j,refname,&reftype,
&refobject)!=ITK_ok)PrintErrorStack();
//cout<<"reftype ="<<reftype<<endl;
//cout<<"refname ="<<refname<<endl;
if(strcmp(refname,"UGPART-ATTR")!=0)
{
if ( IMF_ask_original_file_name(refobject,orig_name)!
=ITK_ok)PrintErrorStack();
// cout<<"\n orig_name is :%s\n"<<orig_name<<endl;
if(IMF_ask_file_pathname(refobject,SS_WNT_MACHINE,path_name)!
=ITK_ok)PrintErrorStack();
// cout<<"\n path_name is :%s\n"<<path_name<<endl;
}
}
}
}
/*
MEM_free(objectname);
MEM_free(revisionid);
MEM_free(userId);
MEM_free(password);
MEM_free(group);
*/
tm = *std::localtime(&t);
std::cout << "End Time: "<<std::put_time(&tm, "%d-%m-%Y %H:%M:%S") <<
std::endl;
cout<<"output file will be available at exe location with name Itemdetails.csv
and DatasetDetails.csv"<<endl;
/* Cleanup */
MEM_free(item_revision_id);
MEM_free(object_desc);
MEM_free(owning_user);
MEM_free(project_ids);
MEM_free(last_mod_user);
MEM_free(release_status_list);
MEM_free(date_format);
MEM_free(lastmoddate_string);
MEM_free(creationdate_string);
MEM_free (secondary_objects );
MEM_free ( item_tags );
retcode = ITK_exit_module(true);
return EXIT_SUCCESS;
int i;
int n_rows, n_cols;
void ***values;
if ( n_rows != 0 )
{
*foundTags = (tag_t *)MEM_alloc ( n_rows * sizeof( tag_t ));
*nFound = n_rows;
}
if ( POM_enquiry_delete("find_wso_by_type")!= ITK_ok ) PrintErrorStack();
MEM_free( values );
return 0;