/* * class operation: init */ monitor_vitalsign * monitor_O2saturation_op_init() { monitor_O2saturation * O2saturation;monitor_vitalsign * vitalsign; /* CREATE OBJECT INSTANCE O2saturation OF O2saturation */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE O2saturation OF O2saturation" ); O2saturation = (monitor_O2saturation *) Escher_CreateInstance( monitor_DOMAIN_ID, monitor_O2saturation_CLASS_NUMBER ); /* CREATE OBJECT INSTANCE vitalsign OF vitalsign */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE vitalsign OF vitalsign" ); vitalsign = (monitor_vitalsign *) Escher_CreateInstance( monitor_DOMAIN_ID, monitor_vitalsign_CLASS_NUMBER ); /* ASSIGN vitalsign.name = O2saturation */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.name = O2saturation" ); Escher_strcpy( vitalsign->name, "O2saturation" ); /* ASSIGN vitalsign.value = 0 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.value = 0" ); vitalsign->value = 0; /* ASSIGN vitalsign.yellow_threshold = 93 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.yellow_threshold = 93" ); vitalsign->yellow_threshold = 93; /* ASSIGN vitalsign.red_threshold = 85 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.red_threshold = 85" ); vitalsign->red_threshold = 85; /* RELATE O2saturation TO vitalsign ACROSS R2 */ XTUML_OAL_STMT_TRACE( 1, "RELATE O2saturation TO vitalsign ACROSS R2" ); monitor_O2saturation_R2_Link( vitalsign, O2saturation ); /* RETURN vitalsign */ XTUML_OAL_STMT_TRACE( 1, "RETURN vitalsign" ); {monitor_vitalsign * xtumlOALrv = vitalsign; return xtumlOALrv;} }
/* * Domain Function: test */ void c1_test() { c1_PING * ping; c1_PONG * pong; c_t s[ESCHER_SYS_MAX_STRING_LEN]; /* CREATE OBJECT INSTANCE ping OF PING */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE ping OF PING" ); ping = (c1_PING *) Escher_CreateInstance( c1_DOMAIN_ID, c1_PING_CLASS_NUMBER ); /* CREATE OBJECT INSTANCE pong OF PONG */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE pong OF PONG" ); pong = (c1_PONG *) Escher_CreateInstance( c1_DOMAIN_ID, c1_PONG_CLASS_NUMBER ); /* RELATE ping TO pong ACROSS R1 */ XTUML_OAL_STMT_TRACE( 1, "RELATE ping TO pong ACROSS R1" ); c1_PING_R1_Link( pong, ping ); /* ASSIGN ping.i = 0 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN ping.i = 0" ); ping->i = 0; /* ASSIGN pong.s = 'pong' */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN pong.s = 'pong'" ); Escher_strcpy( pong->s, "pong" ); /* ASSIGN s = 'tic function test' */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN s = 'tic function test'" ); Escher_strcpy( s, "tic function test" ); /* SEND toss::s1(sp1:1) */ XTUML_OAL_STMT_TRACE( 1, " SEND toss::s1(sp1:1)" ); c1_toss_s1( 1 ); }
/* * class operation: populate_image */ ooaofooa_DOC_CELL * ooaofooa_DOC_CELL_op_populate_image( c_t * p_image, ooaofooa_DOC_CELL * p_predecessor ) { ooaofooa_DOC_PAR * doc_par;ooaofooa_DOC_CELL * predecessor;ooaofooa_DOC_IMG * doc_img;ooaofooa_DOC_CELL * doc_cell;ooaofooa_DOC_SEC * empty_doc_sec=0;ooaofooa_DOC_PAR * empty_doc_par=0; /* ASSIGN predecessor = PARAM.predecessor */ predecessor = p_predecessor; /* CREATE OBJECT INSTANCE doc_cell OF DOC_CELL */ doc_cell = (ooaofooa_DOC_CELL *) Escher_CreateInstance( ooaofooa_DOMAIN_ID, ooaofooa_DOC_CELL_CLASS_NUMBER ); /* IF ( not_empty predecessor ) */ if ( ( 0 != predecessor ) ) { /* RELATE predecessor TO doc_cell ACROSS R2304 */ ooaofooa_DOC_CELL_R2304_Link_follows( predecessor, doc_cell ); } /* SELECT any empty_doc_par FROM INSTANCES OF DOC_PAR WHERE FALSE */ empty_doc_par = 0; /* SELECT any empty_doc_sec FROM INSTANCES OF DOC_SEC WHERE FALSE */ empty_doc_sec = 0; /* ASSIGN doc_par = DOC_PAR::populate(doc_sec:empty_doc_sec, predecessor:empty_doc_par, text:) */ doc_par = ooaofooa_DOC_PAR_op_populate(empty_doc_sec, empty_doc_par, ""); /* RELATE doc_par TO doc_cell ACROSS R2318 */ ooaofooa_DOC_CELL_R2318_Link( doc_par, doc_cell ); /* CREATE OBJECT INSTANCE doc_img OF DOC_IMG */ doc_img = (ooaofooa_DOC_IMG *) Escher_CreateInstance( ooaofooa_DOMAIN_ID, ooaofooa_DOC_IMG_CLASS_NUMBER ); /* RELATE doc_img TO doc_par ACROSS R2319 */ ooaofooa_DOC_IMG_R2319_Link( doc_par, doc_img ); /* ASSIGN doc_img.target = PARAM.image */ doc_img->target = Escher_strcpy( doc_img->target, p_image ); /* RETURN doc_cell */ {ooaofooa_DOC_CELL * xtumlOALrv = doc_cell; return xtumlOALrv;} }
/* * class operation: init */ monitor_vitalsign * monitor_pulse_op_init() { monitor_pulse * pulse;monitor_vitalsign * vitalsign; /* CREATE OBJECT INSTANCE pulse OF pulse */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE pulse OF pulse" ); pulse = (monitor_pulse *) Escher_CreateInstance( monitor_DOMAIN_ID, monitor_pulse_CLASS_NUMBER ); /* CREATE OBJECT INSTANCE vitalsign OF vitalsign */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE vitalsign OF vitalsign" ); vitalsign = (monitor_vitalsign *) Escher_CreateInstance( monitor_DOMAIN_ID, monitor_vitalsign_CLASS_NUMBER ); /* ASSIGN vitalsign.name = pulse */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.name = pulse" ); Escher_strcpy( vitalsign->name, "pulse" ); /* ASSIGN vitalsign.value = 0 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.value = 0" ); vitalsign->value = 0; /* ASSIGN vitalsign.yellow_threshold = 20 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.yellow_threshold = 20" ); vitalsign->yellow_threshold = 20; /* ASSIGN vitalsign.red_threshold = 10 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN vitalsign.red_threshold = 10" ); vitalsign->red_threshold = 10; /* RELATE pulse TO vitalsign ACROSS R2 */ XTUML_OAL_STMT_TRACE( 1, "RELATE pulse TO vitalsign ACROSS R2" ); monitor_pulse_R2_Link( vitalsign, pulse ); /* RETURN vitalsign */ XTUML_OAL_STMT_TRACE( 1, "RETURN vitalsign" ); {monitor_vitalsign * xtumlOALrv = vitalsign; return xtumlOALrv;} }
/* * class operation: populate_paragraph */ ooaofooa_DOC_CELL * ooaofooa_DOC_CELL_op_populate_paragraph( ooaofooa_DOC_CELL * p_predecessor, c_t * p_text ) { ooaofooa_DOC_PAR * doc_par;ooaofooa_DOC_CELL * predecessor;ooaofooa_DOC_CELL * doc_cell;ooaofooa_DOC_SEC * empty_doc_sec=0;ooaofooa_DOC_PAR * empty_doc_par=0; /* ASSIGN predecessor = PARAM.predecessor */ predecessor = p_predecessor; /* CREATE OBJECT INSTANCE doc_cell OF DOC_CELL */ doc_cell = (ooaofooa_DOC_CELL *) Escher_CreateInstance( ooaofooa_DOMAIN_ID, ooaofooa_DOC_CELL_CLASS_NUMBER ); /* IF ( not_empty predecessor ) */ if ( ( 0 != predecessor ) ) { /* RELATE predecessor TO doc_cell ACROSS R2304 */ ooaofooa_DOC_CELL_R2304_Link_follows( predecessor, doc_cell ); } /* SELECT any empty_doc_par FROM INSTANCES OF DOC_PAR WHERE FALSE */ empty_doc_par = 0; /* SELECT any empty_doc_sec FROM INSTANCES OF DOC_SEC WHERE FALSE */ empty_doc_sec = 0; /* ASSIGN doc_par = DOC_PAR::populate(doc_sec:empty_doc_sec, predecessor:empty_doc_par, text:PARAM.text) */ doc_par = ooaofooa_DOC_PAR_op_populate(empty_doc_sec, empty_doc_par, p_text); /* RELATE doc_par TO doc_cell ACROSS R2318 */ ooaofooa_DOC_CELL_R2318_Link( doc_par, doc_cell ); /* RETURN doc_cell */ {ooaofooa_DOC_CELL * xtumlOALrv = doc_cell; return xtumlOALrv;} }
/* * Domain Function: setup */ void perf_funcs_setup() { perf_funcs_BENCHMARK * benchmark; perf_funcs_CBENCH * c; /* CREATE OBJECT INSTANCE benchmark OF BENCHMARK */ benchmark = (perf_funcs_BENCHMARK *) Escher_CreateInstance( perf_funcs_DOMAIN_ID, perf_funcs_BENCHMARK_CLASS_NUMBER ); /* ASSIGN benchmark.test_number = 0 */ benchmark->test_number = 0; /* ASSIGN benchmark.duration = 1 */ benchmark->duration = 1; /* CREATE OBJECT INSTANCE c OF CBENCH */ c = (perf_funcs_CBENCH *) Escher_CreateInstance( perf_funcs_DOMAIN_ID, perf_funcs_CBENCH_CLASS_NUMBER ); /* ASSIGN c.phase = 0 */ c->phase = 0; }
/* * class operation: populate */ ooaofooa_DOC_SEC * ooaofooa_DOC_SEC_op_populate( ooaofooa_DOC_SEC * p_parent_doc_sec, c_t * p_subtitle, c_t * p_title ) { ooaofooa_DOC_SEC * parent_doc_sec;ooaofooa_DOC_SEC * doc_sec; /* CREATE OBJECT INSTANCE doc_sec OF DOC_SEC */ doc_sec = (ooaofooa_DOC_SEC *) Escher_CreateInstance( ooaofooa_DOMAIN_ID, ooaofooa_DOC_SEC_CLASS_NUMBER ); doc_sec->ID = (Escher_UniqueID_t) doc_sec; /* ASSIGN doc_sec.title = PARAM.title */ doc_sec->title = Escher_strcpy( doc_sec->title, p_title ); /* ASSIGN doc_sec.subtitle = PARAM.subtitle */ doc_sec->subtitle = Escher_strcpy( doc_sec->subtitle, p_subtitle ); /* ASSIGN doc_sec.level = 1 */ doc_sec->level = 1; /* ASSIGN parent_doc_sec = PARAM.parent_doc_sec */ parent_doc_sec = p_parent_doc_sec; /* IF ( not_empty parent_doc_sec ) */ if ( ( 0 != parent_doc_sec ) ) { ooaofooa_DOC_SEC * sibling_doc_sec=0; /* SELECT one sibling_doc_sec RELATED BY parent_doc_sec->DOC_SEC[R2307.has first child] */ sibling_doc_sec = ( 0 != parent_doc_sec ) ? parent_doc_sec->DOC_SEC_R2307_has_first_child : 0; /* IF ( empty sibling_doc_sec ) */ if ( ( 0 == sibling_doc_sec ) ) { /* RELATE doc_sec TO parent_doc_sec ACROSS R2307 */ ooaofooa_DOC_SEC_R2307_Link_has_parent( doc_sec, parent_doc_sec ); /* ASSIGN doc_sec.level = ( parent_doc_sec.level + 1 ) */ doc_sec->level = ( parent_doc_sec->level + 1 ); } else { ooaofooa_DOC_SEC * next_doc_sec; /* ASSIGN next_doc_sec = sibling_doc_sec */ next_doc_sec = sibling_doc_sec; /* WHILE ( not_empty next_doc_sec ) */ while ( ( 0 != next_doc_sec ) ) { /* ASSIGN sibling_doc_sec = next_doc_sec */ sibling_doc_sec = next_doc_sec; /* SELECT one next_doc_sec RELATED BY sibling_doc_sec->DOC_SEC[R2306.follows] */ next_doc_sec = ( 0 != sibling_doc_sec ) ? sibling_doc_sec->DOC_SEC_R2306_follows : 0; } /* RELATE sibling_doc_sec TO doc_sec ACROSS R2306 */ ooaofooa_DOC_SEC_R2306_Link_follows( sibling_doc_sec, doc_sec ); /* ASSIGN doc_sec.level = sibling_doc_sec.level */ doc_sec->level = sibling_doc_sec->level; } } /* RETURN doc_sec */ {ooaofooa_DOC_SEC * xtumlOALrv = doc_sec; return xtumlOALrv;} }
/* * Domain Function: TestSequence1 */ void MicrowaveOven_TestSequence1() { MicrowaveOven_MO_TS * testSequence; /* CREATE OBJECT INSTANCE testSequence OF MO_TS */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE testSequence OF MO_TS" ); testSequence = (MicrowaveOven_MO_TS *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_TS_CLASS_NUMBER ); testSequence->TestSeqID = (Escher_UniqueID_t) testSequence; /* GENERATE MO_TS2:perform_test_seq_1() TO testSequence */ XTUML_OAL_STMT_TRACE( 1, "GENERATE MO_TS2:perform_test_seq_1() TO testSequence" ); { Escher_xtUMLEvent_t * e = Escher_NewxtUMLEvent( testSequence, &MicrowaveOven_MO_TSevent2c ); Escher_SendEvent( e ); } }
/* * Domain Function: DefineOven */ void MicrowaveOven_DefineOven() { MicrowaveOven_MO_O * mo; MicrowaveOven_MO_MT * tube; MicrowaveOven_MO_IL * light; MicrowaveOven_MO_B * beeper; MicrowaveOven_MO_D * door; MicrowaveOven_MO_TRN * turntable; /* CREATE OBJECT INSTANCE mo OF MO_O */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE mo OF MO_O" ); mo = (MicrowaveOven_MO_O *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_O_CLASS_NUMBER ); mo->OvenID = (Escher_UniqueID_t) mo; /* ASSIGN mo.remaining_cooking_time = 0 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN mo.remaining_cooking_time = 0" ); mo->remaining_cooking_time = 0; /* CREATE OBJECT INSTANCE tube OF MO_MT */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE tube OF MO_MT" ); tube = (MicrowaveOven_MO_MT *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_MT_CLASS_NUMBER ); tube->TubeID = (Escher_UniqueID_t) tube; /* RELATE mo TO tube ACROSS R1 */ XTUML_OAL_STMT_TRACE( 1, "RELATE mo TO tube ACROSS R1" ); MicrowaveOven_MO_O_R1_Link( tube, mo ); /* ASSIGN tube.current_power_output = high */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN tube.current_power_output = high" ); tube->current_power_output = MicrowaveOven_tube_wattage_high_e; /* CREATE OBJECT INSTANCE light OF MO_IL */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE light OF MO_IL" ); light = (MicrowaveOven_MO_IL *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_IL_CLASS_NUMBER ); light->LightID = (Escher_UniqueID_t) light; /* RELATE mo TO light ACROSS R2 */ XTUML_OAL_STMT_TRACE( 1, "RELATE mo TO light ACROSS R2" ); MicrowaveOven_MO_O_R2_Link( light, mo ); /* CREATE OBJECT INSTANCE beeper OF MO_B */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE beeper OF MO_B" ); beeper = (MicrowaveOven_MO_B *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_B_CLASS_NUMBER ); beeper->BeeperID = (Escher_UniqueID_t) beeper; /* RELATE mo TO beeper ACROSS R3 */ XTUML_OAL_STMT_TRACE( 1, "RELATE mo TO beeper ACROSS R3" ); MicrowaveOven_MO_O_R3_Link( beeper, mo ); /* CREATE OBJECT INSTANCE door OF MO_D */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE door OF MO_D" ); door = (MicrowaveOven_MO_D *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_D_CLASS_NUMBER ); door->DoorID = (Escher_UniqueID_t) door; /* RELATE mo TO door ACROSS R4 */ XTUML_OAL_STMT_TRACE( 1, "RELATE mo TO door ACROSS R4" ); MicrowaveOven_MO_O_R4_Link( door, mo ); /* ASSIGN door.is_secure = FALSE */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN door.is_secure = FALSE" ); door->is_secure = FALSE; /* CREATE OBJECT INSTANCE turntable OF MO_TRN */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE turntable OF MO_TRN" ); turntable = (MicrowaveOven_MO_TRN *) Escher_CreateInstance( MicrowaveOven_DOMAIN_ID, MicrowaveOven_MO_TRN_CLASS_NUMBER ); turntable->TurntableID = (Escher_UniqueID_t) turntable; /* RELATE mo TO turntable ACROSS R5 */ XTUML_OAL_STMT_TRACE( 1, "RELATE mo TO turntable ACROSS R5" ); MicrowaveOven_MO_O_R5_Link( turntable, mo ); }
/* * class operation: populate */ ooaofooa_DOC_TBL * ooaofooa_DOC_TBL_op_populate( ooaofooa_DOC_PAR * p_doc_par, const i_t p_num_cols, c_t * p_title ) { ooaofooa_DOC_PAR * doc_par;ooaofooa_DOC_TBL * doc_tbl; /* ASSIGN doc_par = PARAM.doc_par */ doc_par = p_doc_par; /* CREATE OBJECT INSTANCE doc_tbl OF DOC_TBL */ doc_tbl = (ooaofooa_DOC_TBL *) Escher_CreateInstance( ooaofooa_DOMAIN_ID, ooaofooa_DOC_TBL_CLASS_NUMBER ); /* RELATE doc_tbl TO doc_par ACROSS R2315 */ ooaofooa_DOC_TBL_R2315_Link_has( doc_par, doc_tbl ); /* ASSIGN doc_tbl.title = PARAM.title */ doc_tbl->title = Escher_strcpy( doc_tbl->title, p_title ); /* ASSIGN doc_tbl.num_cols = PARAM.num_cols */ doc_tbl->num_cols = p_num_cols; /* RETURN doc_tbl */ {ooaofooa_DOC_TBL * xtumlOALrv = doc_tbl; return xtumlOALrv;} }
/* * instance state machine event dispatching */ void infusion_infusion_Dispatch( Escher_xtUMLEvent_t * event ) { Escher_iHandle_t instance; Escher_EventNumber_t event_number = GetOoaEventNumber( event ); Escher_StateNumber_t current_state; Escher_StateNumber_t next_state; if ( 0 != GetIsCreationEvent( event ) ) { instance = Escher_CreateInstance( infusion_DOMAIN_ID, infusion_infusion_CLASS_NUMBER ); if ( 0 != instance ) { instance->current_state = UNINITIALIZED_STATE; SetEventTargetInstance( event, instance ); } else { /* Instance allocation failure - USER RECOVERY LOGIC IS TBD */ UserEventNoInstanceCallout( 0 ); } } else { instance = GetEventTargetInstance( event ); } if ( 0 != instance ) { current_state = instance->current_state; if ( current_state > 5 ) { /* instance validation failure (object deleted while event in flight) */ UserEventNoInstanceCallout( event_number ); } else { next_state = infusion_infusion_StateEventMatrix[ current_state ][ event_number ]; if ( next_state <= 5 ) { STATE_TXN_START_TRACE( "infusion", current_state, state_name_strings[ current_state ] ); /* Execute the state action and update the current state. */ ( *infusion_infusion_acts[ next_state ] )( instance, event ); STATE_TXN_END_TRACE( "infusion", next_state, state_name_strings[ next_state ] ); instance->current_state = next_state; } else if ( next_state == EVENT_CANT_HAPPEN ) { /* event cant happen */ UserEventCantHappenCallout( current_state, next_state, event_number ); STATE_TXN_CH_TRACE( "infusion", current_state ); } else { /* empty else */ } } } }
static void Escher_load_instance( Escher_ClassNumber_t count, const c_t * wordvalues[] ) { Escher_ClassNumber_t n; Escher_iHandle_t instance; Escher_iHandle_t return_identifier; /* Look up the class number and instance loader using the key letters. */ n = lookupclassloader( wordvalues[ 0 ] ); /* Invoke the creation function using the class number. */ instance = Escher_CreateInstance( 0, class_string_2_class_number[n].class_number ); /* Convert/Populate the attribute values. */ return_identifier = (*class_string_2_class_number[n].instance_loader)( instance, wordvalues ); if ( 0 != return_identifier ) { Escher_instance_cache[ (int) return_identifier ] = instance; } }
/* * Interface: UI * Required Port: UI * From Provider Message: startStopPressed */ void Tracking_UI_startStopPressed() { Tracking_WorkoutTimer * workoutTimer=0; /* SELECT any workoutTimer FROM INSTANCES OF WorkoutTimer */ XTUML_OAL_STMT_TRACE( 1, "SELECT any workoutTimer FROM INSTANCES OF WorkoutTimer" ); workoutTimer = (Tracking_WorkoutTimer *) Escher_SetGetAny( &pG_Tracking_WorkoutTimer_extent.active ); /* IF ( empty workoutTimer ) */ XTUML_OAL_STMT_TRACE( 1, "IF ( empty workoutTimer )" ); if ( ( 0 == workoutTimer ) ) { /* CREATE OBJECT INSTANCE workoutTimer OF WorkoutTimer */ XTUML_OAL_STMT_TRACE( 2, "CREATE OBJECT INSTANCE workoutTimer OF WorkoutTimer" ); workoutTimer = (Tracking_WorkoutTimer *) Escher_CreateInstance( Tracking_DOMAIN_ID, Tracking_WorkoutTimer_CLASS_NUMBER ); /* ASSIGN workoutTimer.time = 0 */ XTUML_OAL_STMT_TRACE( 2, "ASSIGN workoutTimer.time = 0" ); workoutTimer->time = 0; } /* GENERATE WorkoutTimer1:startStopPressed() TO workoutTimer */ XTUML_OAL_STMT_TRACE( 1, "GENERATE WorkoutTimer1:startStopPressed() TO workoutTimer" ); { Escher_xtUMLEvent_t * e = Escher_NewxtUMLEvent( workoutTimer, &Tracking_WorkoutTimerevent1c ); Escher_SendEvent( e ); } }
/* * Interface: synchronization * Provided Port: to_heart * To Provider Message: init */ void pacemaker_to_heart_init( const i_t p_diastolic_period, const i_t p_systolic_period ) { pacemaker_PACER * pacer; /* CREATE OBJECT INSTANCE pacer OF PACER */ XTUML_OAL_STMT_TRACE( 1, "CREATE OBJECT INSTANCE pacer OF PACER" ); pacer = (pacemaker_PACER *) Escher_CreateInstance( pacemaker_DOMAIN_ID, pacemaker_PACER_CLASS_NUMBER ); /* ASSIGN pacer.systolic_tolerance = 25 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN pacer.systolic_tolerance = 25" ); pacer->systolic_tolerance = 25; /* ASSIGN pacer.diastolic_tolerance = 25 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN pacer.diastolic_tolerance = 25" ); pacer->diastolic_tolerance = 25; /* ASSIGN pacer.cycle_count = 0 */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN pacer.cycle_count = 0" ); pacer->cycle_count = 0; /* ASSIGN pacer.systolic_timeout = ( PARAM.systolic_period + ( ( PARAM.systolic_period * pacer.systolic_tolerance ) / 100 ) ) */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN pacer.systolic_timeout = ( PARAM.systolic_period + ( ( PARAM.systolic_period * pacer.systolic_tolerance ) / 100 ) )" ); pacer->systolic_timeout = ( p_systolic_period + ( ( p_systolic_period * pacer->systolic_tolerance ) / 100 ) ); /* ASSIGN pacer.diastolic_timeout = ( PARAM.diastolic_period + ( ( PARAM.diastolic_period * pacer.diastolic_tolerance ) / 100 ) ) */ XTUML_OAL_STMT_TRACE( 1, "ASSIGN pacer.diastolic_timeout = ( PARAM.diastolic_period + ( ( PARAM.diastolic_period * pacer.diastolic_tolerance ) / 100 ) )" ); pacer->diastolic_timeout = ( p_diastolic_period + ( ( p_diastolic_period * pacer->diastolic_tolerance ) / 100 ) ); }
/* * Domain Function: setup */ void sudoku_setup( void ) { sudoku_SEQUENCE * sequence; /* SELECT any sequence FROM INSTANCES OF SEQUENCE */ sequence = (sudoku_SEQUENCE *) Escher_SetGetAny( &pG_sudoku_SEQUENCE_extent.active ); /* IF ( empty sequence ) */ if ( ( 0 == sequence ) ) { i_t i;sudoku_DIGIT * digit;Escher_ObjectSet_s rows_space; Escher_ObjectSet_s * rows = &rows_space; /* rows (ROW) */sudoku_ROW * row;Escher_ObjectSet_s cells_space; Escher_ObjectSet_s * cells = &cells_space; /* cells (CELL) */sudoku_CELL * cell; Escher_InitSet( rows );Escher_InitSet( cells ); /* ASSIGN i = NVS::space_used() */ i = NVS_space_used(); /* IF ( ( i < 100 ) ) */ if ( ( i < 100 ) ) { /* ASSIGN i = NVS::format() */ i = NVS_format(); /* IF ( ( i != 0 ) ) */ if ( ( i != 0 ) ) { /* LOG::LogFailure( message:'Error formatting the NVS.' ) */ LOG_LogFailure( "Error formatting the NVS." ); } } /* LOG::LogInfo( message:'Did not find any PEI data, initializing NVS' ) */ LOG_LogInfo( "Did not find any PEI data, initializing NVS" ); /* ASSIGN i = NVS::version(first:1, second:2) */ i = NVS_version( 1, 2 ); /* ASSIGN i = NVS::checksum(first:1, second:2) */ i = NVS_checksum( 1, 2 ); /* ASSIGN i = 9 */ i = 9; /* WHILE ( ( 0 < i ) ) */ while ( ( 0 < i ) ) { sudoku_DIGIT * digit; /* CREATE OBJECT INSTANCE digit OF DIGIT */ digit = (sudoku_DIGIT *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_DIGIT_CLASS_NUMBER ); /* ASSIGN digit.value = i */ digit->value = i; /* ASSIGN i = ( i - 1 ) */ i = ( i - 1 ); } /* CREATE OBJECT INSTANCE digit OF DIGIT */ digit = (sudoku_DIGIT *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_DIGIT_CLASS_NUMBER ); /* ASSIGN digit.value = 0 */ digit->value = 0; /* ASSIGN i = 9 */ i = 9; /* WHILE ( ( 0 < i ) ) */ while ( ( 0 < i ) ) { sudoku_ROW * row;sudoku_COLUMN * column;sudoku_BOX * box; /* CREATE OBJECT INSTANCE sequence OF SEQUENCE */ sequence = (sudoku_SEQUENCE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER ); /* ASSIGN sequence.solved = FALSE */ sequence->solved = FALSE; /* ASSIGN sequence.requests = 0 */ sequence->requests = 0; /* CREATE OBJECT INSTANCE row OF ROW */ row = (sudoku_ROW *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_ROW_CLASS_NUMBER ); /* ASSIGN row.number = i */ row->number = i; /* RELATE row TO sequence ACROSS R1 */ sudoku_ROW_R1_Link( sequence, row ); /* CREATE OBJECT INSTANCE sequence OF SEQUENCE */ sequence = (sudoku_SEQUENCE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER ); /* ASSIGN sequence.solved = FALSE */ sequence->solved = FALSE; /* ASSIGN sequence.requests = 0 */ sequence->requests = 0; /* CREATE OBJECT INSTANCE column OF COLUMN */ column = (sudoku_COLUMN *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_COLUMN_CLASS_NUMBER ); /* ASSIGN column.number = i */ column->number = i; /* RELATE column TO sequence ACROSS R1 */ sudoku_COLUMN_R1_Link( sequence, column ); /* CREATE OBJECT INSTANCE sequence OF SEQUENCE */ sequence = (sudoku_SEQUENCE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_SEQUENCE_CLASS_NUMBER ); /* ASSIGN sequence.solved = FALSE */ sequence->solved = FALSE; /* ASSIGN sequence.requests = 0 */ sequence->requests = 0; /* CREATE OBJECT INSTANCE box OF BOX */ box = (sudoku_BOX *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_BOX_CLASS_NUMBER ); /* ASSIGN box.number = i */ box->number = i; /* RELATE box TO sequence ACROSS R1 */ sudoku_BOX_R1_Link( sequence, box ); /* ASSIGN i = ( i - 1 ) */ i = ( i - 1 ); } /* SELECT many rows FROM INSTANCES OF ROW */ Escher_CopySet( rows, &pG_sudoku_ROW_extent.active ); /* FOR EACH row IN rows */ { Escher_Iterator_s iter1; sudoku_ROW * sudoku_ROWiter1; Escher_IteratorReset( &iter1, rows ); while ( (sudoku_ROWiter1 = (sudoku_ROW *)Escher_IteratorNext( &iter1 )) != 0 ) { row = sudoku_ROWiter1; { Escher_ObjectSet_s columns_space; Escher_ObjectSet_s * columns = &columns_space; /* columns (COLUMN) */sudoku_COLUMN * column; Escher_InitSet( columns ); /* SELECT many columns FROM INSTANCES OF COLUMN */ Escher_CopySet( columns, &pG_sudoku_COLUMN_extent.active ); /* FOR EACH column IN columns */ { Escher_Iterator_s iter3; sudoku_COLUMN * sudoku_COLUMNiter3; Escher_IteratorReset( &iter3, columns ); while ( (sudoku_COLUMNiter3 = (sudoku_COLUMN *)Escher_IteratorNext( &iter3 )) != 0 ) { column = sudoku_COLUMNiter3; { sudoku_CELL * cell;Escher_ObjectSet_s digits_space; Escher_ObjectSet_s * digits = &digits_space; /* digit (DIGIT) */ Escher_InitSet( digits ); /* CREATE OBJECT INSTANCE cell OF CELL */ cell = (sudoku_CELL *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_CELL_CLASS_NUMBER ); /* SELECT any digit FROM INSTANCES OF DIGIT WHERE ( SELECTED.value == 0 ) */ digit = 0; { sudoku_DIGIT * selected; Escher_Iterator_s iter30_DIGIT; Escher_IteratorReset( &iter30_DIGIT, &pG_sudoku_DIGIT_extent.active ); while ( (selected = (sudoku_DIGIT *) Escher_IteratorNext( &iter30_DIGIT )) != 0 ) { if ( ( selected->value == 0 ) ) { digit = selected; break; } } } /* RELATE cell TO digit ACROSS R9 */ sudoku_CELL_R9_Link( digit, cell ); /* RELATE cell TO row ACROSS R2 */ sudoku_CELL_R2_Link( row, cell ); /* RELATE cell TO column ACROSS R3 */ sudoku_CELL_R3_Link( column, cell ); /* SELECT many digits FROM INSTANCES OF DIGIT WHERE ( SELECTED.value != 0 ) */ Escher_ClearSet( digits ); { sudoku_DIGIT * selected; Escher_Iterator_s iter31_DIGIT; Escher_IteratorReset( &iter31_DIGIT, &pG_sudoku_DIGIT_extent.active ); while ( (selected = (sudoku_DIGIT *) Escher_IteratorNext( &iter31_DIGIT )) != 0 ) { if ( ( selected->value != 0 ) ) { Escher_SetInsertElement( digits, selected ); } } } /* FOR EACH digit IN digits */ { Escher_Iterator_s iter4; sudoku_DIGIT * sudoku_DIGITiter4; Escher_IteratorReset( &iter4, digits ); while ( (sudoku_DIGITiter4 = (sudoku_DIGIT *)Escher_IteratorNext( &iter4 )) != 0 ) { digit = sudoku_DIGITiter4; { sudoku_ELIGIBLE * eligible; /* CREATE OBJECT INSTANCE eligible OF ELIGIBLE */ eligible = (sudoku_ELIGIBLE *) Escher_CreateInstance( sudoku_DOMAIN_ID, sudoku_ELIGIBLE_CLASS_NUMBER ); /* RELATE digit TO cell ACROSS R8 USING eligible */ sudoku_ELIGIBLE_R8_Link( cell, digit, eligible ); }} } Escher_ClearSet( digits ); /* Clear set: digit */ }} } Escher_ClearSet( columns ); }} } /* SELECT many cells FROM INSTANCES OF CELL */ Escher_CopySet( cells, &pG_sudoku_CELL_extent.active ); /* FOR EACH cell IN cells */ { Escher_Iterator_s iter2; sudoku_CELL * sudoku_CELLiter2; Escher_IteratorReset( &iter2, cells ); while ( (sudoku_CELLiter2 = (sudoku_CELL *)Escher_IteratorNext( &iter2 )) != 0 ) { cell = sudoku_CELLiter2; { /* IF ( ( ( cell.row_number <= 3 ) and ( cell.column_number <= 3 ) ) ) */ if ( ( ( cell->row_number <= 3 ) && ( cell->column_number <= 3 ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 1 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter32_BOX; Escher_IteratorReset( &iter32_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter32_BOX )) != 0 ) { if ( ( selected->number == 1 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( cell->row_number <= 3 ) && ( ( 4 <= cell->column_number ) && ( cell->column_number <= 6 ) ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 2 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter33_BOX; Escher_IteratorReset( &iter33_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter33_BOX )) != 0 ) { if ( ( selected->number == 2 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( cell->row_number <= 3 ) && ( 7 <= cell->column_number ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 3 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter34_BOX; Escher_IteratorReset( &iter34_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter34_BOX )) != 0 ) { if ( ( selected->number == 3 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( ( 4 <= cell->row_number ) && ( cell->row_number <= 6 ) ) && ( cell->column_number <= 3 ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 4 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter35_BOX; Escher_IteratorReset( &iter35_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter35_BOX )) != 0 ) { if ( ( selected->number == 4 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( ( 4 <= cell->row_number ) && ( cell->row_number <= 6 ) ) && ( ( 4 <= cell->column_number ) && ( cell->column_number <= 6 ) ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 5 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter36_BOX; Escher_IteratorReset( &iter36_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter36_BOX )) != 0 ) { if ( ( selected->number == 5 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( ( 4 <= cell->row_number ) && ( cell->row_number <= 6 ) ) && ( 7 <= cell->column_number ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 6 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter37_BOX; Escher_IteratorReset( &iter37_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter37_BOX )) != 0 ) { if ( ( selected->number == 6 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( 7 <= cell->row_number ) && ( cell->column_number <= 3 ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 7 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter38_BOX; Escher_IteratorReset( &iter38_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter38_BOX )) != 0 ) { if ( ( selected->number == 7 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( 7 <= cell->row_number ) && ( ( 4 <= cell->column_number ) && ( cell->column_number <= 6 ) ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 8 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter39_BOX; Escher_IteratorReset( &iter39_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter39_BOX )) != 0 ) { if ( ( selected->number == 8 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } else if ( ( ( 7 <= cell->row_number ) && ( 7 <= cell->column_number ) ) ) { sudoku_BOX * box; /* SELECT any box FROM INSTANCES OF BOX WHERE ( SELECTED.number == 9 ) */ box = 0; { sudoku_BOX * selected; Escher_Iterator_s iter40_BOX; Escher_IteratorReset( &iter40_BOX, &pG_sudoku_BOX_extent.active ); while ( (selected = (sudoku_BOX *) Escher_IteratorNext( &iter40_BOX )) != 0 ) { if ( ( selected->number == 9 ) ) { box = selected; break; } } } /* RELATE cell TO box ACROSS R4 */ sudoku_CELL_R4_Link( box, cell ); } }} } Escher_ClearSet( rows );Escher_ClearSet( cells ); } else { /* LOG::LogInfo( message:'PEI data found.' ) */ LOG_LogInfo( "PEI data found." ); } }
/* * class operation: update */ void monitor_pulse_op_update( const i_t p_pulse ) { monitor_pulse * pulse=0;monitor_vitalsign * vitalsign=0; /* SELECT any pulse FROM INSTANCES OF pulse */ XTUML_OAL_STMT_TRACE( 1, "SELECT any pulse FROM INSTANCES OF pulse" ); pulse = (monitor_pulse *) Escher_SetGetAny( &pG_monitor_pulse_extent.active ); /* SELECT one vitalsign RELATED BY pulse->vitalsign[R2] */ XTUML_OAL_STMT_TRACE( 1, "SELECT one vitalsign RELATED BY pulse->vitalsign[R2]" ); vitalsign = ( 0 != pulse ) ? pulse->vitalsign_R2 : 0; /* IF ( not_empty vitalsign ) */ XTUML_OAL_STMT_TRACE( 1, "IF ( not_empty vitalsign )" ); if ( ( 0 != vitalsign ) ) { monitor_alarm * redalarm=0;monitor_alarm * yellowalarm=0; /* ASSIGN vitalsign.value = PARAM.pulse */ XTUML_OAL_STMT_TRACE( 2, "ASSIGN vitalsign.value = PARAM.pulse" ); vitalsign->value = p_pulse; /* SEND UI::display(name:vitalsign.name, value:vitalsign.value) */ XTUML_OAL_STMT_TRACE( 2, "SEND UI::display(name:vitalsign.name, value:vitalsign.value)" ); monitor_UI_display( vitalsign->name, vitalsign->value ); /* SELECT one redalarm RELATED BY vitalsign->alarm[R7] WHERE ( ( SELECTED.color == red ) ) */ XTUML_OAL_STMT_TRACE( 2, "SELECT one redalarm RELATED BY vitalsign->alarm[R7] WHERE ( ( SELECTED.color == red ) )" ); {redalarm = 0; {monitor_alarm * selected = ( 0 != vitalsign ) ? vitalsign->alarm_R7_sounds : 0; if ( ( 0 != selected ) && ( selected->color == capssys_color_red_e ) ) { redalarm = selected; }}} /* SELECT one yellowalarm RELATED BY vitalsign->alarm[R7] WHERE ( ( SELECTED.color == yellow ) ) */ XTUML_OAL_STMT_TRACE( 2, "SELECT one yellowalarm RELATED BY vitalsign->alarm[R7] WHERE ( ( SELECTED.color == yellow ) )" ); {yellowalarm = 0; {monitor_alarm * selected = ( 0 != vitalsign ) ? vitalsign->alarm_R7_sounds : 0; if ( ( 0 != selected ) && ( selected->color == capssys_color_yellow_e ) ) { yellowalarm = selected; }}} /* IF ( ( vitalsign.value < vitalsign.yellow_threshold ) ) */ XTUML_OAL_STMT_TRACE( 2, "IF ( ( vitalsign.value < vitalsign.yellow_threshold ) )" ); if ( ( vitalsign->value < vitalsign->yellow_threshold ) ) { /* IF ( empty redalarm ) */ XTUML_OAL_STMT_TRACE( 3, "IF ( empty redalarm )" ); if ( ( 0 == redalarm ) ) { /* IF ( not_empty yellowalarm ) */ XTUML_OAL_STMT_TRACE( 4, "IF ( not_empty yellowalarm )" ); if ( ( 0 != yellowalarm ) ) { /* UNRELATE yellowalarm FROM vitalsign ACROSS R7 */ XTUML_OAL_STMT_TRACE( 5, "UNRELATE yellowalarm FROM vitalsign ACROSS R7" ); monitor_alarm_R7_Unlink_sounds( vitalsign, yellowalarm ); /* DELETE OBJECT INSTANCE yellowalarm */ XTUML_OAL_STMT_TRACE( 5, "DELETE OBJECT INSTANCE yellowalarm" ); if ( 0 == yellowalarm ) { XTUML_EMPTY_HANDLE_TRACE( "alarm", "Escher_DeleteInstance" ); } Escher_DeleteInstance( (Escher_iHandle_t) yellowalarm, monitor_DOMAIN_ID, monitor_alarm_CLASS_NUMBER ); } /* CREATE OBJECT INSTANCE redalarm OF alarm */ XTUML_OAL_STMT_TRACE( 4, "CREATE OBJECT INSTANCE redalarm OF alarm" ); redalarm = (monitor_alarm *) Escher_CreateInstance( monitor_DOMAIN_ID, monitor_alarm_CLASS_NUMBER ); /* ASSIGN redalarm.color = red */ XTUML_OAL_STMT_TRACE( 4, "ASSIGN redalarm.color = red" ); redalarm->color = capssys_color_red_e; /* RELATE redalarm TO vitalsign ACROSS R7 */ XTUML_OAL_STMT_TRACE( 4, "RELATE redalarm TO vitalsign ACROSS R7" ); monitor_alarm_R7_Link_sounds( vitalsign, redalarm ); } } else if ( ( vitalsign->value < vitalsign->yellow_threshold ) ) { /* IF ( empty yellowalarm ) */ XTUML_OAL_STMT_TRACE( 3, "IF ( empty yellowalarm )" ); if ( ( 0 == yellowalarm ) ) { /* CREATE OBJECT INSTANCE yellowalarm OF alarm */ XTUML_OAL_STMT_TRACE( 4, "CREATE OBJECT INSTANCE yellowalarm OF alarm" ); yellowalarm = (monitor_alarm *) Escher_CreateInstance( monitor_DOMAIN_ID, monitor_alarm_CLASS_NUMBER ); /* ASSIGN yellowalarm.color = yellow */ XTUML_OAL_STMT_TRACE( 4, "ASSIGN yellowalarm.color = yellow" ); yellowalarm->color = capssys_color_yellow_e; /* RELATE yellowalarm TO vitalsign ACROSS R7 */ XTUML_OAL_STMT_TRACE( 4, "RELATE yellowalarm TO vitalsign ACROSS R7" ); monitor_alarm_R7_Link_sounds( vitalsign, yellowalarm ); } } else { } } }