blob: 3b4f49c7fb205cba2873a504a9ffba018cd8994e [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_CLL_LGenBase_EventHandlingFunctions
//
// Purpose:
// This module provides functions related to event dispatching
// and receiving in TitanSim load generators
//
// Module Parameters:
// -
//
// Module depends on:
// <>
//
// Current Owner:
// ELSZSKU
//
// Last Review Date:
// 2008-
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
module EPTF_CLL_LGenBase_EventHandlingFunctions
{
import from EPTF_CLL_Base_Functions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_StatMeasure_Functions all
import from EPTF_CLL_LGenBase_ConfigDefinitions all;
import from EPTF_CLL_LGenBase_ConfigFunctions all;
import from EPTF_CLL_LGenBase_LoggingFunctions all;
import from EPTF_CLL_FBQ_Definitions all;
import from EPTF_CLL_FBQ_Functions all;
import from EPTF_CLL_HashMapInt2Int_Functions all;
import from EPTF_CLL_HashMapStr2Int_Functions all;
import from EPTF_CLL_Scheduler_Definitions all;
import from EPTF_CLL_LGenBase_ExternalFunctions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_StatHandlerClient_Functions all;
import from EPTF_CLL_LGenBase_Definitions all;
import from EPTF_CLL_RBTScheduler_Functions all;
import from EPTF_CLL_Common_IndexArrayFunctions all
import from TCCConversion_Functions all
import from EPTF_CLL_LGenBase_TrafficFunctions all; // f_EPTF_LGenBase_disableEntityInTrafficCase
friend module EPTF_CLL_LGenBase_StepFunctions; // f_EPTF_LGenBase_TimerActionHandler
friend module EPTF_CLL_LGenBase_TrafficFunctions; // f_EPTF_LGenBase_activateFsmGroup
group Dispatch{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_dispatchEvent
//
// Purpose:
// Report an event to the appropriate listeners.
//
// Parameters:
// pl_event - *in* - <EPTF_LGenBase_EventDescriptor> - the event occured
//
// Return Value:
// -
//
// Errors:
// -
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_dispatchEvent(in EPTF_LGenBase_ReportedEventDescriptor pl_event)
runs on EPTF_LGenBase_Private_CT{
if (c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": Invalid behavior index. Special LGenBase events (events with negative behavior index) must not be dispatched!",
pl_event.event.bIdx > -1);
}
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugEventDispatch)){
f_EPTF_LGenBase_loggingDebugEventDispatch(log2str(%definitionId,": dispatching event:=", pl_event))
}
f_EPTF_LGenBase_privateDispatchEvent(pl_event, false, pl_event.event.bIdx, pl_event.event.iIdx);
}
private function f_EPTF_LGenBase_fillSourceFromStep(
inout EPTF_LGenBase_ReportedEventDescriptor pl_event,
in EPTF_LGenBase_TestStepArgs pl_args)
runs on EPTF_LGenBase_Private_CT{
pl_event.event.source.eIdx := pl_args.eIdx
pl_event.event.source.fsmCtxIdx := pl_args.refContext.fCtxIdx
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_dispatchEventFromStep
//
// Purpose:
// Report an event to the appropriate listeners, and
// fills up the source from the incoming step arguments.
//
// Parameters:
// pl_event - *in* - <EPTF_LGenBase_EventDescriptor> - the event occured
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_dispatchEventFromStep(
inout EPTF_LGenBase_ReportedEventDescriptor pl_event,
in EPTF_LGenBase_TestStepArgs pl_args)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_fillSourceFromStep(pl_event,pl_args)
f_EPTF_LGenBase_dispatchEvent(pl_event);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_postEventFromStep
//
// Purpose:
// Post an event to the appropriate listeners, and
// fills up the source from the incoming step arguments.
//
// Parameters:
// pl_event - *in* - <EPTF_LGenBase_EventDescriptor> - the event occured
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_postEventFromStep(
inout EPTF_LGenBase_ReportedEventDescriptor pl_event,
in EPTF_LGenBase_TestStepArgs pl_args)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_fillSourceFromStep(pl_event,pl_args)
f_EPTF_LGenBase_postEvent(pl_event);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_postEvent
//
// Purpose:
// Report an event to the appropriate listeners after processing
// all running event dispatching
//
// Parameters:
// pl_event - *in* - <EPTF_LGenBase_EventDescriptor> - the event occured
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_postEvent(in EPTF_LGenBase_ReportedEventDescriptor pl_event)
runs on EPTF_LGenBase_Private_CT{
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugEventDispatch)){
f_EPTF_LGenBase_loggingDebugEventDispatch(log2str(%definitionId,": posting event:=", pl_event))
}
if(0 != v_LGenBase_reportEventIsRunning){
var integer vl_slot := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_postedEventsQueue);
v_LGenBase_postedEvents[vl_slot] := pl_event;
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_slot, v_LGenBase_postedEventsQueue);
}else{
f_EPTF_LGenBase_dispatchEvent(pl_event);
f_EPTF_LGenBase_checkEvents2Post();
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_dispatchReply
//
// Purpose:
// Dispatches an event to the source FSM of the currently received event.
//
// Parameters:
// - pl_behaviorIdx - *in* - *integer* - the behavior index of the event
// - pl_inputIdx - *in* - *integer* - the input index of the event
// - reportedArgs - <EPTF_IntegerList> - the actual reported arguments of
// the event determined by the reporter
// - pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - arguments for the test
// step the function has been called from.
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_dispatchReply(
in integer pl_behaviorIdx,
in integer pl_inputIdx,
in EPTF_IntegerList pl_reportedArgs,
in EPTF_LGenBase_TestStepArgs pl_args)
runs on EPTF_LGenBase_Private_CT {
if (c_EPTF_Common_debugSwitch) { f_EPTF_LGenBase_checkFsmSource(%definitionId, pl_args) };
f_EPTF_LGenBase_dispatchEvent({
{
pl_behaviorIdx,
pl_inputIdx,
{pl_args.reportedEvent.event.source.eIdx,
pl_args.reportedEvent.event.source.fsmCtxIdx},
{pl_args.eIdx, pl_args.refContext.fCtxIdx}
},
pl_reportedArgs
});
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_postReply
//
// Purpose:
// Posts an event to the source FSM of the currently received event.
//
// Parameters:
// - pl_behaviorIdx - *in* - *integer* - the behavior index of the event
// - pl_inputIdx - *in* - *integer* - the input index of the event
// - reportedArgs - <EPTF_IntegerList> - the actual reported arguments of
// the event determined by the reporter
// - pl_ptr - *in* <EPTF_LGenBase_TestStepArgs> - arguments for the test
// step the function has been called from.
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_postReply(
in integer pl_behaviorIdx,
in integer pl_inputIdx,
in EPTF_IntegerList pl_reportedArgs,
in EPTF_LGenBase_TestStepArgs pl_args)
runs on EPTF_LGenBase_Private_CT{
if (c_EPTF_Common_debugSwitch) { f_EPTF_LGenBase_checkFsmSource(%definitionId, pl_args) };
f_EPTF_LGenBase_postEvent({
{
pl_behaviorIdx,
pl_inputIdx,
{pl_args.reportedEvent.event.source.eIdx,
pl_args.reportedEvent.event.source.fsmCtxIdx},
{pl_args.eIdx, pl_args.refContext.fCtxIdx}
},
pl_reportedArgs
});
}
}
group ListenerManagement{
group eventFromSibling{
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_activateSiblingListener
//
// Purpose:
// Activates a listener listening to an event with the specified behavior and input index
// From a specified FSM to the given FSM
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_iIdx - *in* *integer* - the index of the registered FSM input returned by the <f_EPTF_LGenBase_declareFsmEvent> function
// pl_siblingIdx - *in* *integer* - the sibling index of the source FSM
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_activateSiblingListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_fCtxIdx,
in integer pl_siblingIdx,
in integer pl_listenerIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
//TODO asserts
//Where to store?
//FSM event - store it in the FSM context
//Get the fsmCtxIdx from the sibling Idx
//First get the TC idx
var integer vl_tcIdx := f_EPTF_LGenBase_tcIdxOfFSM(pl_eIdx, pl_fCtxIdx)
if(c_EPTF_Common_debugSwitch){
f_EPTF_Base_assert(%definitionId&": The specified FSM context #"&int2str(pl_fCtxIdx)&
" of entity#"&int2str(pl_eIdx)&" is not joined to a traffic case.", -1 < vl_tcIdx)
f_EPTF_Base_assert(%definitionId&": Invalid sibling index#"&int2str(pl_siblingIdx)&
" of entity#"&int2str(pl_eIdx)&" traffic case "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName,
sizeof(v_LGenBase_trafficCases[vl_tcIdx].fsmList)>=pl_siblingIdx)
}
//Get the FSM ctx idx
var integer vl_fsmIdxOfSibling := f_EPTF_LGenBase_fsmCtxIdxOfSibling(pl_eIdx, vl_tcIdx, pl_siblingIdx)
var integer vl_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
f_EPTF_FBQ_setQueueDidx(vl_idx, {pl_listenerIdx}, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_idx, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
return vl_idx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_deactivateSiblingListener
//
// Purpose:
// Dectivates a listener listening to an event with the specified behavior and input index
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_iIdx - *in* *integer* - the index of the registered FSM input returned by the <f_EPTF_LGenBase_declareFsmEvent> function
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_deactivateSiblingListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_fIdx,
in integer pl_siblingIdx,
in integer pl_listenerIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
//TODO asserts
f_EPTF_FBQ_moveFromBusyToFreeTail(pl_listenerIdx, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
return f_EPTF_FBQ_getQueueData(pl_listenerIdx, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx],0);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addBehaviorListener
//
// Purpose:
// Adds the listener to the database by the <f_EPTF_LGenBase_addListener>
// and activates it by the <f_EPTF_LGenBase_activateBehaviorListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addSiblingListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_fIdx,
in integer pl_siblingIdx,
in EPTF_LGenBase_EventListener_FT pl_fn,
in EPTF_IntegerList pl_args
)
runs on EPTF_LGenBase_Private_CT return integer{
//TODO asserts
var integer vl_listenerIdx := f_EPTF_LGenBase_addListener(pl_fn, pl_args);
return f_EPTF_LGenBase_activateSiblingListener(pl_bIdx, pl_iIdx, pl_eIdx, pl_fIdx, pl_siblingIdx, vl_listenerIdx)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeBehaviorListener
//
// Purpose:
// Deactivates the listener by the <f_EPTF_LGenBase_deactivateBehaviorListener>
// and removes it from the listener database by the <f_EPTF_LGenBase_removeListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeSiblingListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_fIdx,
in integer pl_siblingIdx,
in integer pl_idx2Remove)
runs on EPTF_LGenBase_Private_CT{
//TODO asserts
var integer vl_listenerIdx := f_EPTF_LGenBase_deactivateSiblingListener(pl_bIdx, pl_iIdx, pl_eIdx, pl_fIdx, pl_siblingIdx, pl_idx2Remove)
f_EPTF_LGenBase_removeListener(vl_listenerIdx);
}
}
group eventTypeBehavior {
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_activateBehaviorListener
//
// Purpose:
// Activates a listener listening to an event of a specified behavior
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_activateBehaviorListener(
in integer pl_bIdx,
in integer pl_listenerIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&" Invalid behavior index",
(pl_bIdx>=0 and pl_bIdx<sizeof(v_LGenBase_behaviorTypes))
);
var integer vl_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_behaviorTypes[pl_bIdx].listeners);
f_EPTF_FBQ_setQueueDidx(vl_idx, {pl_listenerIdx}, v_LGenBase_behaviorTypes[pl_bIdx].listeners);
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_idx, v_LGenBase_behaviorTypes[pl_bIdx].listeners);
v_LGenBase_hasBehaviorListener := true
return vl_idx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_deactivateBehaviorListener
//
// Purpose:
// Deactivates a listener activated by the <f_EPTF_LGenBase_activateBehaviorListener> function
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_idx2Remove - *in* *integer* - the index of the activated listener, returned by the <f_EPTF_LGenBase_activateBehaviorListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_deactivateBehaviorListener(
in integer pl_bIdx,
in integer pl_idx2Remove)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_Base_assert(%definitionId&" Invalid entity index",
(pl_bIdx>=0 and pl_bIdx<sizeof(v_LGenBase_behaviorTypes))
);
f_EPTF_FBQ_moveFromBusyToFreeTail(pl_idx2Remove, v_LGenBase_behaviorTypes[pl_bIdx].listeners);
v_LGenBase_hasBehaviorListener := 0 != f_EPTF_FBQ_getLengthOfBusyChain(v_LGenBase_behaviorTypes[pl_bIdx].listeners)
return f_EPTF_FBQ_getQueueData(pl_idx2Remove, v_LGenBase_behaviorTypes[pl_bIdx].listeners, 0);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addBehaviorListener
//
// Purpose:
// Adds the listener to the database by the <f_EPTF_LGenBase_addListener>
// and activates it by the <f_EPTF_LGenBase_activateBehaviorListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addBehaviorListener(
in integer pl_bIdx,
in EPTF_LGenBase_EventListener_FT pl_fn,
in EPTF_IntegerList pl_args
)
runs on EPTF_LGenBase_Private_CT return integer{
var integer vl_listenerIdx := f_EPTF_LGenBase_addListener(pl_fn, pl_args);
return f_EPTF_LGenBase_activateBehaviorListener(pl_bIdx, vl_listenerIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeBehaviorListener
//
// Purpose:
// Deactivates the listener by the <f_EPTF_LGenBase_deactivateBehaviorListener>
// and removes it from the listener database by the <f_EPTF_LGenBase_removeListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeBehaviorListener(
in integer pl_eIdx,
in integer pl_idx2Remove)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&" Invalid entity index",
(pl_eIdx>=0 and pl_eIdx<sizeof(v_LGenBase_entities))
);
var integer vl_listenerIdx := f_EPTF_LGenBase_deactivateBehaviorListener(pl_eIdx, pl_idx2Remove);
f_EPTF_LGenBase_removeListener(vl_listenerIdx);
}
};
group eventTypeGeneral {
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_activateGeneralListener
//
// Purpose:
// Activates a listener listening to an event with the specified behavior and input index
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_iIdx - *in* *integer* - the index of the registered FSM input returned by the <f_EPTF_LGenBase_declareFsmEvent> function
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_activateGeneralListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_listenerIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
//v_LGenBase_genericEventListeners[pl_eventDesc.bIdx][pl_eventDesc.iIdx].list[vl_idx] := pl_listenerIdx;
f_EPTF_FBQ_setQueueDidx(vl_idx, {pl_listenerIdx}, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_idx, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
return vl_idx;
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_deactivateGeneralListener
//
// Purpose:
// Dectivates a listener listening to an event with the specified behavior and input index
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_iIdx - *in* *integer* - the index of the registered FSM input returned by the <f_EPTF_LGenBase_declareFsmEvent> function
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_deactivateGeneralListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_listenerIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
f_EPTF_FBQ_moveFromBusyToFreeTail(pl_listenerIdx, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx]);
return f_EPTF_FBQ_getQueueData(pl_listenerIdx, v_LGenBase_genericEventListeners[pl_bIdx][pl_iIdx],0);
}
////////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addGenericEventListener
//
// Purpose:
// It is used for activating an event listener at the generic-events level.
//
// Parameters:
// - pl_event - *in* <EPTF_LGenBase_ReportableEventDescriptor> - the event to
// be listened to, must be a regular event with target field omit-ed, asserted
// - pl_descr - *in* <EPTF_LGenBase_EventListenerDescriptor> - the listener
// to be activated
//
// Return Value:
// -
// index of the particular event
//
// Errors:
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addGenericEventListener(
in EPTF_LGenBase_ReportableEventDescriptor pl_event,
in EPTF_LGenBase_EventListenerDescriptor pl_descr
)
runs on EPTF_LGenBase_Private_CT return integer{
f_EPTF_LGenBase_loggingWarning(%definitionId&": The obsolete f_EPTF_LGenBase_addGenericEventListener has been called."&
" Use the f_EPTF_LGenBase_addGeneralEventListener instead.");
f_EPTF_Base_assert(%definitionId&" Event target field must be omit",
not ispresent(pl_event.target));
return f_EPTF_LGenBase_addGeneralEventListener(pl_event.bIdx, pl_event.iIdx,pl_descr.fn, pl_descr.args)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addGeneralEventListener
//
// Purpose:
// Adds the listener to the database by the <f_EPTF_LGenBase_addListener>
// and activates it by the <f_EPTF_LGenBase_activateGeneralListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addGeneralEventListener(
in integer pl_bIdx,
in integer pl_iIdx,
in EPTF_LGenBase_EventListener_FT pl_fn,
in EPTF_IntegerList pl_args
)
runs on EPTF_LGenBase_Private_CT return integer{
f_EPTF_Base_assert(%definitionId&" behavior type index",
(pl_bIdx>=0 and pl_bIdx<sizeof(v_LGenBase_behaviorTypes))
);
f_EPTF_Base_assert(%definitionId&" Event/input index",
pl_iIdx>=0
and pl_iIdx<sizeof(v_LGenBase_fsmEvents[pl_bIdx]));
var integer vl_listenerIdx := f_EPTF_LGenBase_addListener(pl_fn, pl_args);
return f_EPTF_LGenBase_activateGeneralListener(pl_bIdx,pl_iIdx,vl_listenerIdx);
}
////////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeGenericEventListener
//
// Purpose:
// Obsolete function to deactivating an event listener at the generic-events level.
// Use f_EPTF_LGenBase_removeGeneralEventListener instead
////////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeGenericEventListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_idx2Remove
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_LGenBase_removeGeneralEventListener( pl_bIdx, pl_iIdx, pl_idx2Remove);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeGeneralEventListener
//
// Purpose:
// Deactivates the listener by the <f_EPTF_LGenBase_deactivateGeneralListener>
// and removes it from the listener database by the <f_EPTF_LGenBase_removeListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeGeneralEventListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_idx2Remove
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&" Invalid behavior type index",
(pl_bIdx>=0 and pl_bIdx<sizeof(v_LGenBase_behaviorTypes))
);
f_EPTF_Base_assert(%definitionId&" Invalid event/input index",
pl_iIdx>=0
and pl_iIdx<sizeof(v_LGenBase_fsmEvents[pl_bIdx]));
f_EPTF_Base_assert(%definitionId&" Invalid listener reference index", pl_idx2Remove>=0);
var integer vl_listenerIdx :=
f_EPTF_LGenBase_deactivateGeneralListener(pl_bIdx, pl_iIdx, pl_idx2Remove);
f_EPTF_LGenBase_removeListener(vl_listenerIdx);
}
}; //group eventTypeGeneral
group eventTypeEntity {
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_activateEntityListener
//
// Purpose:
// Activates a listener listening to an event with the specified behavior, input index and target entity index
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_iIdx - *in* *integer* - the index of the registered FSM input returned by the <f_EPTF_LGenBase_declareFsmEvent> function
// pl_eIdx - *in* *integer* - the index of the target entity
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_activateEntityListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_listenerIdx)
runs on EPTF_LGenBase_Private_CT
return integer{
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": Behavior: ",f_EPTF_LGenBase_bIdx2Str(pl_bIdx),
" Input: ",f_EPTF_LGenBase_iIdx2Str(pl_bIdx, pl_iIdx),
" Entity#",pl_eIdx," Listener idx: ",pl_listenerIdx))
}
//Is there registered listener?
var integer vl_listenerListIdx
if(not f_EPTF_int2int_HashMap_Find(
v_LGenBase_behaviorTypes[pl_bIdx].entityListenerHashmapRefs[pl_iIdx],
pl_eIdx,
vl_listenerListIdx)){
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": Entity#",pl_eIdx," not found in listener hashmap of behavior ",
f_EPTF_LGenBase_bIdx2Str(pl_bIdx), " input ",f_EPTF_LGenBase_iIdx2Str(pl_bIdx,pl_iIdx)))
}
//No, there isn't. Let's create one.
vl_listenerListIdx := f_EPTF_Common_IndexArray_setNewElement(v_LGenBase_entities[pl_eIdx].entityListenerListsQueue);
v_LGenBase_entities[pl_eIdx].entityListenerLists[vl_listenerListIdx] := c_EPTF_LGenBase_emptyArrayListenerList;
f_EPTF_int2int_HashMap_Insert(
v_LGenBase_behaviorTypes[pl_bIdx].entityListenerHashmapRefs[pl_iIdx],
pl_eIdx,
vl_listenerListIdx)
}
return f_EPTF_Common_IndexArray_setNewElement(v_LGenBase_entities[pl_eIdx].entityListenerLists[vl_listenerListIdx], pl_listenerIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_deactivateEntityListener
//
// Purpose:
// Dectivates a listener listening to an event with the specified behavior, input index and target entity index
//
// Parameters:
// pl_bIdx - *in* *integer* - the index of the registered behavior returned by the <f_EPTF_LGenBase_declareBehaviorType> function
// pl_iIdx - *in* *integer* - the index of the registered FSM input returned by the <f_EPTF_LGenBase_declareFsmEvent> function
// pl_eIdx - *in* *integer* - the absolute index of the entity
// pl_listenerIdx - *in* *integer* - the index of the added listener, returned by the <f_EPTF_LGenBase_addListener>
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_deactivateEntityListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_idx2Remove)
runs on EPTF_LGenBase_Private_CT
return integer{
var integer vl_listenerListIdx;
if(not f_EPTF_int2int_HashMap_Find(
v_LGenBase_behaviorTypes[pl_bIdx].entityListenerHashmapRefs[pl_iIdx],
pl_eIdx,
vl_listenerListIdx)){
f_EPTF_LGenBase_loggingWarning(%definitionId&": Invalid index.")
return -1;
}
var integer vl_ret := f_EPTF_Common_IndexArray_freeElement(v_LGenBase_entities[pl_eIdx].entityListenerLists[vl_listenerListIdx],pl_idx2Remove);
if(f_EPTF_Common_IndexArray_arrayIsEmpty(
v_LGenBase_entities[pl_eIdx].entityListenerLists[vl_listenerListIdx])){
//There are no more listeners. Remove the list and the reference from the hashmap
var integer vl_pos := f_EPTF_Common_IndexArray_freeElement(v_LGenBase_entities[pl_eIdx].entityListenerListsQueue,vl_listenerListIdx);
f_EPTF_Base_assert(%definitionId&" Invalid element in entity listener list!",vl_pos >= 0)
f_EPTF_int2int_HashMap_Erase(
v_LGenBase_behaviorTypes[pl_bIdx].entityListenerHashmapRefs[pl_iIdx],
pl_eIdx)
}
return vl_ret;
}
////////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addEntityEventListener
//
// Purpose:
// It is used for activating an event listener at the entity-events level.
//
// Parameters:
// - pl_event - *in* <EPTF_LGenBase_ReportableEventDescriptor> - the event to
// be listened to, must be valid, target field must be present, asserted
// - pl_descr - *in* <EPTF_LGenBase_EventListenerDescriptor> - the listener
// to be activated
//
// Return Value:
// -
// index of the particular event
//
// Errors:
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addEntityEventListener(
in EPTF_LGenBase_ReportableEventDescriptor pl_event,
in EPTF_LGenBase_EventListenerDescriptor pl_descr
)
runs on EPTF_LGenBase_Private_CT return integer{
f_EPTF_LGenBase_loggingWarning(%definitionId&": The obsolete f_EPTF_LGenBase_addEntityEventListener has been called."&
" Use the f_EPTF_LGenBase_addEntityEventListener2 instead.");
return f_EPTF_LGenBase_addEntityEventListener2(
pl_event.bIdx, pl_event.iIdx, pl_event.target.eIdx, pl_descr.fn, pl_descr.args)
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_addEntityEventListener2
//
// Purpose:
// Adds the listener to the database by the <f_EPTF_LGenBase_addListener>
// and activates it by the <f_EPTF_LGenBase_activateEntityListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_addEntityEventListener2(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in EPTF_LGenBase_EventListener_FT pl_fn,
in EPTF_IntegerList pl_args)
runs on EPTF_LGenBase_Private_CT return integer{
f_EPTF_Base_assert(%definitionId&" behavior type index",
(pl_bIdx>=0 and pl_bIdx<sizeof(v_LGenBase_behaviorTypes))
);
f_EPTF_Base_assert(%definitionId&" Event/input index",
pl_iIdx>=0
and pl_iIdx<sizeof(v_LGenBase_fsmEvents[pl_bIdx]));
f_EPTF_Base_assert(%definitionId&" Entity index",
pl_eIdx>=0 and pl_eIdx<sizeof(v_LGenBase_entities));
var integer vl_listenerIdx := f_EPTF_LGenBase_addListener(pl_fn, pl_args);
return f_EPTF_LGenBase_activateEntityListener(pl_bIdx, pl_iIdx, pl_eIdx, vl_listenerIdx);
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeEntityEventListener2
//
// Purpose:
// Deactivates the listener by the <f_EPTF_LGenBase_deactivateEntityListener>
// and removes it from the listener database by the <f_EPTF_LGenBase_removeListener> function
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeEntityEventListener2(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx,
in integer pl_idx2Remove
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_listenerIdx := f_EPTF_LGenBase_deactivateEntityListener(pl_bIdx, pl_iIdx, pl_eIdx, pl_idx2Remove);
f_EPTF_LGenBase_removeListener(vl_listenerIdx);
}
////////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_removeEntityEventListener
//
// Purpose:
// It is used for deactivating an event listener at the entity-events level.
////////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_removeEntityEventListener(
in integer pl_bIdx,
in integer pl_iIdx,
in integer pl_eIdx
)
runs on EPTF_LGenBase_Private_CT{
f_EPTF_Base_assert(%definitionId&" behavior type index",
(pl_bIdx>=0 and pl_bIdx<sizeof(v_LGenBase_behaviorTypes))
);
f_EPTF_Base_assert(%definitionId&" Event/input index",
pl_iIdx>=0
and pl_iIdx<sizeof(v_LGenBase_fsmEvents[pl_bIdx]));
f_EPTF_Base_assert(%definitionId&" Entity index",
pl_eIdx>=0 and pl_eIdx<sizeof(v_LGenBase_entities));
f_EPTF_LGenBase_loggingWarning(%definitionId&": The obsolete f_EPTF_LGenBase_removeEntityEventListener function has been called."&
"This function removes all the entity listeners listening to the entity event having behavior "&
int2str(pl_bIdx)&", input index "& int2str(pl_iIdx)&", target entity "& int2str(pl_eIdx))
var integer vl_listenerListIdx;
if (not f_EPTF_int2int_HashMap_Find (v_LGenBase_behaviorTypes[pl_bIdx].entityListenerHashmapRefs[pl_iIdx],
pl_eIdx,
vl_listenerListIdx)) {
return
}
var integer vl_idx := -1;
while ( not f_EPTF_Common_IndexArray_arrayIsEmpty(v_LGenBase_entities[pl_eIdx].entityListenerLists[vl_listenerListIdx]))
{
vl_idx := f_EPTF_Common_IndexArray_getFirstBusyIdx(v_LGenBase_entities[pl_eIdx].entityListenerLists[vl_listenerListIdx])
f_EPTF_LGenBase_removeEntityEventListener2(pl_bIdx, pl_iIdx, pl_eIdx, vl_idx);
}
}
} //eventTypeEntity
group eventTypeFSM {
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_activateFsm
//
// Purpose:
// Activates the given FSM on the specified entity with the specified initial state.
//
// Parameters:
// - pl_eIdx - *in* - *integer* - index of the entity on which the FSM is
// being activated
// - pl_tIdx - *in* - *integer* - ref. to the FSM table (i.e., to the
// entity-independent state-transition ruleset)
// - pl_sIdx - *in* - *integer* - the FSM-table-local state index indicating
// the assumed initial state of the entity w.r.t. to the table
// - pl_tcIdx - *in* - *integer* - if the FSM table was activated from the
// <f_EPTF_LGenBase_initTCInternal> function, then the traffic case index, else it must be -1
//
// Return Value:
// - integer - the index of the FSM context of the entity w.r.t. the activated FSM
//
// Errors:
// -
//
// Detailed Comments:
//
///////////////////////////////////////////////////////////
public function f_EPTF_LGenBase_activateFsm(
in integer pl_eIdx,
in integer pl_tIdx,
in integer pl_sIdx,
in integer pl_tcIdx := -1)
runs on EPTF_LGenBase_Private_CT
return integer
{
if(-1 < pl_tcIdx){
f_EPTF_LGenBase_loggingWarning(%definitionId&": The obsolete traffic case index argument has been called "&
"with an invalid value: "&log2str(pl_tcIdx)&" It has been replaced with -1!")
}
f_EPTF_Base_assert(%definitionId&" Entity index: "&int2str(pl_eIdx)&" > sizeof(v_LGenBase_entities) ["&int2str(sizeof(v_LGenBase_entities))&"]",
pl_eIdx>=0 and pl_eIdx<sizeof(v_LGenBase_entities));
f_EPTF_Base_assert(%definitionId&" FSM table index",
pl_tIdx>=0 and pl_tIdx<sizeof(v_LGenBase_fsmTables));
f_EPTF_Base_assert(%definitionId&" initial state of FSM context",
pl_sIdx>=0 and pl_sIdx<sizeof(v_LGenBase_fsmTables[pl_tIdx].stateList));
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": Activating FSM[",pl_tIdx,"]:=",v_LGenBase_fsmTables[pl_tIdx].name,
"\nfor entity ", f_EPTF_LGenBase_getEntityName(pl_eIdx),
",\nwith initial state ",v_LGenBase_fsmTables[pl_tIdx].stateList[pl_sIdx],
",\nentity ctx before:=", v_LGenBase_entities[pl_eIdx]))
}
if(0 < sizeof(v_LGenBase_fsmTables[pl_tIdx].referredFsmList)){
f_EPTF_LGenBase_loggingError(%definitionId&" - An FSM which refers to a sibling FSM, cannot be activated by activateFsm, use traffic case instead! FSM name: " &v_LGenBase_fsmTables[pl_tIdx].name);
}
var integer vl_ret := f_EPTF_LGenBase_activateFsmGroup(
pl_tIdx,
pl_sIdx,
{entityData := {pl_eIdx}})
f_EPTF_LGenBase_resetFSMStats(pl_eIdx, vl_ret)
return vl_ret
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_LGenBase_resetFSMStats
//
// Purpose:
// Resets the statistics of an FSM which is not attached to a traffic case
///////////////////////////////////////////////////////////
private function f_EPTF_LGenBase_resetFSMStats(
in integer pl_eAbsIdx,
in integer pl_fsmCtxIdx)
runs on EPTF_LGenBase_Private_CT
{
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugTrafficVerbose)){
f_EPTF_LGenBase_loggingDebugTrafficVerbose(%definitionId&": "&log2str(v_LGenBase_entities[pl_eAbsIdx]))
}
var integer vl_fsmTableIdx := v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].tableIdx
//reset variables
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Entity#"&log2str(pl_eAbsIdx))
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": fsmIdx: "&log2str(pl_fsmCtxIdx))
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": varList: "&log2str(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].varList))
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": declared: "&log2str(v_LGenBase_fsmTables[vl_fsmTableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM]))
}
for ( var integer vl_j := 0; vl_j < sizeof(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].varList) ; vl_j := vl_j+1 ){
var EPTF_TopProviderType vl_providerType
f_EPTF_Var_getTopProviderType(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].varList[vl_j],vl_providerType)
if(empty == vl_providerType){
f_EPTF_Var_adjustContent(
v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].varList[vl_j],
v_LGenBase_fsmTables[vl_fsmTableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_j].initValue)
}
}
//Disable stats
for(var integer vl_j := 0; vl_j < sizeof(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].statMeasStatList) ; vl_j := vl_j+1 ){
f_EPTF_StatMeasure_disableStat(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].statMeasStatList[vl_j])
}
//Reset stats
for ( var integer vl_j := 0; vl_j < sizeof(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].statMeasStatList) ; vl_j := vl_j+1 ){
f_EPTF_StatMeasure_initStatValue(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].statMeasStatList[vl_j])
}
//Enable stats
for ( var integer vl_j := 0; vl_j < sizeof(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].statMeasStatList) ; vl_j := vl_j+1 ){
f_EPTF_StatMeasure_enableStat(v_LGenBase_entities[pl_eAbsIdx].fsmCtxList[pl_fsmCtxIdx].statMeasStatList[vl_j])
}
}
type record EPTF_LGenBase_FsmGroupForEntity {
integer entityIdx
}
type record EPTF_LGenBase_FsmGroupForTC {
integer tcIdx,
integer siblingIdx
}
type union EPTF_LGenBase_FsmGroupActivationParams{
EPTF_LGenBase_FsmGroupForEntity entityData,
EPTF_LGenBase_FsmGroupForTC tcData
}
friend function f_EPTF_LGenBase_activateFsmGroup(
in integer pl_tableIdx,
in integer pl_stateIdx,
in EPTF_LGenBase_FsmGroupActivationParams pl_params)
runs on EPTF_LGenBase_Private_CT
return integer
{
if(c_EPTF_Common_debugSwitch){
if (ischosen(pl_params.tcData)){
f_EPTF_Base_assert(%definitionId&" Invalid traffic case index "&log2str(pl_params.tcData.tcIdx),
pl_params.tcData.tcIdx > -1 and pl_params.tcData.tcIdx< sizeof(v_LGenBase_trafficCases));
f_EPTF_Base_assert(%definitionId&" The FSM sibling index "&log2str(pl_params.tcData.siblingIdx)
&" is invalid in traffic case "&v_LGenBase_trafficCases[pl_params.tcData.tcIdx].uniqueName,
pl_params.tcData.siblingIdx > -1 and pl_params.tcData.siblingIdx < sizeof(v_LGenBase_trafficCases[pl_params.tcData.tcIdx].fsmList));
}else{
f_EPTF_Base_assert(%definitionId&" Invalid entity index "&log2str(pl_params.entityData.entityIdx),
pl_params.entityData.entityIdx > -1 and pl_params.entityData.entityIdx < sizeof(v_LGenBase_entities));
}
}
var integer vl_eFirst := 0;
var integer vl_eCount := 1;
var integer vl_tcIdx := -1;
var integer vl_siblingIdx := -1;
if(ischosen(pl_params.tcData)){
vl_eFirst := v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_params.tcData.tcIdx].eGroupBackref].eOffset
vl_eCount := v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_params.tcData.tcIdx].eGroupBackref].eCount
vl_tcIdx := pl_params.tcData.tcIdx;
vl_siblingIdx := pl_params.tcData.siblingIdx;
}else{
vl_eFirst := pl_params.entityData.entityIdx
}
var EPTF_LGenBase_EntityFsmCtx vl_newFsmCtx := c_EPTF_LGenBase_emptyEntityFsmCtx
vl_newFsmCtx.tableIdx := pl_tableIdx
vl_newFsmCtx.stateIdx := pl_stateIdx
if (ischosen(pl_params.tcData)){
vl_newFsmCtx.tcIdx := vl_tcIdx
vl_newFsmCtx.siblingIdx := vl_siblingIdx
}// else default -1
//debug log variable
vl_newFsmCtx.logBufferVariable := v_LGenBase_defaultLogBuffer
//Timers
for (var integer t:=0;t<sizeof(v_LGenBase_fsmTables[pl_tableIdx].timerList);t:=t+1) {
vl_newFsmCtx.timerData[t] := -1;
vl_newFsmCtx.timerParams[t] := v_LGenBase_fsmTables[pl_tableIdx].timerList[t].timerParams;
}
//The FSM ctx idx of the entity ctx must be set at the beginning of the process
var EPTF_IntegerList vl_newIdxs := {}
vl_newIdxs[vl_eCount-1] := -1
for ( var integer vl_eIdx := 0; vl_eIdx < vl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entityAbsIdx := vl_eFirst + vl_eIdx
var integer vl_newFsmCtxIdx:= f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_entities[vl_entityAbsIdx].fsmCtxQueue);
f_EPTF_Base_assert(%definitionId&" FSM context management error", vl_newFsmCtxIdx >= sizeof(v_LGenBase_entities[vl_entityAbsIdx].fsmCtxList) or v_LGenBase_entities[vl_entityAbsIdx].fsmCtxList[vl_newFsmCtxIdx].tableIdx==-1);
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_newFsmCtxIdx, v_LGenBase_entities[vl_entityAbsIdx].fsmCtxQueue);
vl_newIdxs[vl_eIdx] := vl_newFsmCtxIdx
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": activating FSM(",v_LGenBase_fsmTables[pl_tableIdx].name,") as the #",vl_newFsmCtxIdx," active FSM of entity ", vl_entityAbsIdx))
}
v_LGenBase_entities[vl_entityAbsIdx].fsmCtxList[vl_newFsmCtxIdx] := vl_newFsmCtx
if(ischosen(pl_params.tcData)){
v_LGenBase_trafficCases[vl_tcIdx].entityInfo.itemList[vl_eIdx].siblingFsmCtxList[vl_siblingIdx] := vl_newFsmCtxIdx
}
}
//FSM variables
var integer vl_count := sizeof(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM]);
for ( var integer vl_i := 0; vl_i < vl_count ; vl_i := vl_i+1 )
{
//Check if it's been declared with different scope
if (ischosen(pl_params.tcData)){
var integer vl_varIdxInTC;
if(f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCVarNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
vl_varIdxInTC)){
//Ooops.
var integer vl_prevSiblingIdx := v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varIdxInTC].siblingFsmIdx;
var integer vl_prevFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSiblingIdx].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": "&
" Cannot activate FSM: The variable "&
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
"with FSM scope of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with TC scope."
);
}
if(f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMVarNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
vl_varIdxInTC)){
//Ooops.
var integer vl_prevSiblingIdx := v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInTC].siblingFsmIdx;
var integer vl_prevFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSiblingIdx].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": "&
" Cannot activate FSM: The variable "&
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
"with FSM scope of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with SiblingFSM scope."
);
}
//It's OK. Let's store its table type into the list for later check
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].FSMVarNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
pl_tableIdx)
}
for ( var integer vl_eIdx := 0; vl_eIdx < vl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entityAbsIdx := vl_eFirst + vl_eIdx
var charstring vl_varName := f_EPTF_LGenBase_varNameOfFSMVar(vl_entityAbsIdx, vl_newIdxs[vl_eIdx],
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name);
v_LGenBase_entities[vl_entityAbsIdx].fsmCtxList[vl_newIdxs[vl_eIdx]].varList[vl_i] :=
f_EPTF_Var_newVar(
vl_varName,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].initValue)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": New FSM variable has been created: "&vl_varName);
f_EPTF_Var_addPostProcFn(v_LGenBase_entities[vl_entityAbsIdx].fsmCtxList[vl_newIdxs[vl_eIdx]].varList[vl_i],
{refers(f_EPTF_LGenBase_fsmVarDebugPostproc),{}})
}
}
}
if(ischosen(pl_params.tcData)){
///////////////////////////////////////////////////////////////////////
//FSM sibling variables
//Step through the variables having scope siblingFSM
var integer vl_varCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM]);
var integer vl_varIdxInEntityInfo := -1
for ( var integer vl_var := 0; vl_var < vl_varCount ; vl_var := vl_var+1 ){
var charstring vl_varName := v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_var].name
//Check if it's already created in an other FSM
//TC scope
var integer vl_varIdxInTC;
if(f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCVarNamesHash,
vl_varName,
vl_varIdxInTC)){
//Ooops.
var integer vl_prevSiblingIdx := v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varIdxInTC].siblingFsmIdx;
var integer vl_prevFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSiblingIdx].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": "&
" Cannot activate FSM: The variable "&
vl_varName&
"with FSM scope of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with TC scope."
);
}
var integer vl_prevFSMTableTypeIdx;
if (f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].FSMVarNamesHash,
vl_varName,
vl_prevFSMTableTypeIdx)) {
f_EPTF_LGenBase_loggingError(%definitionId&": "&
" Cannot activate FSM: The variable "&
vl_varName&
"with SiblingFSM scope in the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with FSM scope."
);
}
var boolean vl_varExists := f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMVarNamesHash,
vl_varName,
vl_varIdxInEntityInfo)
if (vl_varExists) {
//Check the initial values
var integer vl_siblingIdxOfPrev := v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInEntityInfo].siblingFsmIdx;
var integer vl_prevTableIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_siblingIdxOfPrev].fsmTypeIdx;
var integer vl_idxInFsm := v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInEntityInfo].idxInFsm;
if(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_var].initValue
!= v_LGenBase_fsmTables[vl_prevTableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].initValue){
f_EPTF_LGenBase_loggingError(%definitionId&": FSM variable "
&v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_var].name
&" of FSM "&v_LGenBase_fsmTables[pl_tableIdx].name
&" is already defined in "&v_LGenBase_fsmTables[vl_prevTableIdx].name
&"with different initial value. "
&"\nPrevious value: "&log2str(v_LGenBase_fsmTables[vl_prevTableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].initValue)
&"\nNew value: "&log2str(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_var].initValue))
}
}else{
vl_varIdxInEntityInfo := v_LGenBase_trafficCases[vl_tcIdx].siblingVarCount;
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMVarNamesHash,
vl_varName,
vl_varIdxInEntityInfo)
v_LGenBase_trafficCases[vl_tcIdx].siblingVarCount := v_LGenBase_trafficCases[vl_tcIdx].siblingVarCount + 1;
v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInEntityInfo] := c_EPTF_LGenBase_emptyTcSiblingVarDescriptor
v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInEntityInfo].siblingFsmIdx := vl_siblingIdx;
v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInEntityInfo].idxInFsm := vl_var;
//Each siblingFSM variable is shared by the sibling FSMs of the same entity
//Step through the variables per entities of the TC
for ( var integer vl_eRelIdx := 0; vl_eRelIdx < vl_eCount ; vl_eRelIdx := vl_eRelIdx+1 ){
var charstring vl_siblingVarName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(vl_tcIdx, vl_eRelIdx, vl_varName)
v_LGenBase_trafficCases[vl_tcIdx].entityInfo.itemList[vl_eRelIdx].siblingFsmVarList[vl_varIdxInEntityInfo] :=
f_EPTF_Var_newVar(vl_siblingVarName, v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_var].initValue);
}
}
//Position in the entity info
v_LGenBase_trafficCases[vl_tcIdx].siblingFsmVarIdxInFsm[vl_siblingIdx][vl_var] := vl_varIdxInEntityInfo;
}
///////////////////////////////////////////////////////////////////////
//FSM TC variables
vl_varCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC]);
var integer vl_varCountInTC := sizeof(v_LGenBase_trafficCases[vl_tcIdx].varList)
var integer vl_varIdxInTc := -1
for ( var integer vl_i := 0; vl_i < vl_varCount ; vl_i := vl_i+1 )
{
//fsmList
//Check in SiblingFSM scope
var integer vl_varIdxInTC;
var charstring vl_varName := v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name
if(f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMVarNamesHash,
vl_varName,
vl_varIdxInTC)){
//Ooops.
var integer vl_prevSiblingIdx := v_LGenBase_trafficCases[vl_tcIdx].siblingVarList[vl_varIdxInTC].siblingFsmIdx;
var integer vl_prevFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSiblingIdx].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": "&
" Cannot activate FSM: The variable "&
vl_varName&
"with FSM scope of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with SiblingFSM scope."
);
}
//Check in FSM scope
var integer vl_prevFSMTableTypeIdx;
if (f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].FSMVarNamesHash,
vl_varName,
vl_prevFSMTableTypeIdx)) {
f_EPTF_LGenBase_loggingError(%definitionId&": "&
" Cannot activate FSM: The variable "&
vl_varName&
"with SiblingFSM scope in the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with FSM scope."
);
}
//Check if it's already created in an other FSM
var boolean vl_varExists := f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCVarNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_varIdxInTc)
var charstring vl_decoratedVarName := f_EPTF_LGenBase_varNameOfTCVar(vl_tcIdx,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name);
if( not vl_varExists ){
v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varCountInTC].siblingFsmIdx := vl_siblingIdx;
v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varCountInTC].idxInFsm := vl_i
v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varCountInTC].varId :=
f_EPTF_Var_newVar(
vl_decoratedVarName,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].initValue)
vl_varIdxInTc := vl_varCountInTC
vl_varCountInTC := vl_varCountInTC + 1
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].TCVarNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_varIdxInTc)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": New FSM TC variable has been created: "&vl_decoratedVarName&
" VarID: "&int2str(v_LGenBase_trafficCases[vl_tcIdx].varList[vl_i].varId));
f_EPTF_Var_addPostProcFn(v_LGenBase_trafficCases[vl_tcIdx].varList[vl_i].varId, {refers(f_EPTF_LGenBase_fsmVarDebugPostproc),{}})
}
}else{
//Check previous declaration
var integer vl_prevTableIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varIdxInTc].siblingFsmIdx].fsmTypeIdx
var integer vl_idxInFsm := v_LGenBase_trafficCases[vl_tcIdx].varList[vl_varIdxInTc].idxInFsm
if(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].initValue
!= v_LGenBase_fsmTables[vl_prevTableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].initValue){
f_EPTF_LGenBase_loggingError(%definitionId&": FSM variable "
&v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name
&" of FSM "&v_LGenBase_fsmTables[pl_tableIdx].name
&" is already defined in "&v_LGenBase_fsmTables[vl_prevTableIdx].name
&"with different initial value. "
&"\nPrevious value: "&log2str(v_LGenBase_fsmTables[vl_prevTableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].initValue)
&"\nNew value: "&log2str(v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].initValue))
}
}
v_LGenBase_trafficCases[vl_tcIdx].varIdxInFsm[vl_siblingIdx][vl_i]:= vl_varIdxInTc
}
}
///////////////////////////////////////////////////////////////////////
//FSM measured statistics
var integer vl_statCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM]);
for ( var integer vl_i := 0; vl_i < vl_statCount ; vl_i := vl_i+1 )
{
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Processing measured statistic declaration: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i]))
}
if(ischosen(pl_params.tcData)){
//Check if it's already created in an other FSM
//Check TC scope
var integer vl_statMeasIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
vl_statMeasIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInEntityInfo].siblingFsmIdx
var integer vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics with FSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with TC scope."
);
}
//Check siblingFSM scope
vl_statMeasIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
vl_statMeasIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo].siblingFsmIdx
var integer vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics with FSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with SiblingFSM scope."
);
}
}
var integer vl_varXRef := v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].varXRef
var integer vl_varIdxInScope := -1
var integer vl_varId := -1
for ( var integer vl_eIdx := 0; vl_eIdx < vl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entity := vl_eFirst + vl_eIdx
var integer vl_newFsmCtxIdx:= vl_newIdxs[vl_eIdx]
if(-1 != vl_varXRef){
if (c_EPTF_LGenBase_fsmObjectScopeFSM!= v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].scope) {
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid provider variable scope: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].scope)&" for statMeasStat "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" in FSM table "&v_LGenBase_fsmTables[pl_tableIdx].name& ". It should be FSM scope")
}
vl_varIdxInScope := v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].idxInScope;
vl_varId := v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].varList[vl_varIdxInScope];
}
if(ischosen(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].params.params)){
v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].statMeasStatList[vl_i] :=
f_EPTF_StatMeasure_newStatWithParams(
vl_varId,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].params.params)
}else{
v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].statMeasStatList[vl_i] :=
f_EPTF_StatMeasure_newStat(
vl_varId,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].params.statType)
}
f_EPTF_StatMeasure_disableStat(v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].statMeasStatList[vl_i])
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": New FSM measured statistic has been created: "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
"\n ID: "&log2str(v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].statMeasStatList[vl_i]));
if("" != v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].targetVarName){
var charstring vl_targetVarName := v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].targetVarName
var EPTF_LGenBase_FsmObjectScope vl_varScope := c_EPTF_LGenBase_fsmObjectScopeFSM
var integer vl_varXref := -1
if(f_EPTF_str2int_HashMap_Find(v_LGenBase_fsmTables[pl_tableIdx].varNamesHash, vl_targetVarName, vl_varXref)){
vl_varScope := v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXref].scope
}else{
f_EPTF_Base_assert(%definitionId&": Invalid target variable: "&vl_targetVarName&" for FSM measured statistic "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,false);
}
var charstring vl_decoratedTargetVarName := ""
select( vl_varScope ){
case ( c_EPTF_LGenBase_fsmObjectScopeFSM ){
vl_decoratedTargetVarName := f_EPTF_LGenBase_varNameOfFSMVar(vl_eIdx, vl_newFsmCtxIdx, vl_targetVarName)
}
case ( c_EPTF_LGenBase_fsmObjectScopeSiblingFSM ){
if(ischosen(pl_params.tcData)){
vl_decoratedTargetVarName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(vl_tcIdx, vl_eIdx, vl_targetVarName);
}else{
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM table: FSM table "&v_LGenBase_fsmTables[pl_tableIdx].name
&" is activated outside of a TC, but the target value of the measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" has a SiblingFSM scope");
}
}
case ( c_EPTF_LGenBase_fsmObjectScopeTC ){
if(ischosen(pl_params.tcData)){
vl_decoratedTargetVarName := f_EPTF_LGenBase_varNameOfTCVar(vl_tcIdx, vl_targetVarName)
}else{
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM table: FSM table "&v_LGenBase_fsmTables[pl_tableIdx].name
&" is activated outside of a TC, but the target value of the measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" has a TC scope");
}
}
case else{
f_EPTF_Base_assert(%definitionId&": Invalid variable scope: "&log2str(vl_varScope)&" for FSM variable "&vl_targetVarName,false);
}
}
//v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].targetVarName := vl_decoratedTargetVarName
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Create variable "&vl_decoratedTargetVarName&
" for measured statistics: "&v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name)
}
v_LGenBase_dummyInt := f_EPTF_StatMeasure_createVarFromStat(
v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].statMeasStatList[vl_i],
vl_decoratedTargetVarName)
}
}
if(ischosen(pl_params.tcData)){
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].FSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
pl_tableIdx);
}
}
if(ischosen(pl_params.tcData)){
///////////////////////////////////////////////////////////////////////
// Sibling measured statistics
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": SiblingFSM measured statistics \n TC idx: "&int2str(vl_tcIdx)&
"\n StatMeas declarator list: "&log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM]))
}
vl_statCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM]);
for ( var integer vl_i := 0; vl_i < vl_statCount ; vl_i := vl_i+1 )
{
//fsmList
//Check if it's already created in an other FSM
//Check TC scope
var integer vl_statMeasIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_statMeasIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInEntityInfo].siblingFsmIdx
var integer vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with TC scope."
);
}
//Check FSM scope
var integer vl_prevFSMTableTypeIdx;
if (f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].FSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_prevFSMTableTypeIdx)) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with FSM scope."
);
}
//Current declaration
var integer vl_varXRef := v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].varXRef
var charstring vl_currentVarName := "";
var EPTF_Var_DirectContent vl_currentInitContent;
var integer vl_varId := -1;
var integer vl_providerVarIdxInTc := -1;
if(-1 != vl_varXRef){
var EPTF_LGenBase_FsmObjectScope vl_varScope := v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].scope;
if ( c_EPTF_LGenBase_fsmObjectScopeSiblingFSM != vl_varScope ){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" has a provider variable "&vl_currentVarName&" with invalid scope. It should be SiblingFSM."
);
}
var integer vl_idxInScopeInFSM := v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].idxInScope;
vl_currentVarName := v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInScopeInFSM].name;
vl_currentInitContent := v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInScopeInFSM].initValue;
vl_providerVarIdxInTc := v_LGenBase_trafficCases[vl_tcIdx].siblingFsmVarIdxInFsm[vl_siblingIdx][vl_idxInScopeInFSM];
}
//Check previous SiblingFSM declaration
if(f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_statMeasIdxInEntityInfo)) {
//Data of previous declaration
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo].siblingFsmIdx;
vl_prevFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
var integer vl_idxInFsm := v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo].idxInFsm;
var charstring vl_prevVarName := ""
var integer vl_prevVarXRef := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].varXRef
var EPTF_Var_DirectContent vl_prevInitContent;
if(-1 < vl_prevVarXRef){
var EPTF_LGenBase_FsmObjectScope vl_prevVarScope := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varXRefs[vl_prevVarXRef].scope;
var integer vl_varIdxInScopeInPrevFsm := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varXRefs[vl_prevVarXRef].idxInScope
vl_prevVarName := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varListArray[vl_prevVarScope][vl_varIdxInScopeInPrevFsm].name;
vl_prevInitContent := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varListArray[vl_prevVarScope][vl_varIdxInScopeInPrevFsm].initValue;
}
if (vl_prevVarXRef == -1 and vl_varXRef != -1) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The previous declaration has a provider variable, but the current does not have any."
);
}
if (vl_prevVarXRef != -1 and vl_varXRef == -1) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The current declaration has a provider variable, but the previous one does not have any."
);
}
if (vl_varXRef != -1) {
if (vl_prevVarName !=vl_currentVarName) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The current declaration has a provider variable, and the previous one has one with different name."
);
}
if (vl_currentInitContent != vl_prevInitContent) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The current declaration has a provider variable, and the previous one has one with different init value."
);
}
}
if (v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params !=
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].params) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The parameters of the current declaration is different from the parameters of the previous declaration."
);
}
if (
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].targetVarName !=
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].targetVarName
) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The target varName of the current declaration differs from the target varName of the previous declaration."
);
}
}else{
vl_statMeasIdxInEntityInfo := v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasCount;
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_statMeasIdxInEntityInfo)
v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasCount := v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasCount + 1;
v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo] := c_EPTF_LGenBase_emptyTcSiblingVarDescriptor
v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo].siblingFsmIdx := vl_siblingIdx;
v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo].idxInFsm := vl_i;
//Step through the variables per entities of the TC
for ( var integer vl_eRelIdx := 0; vl_eRelIdx < vl_eCount ; vl_eRelIdx := vl_eRelIdx+1 ){
var integer vl_statMeasId := -1
vl_varId := -1;
if(-1 < vl_providerVarIdxInTc){
vl_varId := v_LGenBase_trafficCases[vl_tcIdx].entityInfo.itemList[vl_eRelIdx].siblingFsmVarList[vl_providerVarIdxInTc];
}
if ( ischosen(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params.params )){
vl_statMeasId :=
f_EPTF_StatMeasure_newStatWithParams(
vl_varId,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params.params)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": f_EPTF_StatMeasure_newStatWithParams("&
log2str(vl_varId)&
","&log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params.params));
}
}
else if ( ischosen(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params.statType )){
vl_statMeasId :=
f_EPTF_StatMeasure_newStat(
vl_varId,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params.statType)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": f_EPTF_StatMeasure_newStat("&
log2str(vl_varId)&","&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params.statType));
}
} else {
//A bit paranoia
f_EPTF_Base_assert(%definitionId&": Unknown StatMeasure declaration type: "&log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].params),false);
}
//Store the new statMeas ID
v_LGenBase_trafficCases[vl_tcIdx].entityInfo.itemList[vl_eRelIdx].siblingFsmStatMeasList[vl_statMeasIdxInEntityInfo] := vl_statMeasId;
}
}
//Store the position in the entity info
v_LGenBase_trafficCases[vl_tcIdx].siblingFsmStatMeasIdxInFsm[vl_siblingIdx][vl_i] := vl_statMeasIdxInEntityInfo;
}
///////////////////////////////////////////////////////////////////////
//FSM TC measured statistics
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": TC measured statistics \n TC idx: "&int2str(vl_tcIdx)&
"\n StatMeas declarator list: "&log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC]))
}
vl_statCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC]);
for ( var integer vl_i := 0; vl_i < vl_statCount ; vl_i := vl_i+1 )
{
//fsmList
//Check if it's already created in an other FSM
//Check SiblingFSM scope
var integer vl_statMeasIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_statMeasIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].siblingStatMeasStatList[vl_statMeasIdxInEntityInfo].siblingFsmIdx
var integer vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with TC scope."
);
}
//Check FSM scope
var integer vl_prevFSMTableTypeIdx;
if (f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].FSMStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_prevFSMTableTypeIdx)) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
" with FSM scope."
);
}
var integer vl_statMeasIdxInTc := -1
//Current provider var data
var integer vl_varId := -1
var charstring vl_currentVarName := "";
var EPTF_Var_DirectContent vl_currentInitContent;
var integer vl_varXRef := v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].varXRef
if(-1 != vl_varXRef){
var EPTF_LGenBase_FsmObjectScope vl_varScope := v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].scope;
if ( c_EPTF_LGenBase_fsmObjectScopeTC == vl_varScope ){
var integer vl_idxInScopeInFSM := v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXRef].idxInScope;
var integer vl_providerVarIdxInTc := v_LGenBase_trafficCases[vl_tcIdx].varIdxInFsm[vl_siblingIdx][vl_idxInScopeInFSM];
vl_varId := v_LGenBase_trafficCases[vl_tcIdx].varList[vl_providerVarIdxInTc].varId
vl_currentVarName := v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInScopeInFSM].name;
vl_currentInitContent := v_LGenBase_fsmTables[pl_tableIdx].varListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInScopeInFSM].initValue;
}
else
{
//TODO Prevent it in FSM preprocessing
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid provider variable scope: the scope of input variable of TC statMeas statistic "
&v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name
&" in FSM table "&v_LGenBase_fsmTables[pl_tableIdx].name&
" must be TC scope.");
}
}
if(f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_statMeasIdxInTc)){
//Check previous declaration
//Data of previous declaration
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInTc].siblingFsmIdx;
vl_prevFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
var integer vl_idxInFsm := v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInTc].idxInFsm;
var charstring vl_prevVarName := ""
var integer vl_prevVarXRef := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].varXRef
var EPTF_Var_DirectContent vl_prevInitContent;
if(-1 < vl_prevVarXRef){
var integer vl_varIdxInScopeInPrevFsm := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varXRefs[vl_prevVarXRef].idxInScope
var EPTF_LGenBase_FsmObjectScope vl_prevVarScope := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varXRefs[vl_prevVarXRef].scope;
vl_prevVarName := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varListArray[vl_prevVarScope][vl_varIdxInScopeInPrevFsm].name;
vl_prevInitContent := v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].varListArray[vl_prevVarScope][vl_varIdxInScopeInPrevFsm].initValue;
}
if (vl_prevVarXRef == -1 and vl_varXRef != -1) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The previous declaration has a provider variable, but the current does not have any."
);
}
if (vl_prevVarXRef != -1 and vl_varXRef == -1) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The current declaration has a provider variable, but the previous one does not have any."
);
}
if (vl_varXRef != -1) {
if (vl_prevVarName !=vl_currentVarName) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The current declaration has a provider variable, and the previous one has one with different name."
);
}
if (vl_currentInitContent != vl_prevInitContent) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The current declaration has a provider variable, and the previous one has one with different init value."
);
}
}
if (v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params !=
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].params) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The parameters of the current declaration is different from the parameters of the previous declaration."
);
}
if (
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].targetVarName !=
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].targetVarName
) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The measured statistics "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prevFSMTableTypeIdx].name&
". The target varName of the current declaration differs from the target varName of the previous declaration."
);
}
}else{
var integer vl_statMeasId := -1
if ( ischosen(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params.params )){
vl_statMeasId :=
f_EPTF_StatMeasure_newStatWithParams(
vl_varId,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params.params)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": f_EPTF_StatMeasure_newStatWithParams("&
log2str(vl_varId)&
","&log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params.params));
}
}
else if ( ischosen(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params.statType )){
vl_statMeasId :=
f_EPTF_StatMeasure_newStat(
vl_varId,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params.statType)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": f_EPTF_StatMeasure_newStat("&
log2str(vl_varId)&","&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params.statType));
}
} else {
//A bit paranoia
f_EPTF_Base_assert(%definitionId&": Unknown StatMeasure declaration type: "&log2str(v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].params),false);
}
vl_statMeasIdxInTc := sizeof(v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList);
v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInTc] := c_EPTF_LGenBase_emptyTcStatMeasDescriptor;
v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInTc].statId := vl_statMeasId
v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInTc].siblingFsmIdx := vl_siblingIdx
v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_statMeasIdxInTc].idxInFsm := vl_i;
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].TCStatMeasNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_statMeasIdxInTc)
f_EPTF_StatMeasure_disableStat(vl_statMeasId)
//Check the target variable
if("" != v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].targetVarName){
var charstring vl_targetVarName := v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].targetVarName
var integer vl_varXref := -1
if(not f_EPTF_str2int_HashMap_Find(v_LGenBase_fsmTables[pl_tableIdx].varNamesHash, vl_targetVarName, vl_varXref)){
//Error. The var must be declared
f_EPTF_LGenBase_loggingError(%definitionId&": The target variable "&vl_targetVarName
&" of statMeas "&v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name
&" is not declared in FSM table "&v_LGenBase_fsmTables[pl_tableIdx].name)
}
var charstring vl_decoratedTargetVarName := ""
if(c_EPTF_LGenBase_fsmObjectScopeTC != v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXref].scope){
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid variable scope: "
&log2str(v_LGenBase_fsmTables[pl_tableIdx].varXRefs[vl_varXref].scope)
&". The scope of target variable of TC statMeas statistic "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name
&" in FSM table "&v_LGenBase_fsmTables[pl_tableIdx].name&
" must be TC.")
}
vl_decoratedTargetVarName := f_EPTF_LGenBase_varNameOfTCVar(vl_tcIdx, vl_targetVarName)
v_LGenBase_dummyInt := f_EPTF_StatMeasure_createVarFromStat(v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_i].statId, vl_decoratedTargetVarName)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Create variable "&vl_decoratedTargetVarName&
" for StatMeas TC measured statistics: "&v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name)
}
}
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": New FSM TC measured statistic has been created: "&
v_LGenBase_fsmTables[pl_tableIdx].statMeasStatListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
"\nID: "&int2str(v_LGenBase_trafficCases[vl_tcIdx].statMeasStatList[vl_i].statId));
}
}
v_LGenBase_trafficCases[vl_tcIdx].statMeasIdxInFsm[vl_siblingIdx][vl_i]:= vl_statMeasIdxInTc
}
}
//////////////////////////////////////////////////////////////////////
// Declaring FSM stathander stats
//////////////////////////////////////////////////////////////////////
vl_statCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM]);
for ( var integer vl_i := 0; vl_i < vl_statCount ; vl_i := vl_i+1 )
{
// Check in TC scope
var integer vl_statHIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
vl_statHIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHIdxInEntityInfo].siblingFsmIdx
var integer vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with FSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with TC scope."
);
}
// Check in Sibling scope:
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
vl_statHIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHIdxInEntityInfo].siblingFsmIdx
var integer vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with FSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with SiblingFSM scope."
);
}
for ( var integer vl_eIdx := 0; vl_eIdx < vl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entity := vl_eFirst + vl_eIdx
var integer vl_newFsmCtxIdx:= vl_newIdxs[vl_eIdx]
var charstring vl_statName := f_EPTF_LGenBase_varNameOfFSMVar(vl_entity, vl_newFsmCtxIdx,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name);
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Declaring statistic "&vl_statName&" with statMethod: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].statMethod))
}
//The statistics declared in FSM-s are always collected in the LGenBase itself
var boolean vl_ok := f_EPTF_StatHandlerClient_declareStat(
vl_statName,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].statMethod,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].statResetValue,
self);
f_EPTF_Base_assert(%definitionId&": The declaration of the statistics "&vl_statName&" failed.", vl_ok)
}
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].FSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name,
pl_tableIdx)
}
if(ischosen(pl_params.tcData)){
//////////////////////////////////////////////////////////////////////
//Declaring FSM (SH)statistics with Sibling scope
//////////////////////////////////////////////////////////////////////
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Processing TC statistic declaration: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM]))
}
vl_statCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM]);
for ( var integer vl_i := 0; vl_i < vl_statCount ; vl_i := vl_i+1 )
{
// Check FSM scope
var integer vl_prefFSMTableTypeIdx;
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].FSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_prefFSMTableTypeIdx)) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with FSM scope."
);
}
// Check in TC scope
var integer vl_statHIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_statHIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHIdxInEntityInfo].siblingFsmIdx
vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with TC scope."
);
}
var integer vl_statHandlerIdxInTc := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_statHandlerIdxInTc) ){
//Check previous declaration
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHandlerIdxInTc].siblingFsmIdx
var integer vl_idxInFsm := v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHandlerIdxInTc].idxInFsm;
//Check method
vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
if(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].statMethod !=
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].statMethod){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with different method."
);
}
//Check reset value
if(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].statResetValue !=
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].statResetValue){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with different reset value."
);
}
//Check provider list
if(not match(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].providerDeclarators,
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_idxInFsm].providerDeclarators)){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with different provider list."
);
}
} else {
for ( var integer vl_eRelIdx := 0; vl_eRelIdx < sizeof(v_LGenBase_trafficCases[vl_tcIdx].entityInfo.itemList) ; vl_eRelIdx := vl_eRelIdx+1 ){
var charstring vl_statName := f_EPTF_LGenBase_varNameOfSiblingFSMsVar(vl_tcIdx,vl_eRelIdx,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name);
//var boolean vl_mustBeRegistered := false
vl_statHandlerIdxInTc := sizeof(v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList);
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Declaring statistic "&vl_statName&" with statMethod: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].statMethod))
//The statistics declared in FSM-s are always collected in the LGenBase itself
var boolean vl_ok := f_EPTF_StatHandlerClient_declareStat(
vl_statName,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].statMethod,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].statResetValue,
self);
f_EPTF_Base_assert(%definitionId&": The declaration of the statistics "&vl_statName&" failed.", vl_ok)
}
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name,
vl_statHandlerIdxInTc)
v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHandlerIdxInTc].statName :=
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeSiblingFSM][vl_i].name;
v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHandlerIdxInTc].siblingFsmIdx := vl_siblingIdx;
v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHandlerIdxInTc].idxInFsm := vl_i;
}
v_LGenBase_trafficCases[vl_tcIdx].siblingFsmStatHandlerIdxInFsm[vl_siblingIdx][vl_i] := vl_statHandlerIdxInTc;
}
///////////////////////////////////////////////////////
//Declaring FSM (SH)statistics with TC scope
///////////////////////////////////////////////////////
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Processing TC statistic declaration: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC])&
" for TC "&v_LGenBase_trafficCases[vl_tcIdx].uniqueName)
}
vl_statCount := sizeof(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC]);
for ( var integer vl_i := 0; vl_i < vl_statCount ; vl_i := vl_i+1 )
{
// Check FSM scope
var integer vl_prefFSMTableTypeIdx;
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].FSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_prefFSMTableTypeIdx)) {
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with TC scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with FSM scope."
);
}
// Check in Sibling scope
var integer vl_statHIdxInEntityInfo := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].SiblingFSMStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_statHIdxInEntityInfo)) {
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].siblingStatHandlerStatList[vl_statHIdxInEntityInfo].siblingFsmIdx
vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with TC scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with SiblingFSM scope."
);
}
var integer vl_statHandlerIdxInTc := -1
if( f_EPTF_str2int_HashMap_Find(
v_LGenBase_trafficCases[vl_tcIdx].TCStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_statHandlerIdxInTc) ){
// Check previous declaration
var integer vl_prevSibling := v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHandlerIdxInTc].siblingFsmIdx
var integer vl_idxInFsm := v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHandlerIdxInTc].idxInFsm;
//Check method
vl_prefFSMTableTypeIdx := v_LGenBase_trafficCases[vl_tcIdx].fsmList[vl_prevSibling].fsmTypeIdx;
if(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].statMethod !=
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].statMethod){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with TC scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with different method."
);
}
//Check reset value
if(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].statResetValue !=
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].statResetValue){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with different reset value."
);
}
//Check provider list
if(not match(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].providerDeclarators,
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_idxInFsm].providerDeclarators)){
f_EPTF_LGenBase_loggingError(%definitionId&": Cannot activate FSM: The statistics with SiblingFSM scope "&
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name&
" of the FSM "&
v_LGenBase_fsmTables[pl_tableIdx].name&
" in TC "&
v_LGenBase_trafficCases[vl_tcIdx].uniqueName&
" already defined in FSM "&
v_LGenBase_fsmTables[vl_prefFSMTableTypeIdx].name&
" with different provider list."
);
}
} else {
var charstring vl_statName := f_EPTF_LGenBase_varNameOfTCVar(vl_tcIdx,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name);
//var boolean vl_mustBeRegistered := false
vl_statHandlerIdxInTc := sizeof(v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList);
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Declaring statistic "&vl_statName&" with statMethod: "&
log2str(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].statMethod))
//The statistics declared in FSM-s are always collected in the LGenBase itself
var boolean vl_ok := f_EPTF_StatHandlerClient_declareStat(
vl_statName,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].statMethod,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].statResetValue,
self);
f_EPTF_Base_assert(%definitionId&": The declaration of the statistics "&vl_statName&" failed.", vl_ok)
f_EPTF_str2int_HashMap_Insert(
v_LGenBase_trafficCases[vl_tcIdx].TCStatHandlerNamesHash,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name,
vl_statHandlerIdxInTc)
v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHandlerIdxInTc].statName := v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeTC][vl_i].name;
v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHandlerIdxInTc].siblingFsmIdx := vl_siblingIdx;
v_LGenBase_trafficCases[vl_tcIdx].statHandlerStatList[vl_statHandlerIdxInTc].idxInFsm := vl_i;
}
v_LGenBase_trafficCases[vl_tcIdx].statHandlerIdxInFsm[vl_siblingIdx][vl_i] := vl_statHandlerIdxInTc;
}
}
//Register FSM stathandler providers
for ( var integer vl_i := 0; vl_i < sizeof(v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM]) ; vl_i := vl_i+1 )
{
for ( var integer vl_eIdx := 0; vl_eIdx < vl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entity := vl_eFirst + vl_eIdx
var integer vl_newFsmCtxIdx:= vl_newIdxs[vl_eIdx]
var charstring vl_statName := f_EPTF_LGenBase_varNameOfFSMVar(vl_entity, vl_newFsmCtxIdx,
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].name);
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugFsmVars)){
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": Registering statistic providers for statHandler "&vl_statName)
}
f_EPTF_LGenBase_registerStatHandlerProviders(
v_LGenBase_fsmTables[pl_tableIdx].statisticListArray[c_EPTF_LGenBase_fsmObjectScopeFSM][vl_i].providers,
v_LGenBase_fsmTables[pl_tableIdx],
pl_tableIdx,
vl_tcIdx,
vl_statName,
c_EPTF_LGenBase_fsmObjectScopeFSM,
vl_newFsmCtxIdx,
vl_eIdx ) // TODO ide a siblingIdx kene de itt
}
}
//Process table
if(ischosen(pl_params.entityData)){
//Activates for a single entity
if (0<sizeof(v_LGenBase_fsmTables[pl_tableIdx].siblingListenerRowList)) {
f_EPTF_LGenBase_loggingError(%definitionId&": The FSM "&v_LGenBase_fsmTables[pl_tableIdx].name&
" refers to a sibling, but it is activated inside of a traffic case");
}
for (var integer vl_event:=0;vl_event<sizeof(v_LGenBase_fsmTables[pl_tableIdx].eventXref); vl_event:=vl_event+1) {
var integer vl_row := v_LGenBase_fsmTables[pl_tableIdx].eventXref[vl_event].rowIdx
var integer bIdx:=v_LGenBase_fsmTables[pl_tableIdx].eventXref[vl_event].event2Listen.bIdx;
var integer iIdx:=v_LGenBase_fsmTables[pl_tableIdx].eventXref[vl_event].event2Listen.iIdx;
//Activates for a single entity
for ( var integer vl_eIdx := 0; vl_eIdx < vl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entity := vl_eFirst + vl_eIdx
var integer vl_newFsmCtxIdx:= vl_newIdxs[vl_eIdx]
select (v_LGenBase_fsmTables[pl_tableIdx].eventXref[vl_event].event2Listen.eventType) {
case (general) {
v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].rowListeners[vl_event]:={
f_EPTF_LGenBase_addGeneralEventListener(
bIdx,iIdx,
refers(f_EPTF_LGenBase_tableListenerWrapper),
{vl_entity,vl_newFsmCtxIdx,vl_row})}}
case (entity){
v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].rowListeners[vl_event]:={
f_EPTF_LGenBase_addEntityEventListener2(
bIdx,iIdx,vl_entity,
refers(f_EPTF_LGenBase_tableListenerWrapper),
{vl_entity,vl_newFsmCtxIdx,vl_row})}}
case (fsm) {
//v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].rowListeners[vl_event]:= {omit};
}
}
}
}
}else{
var EPTF_LGenBase_InternalFSMEvent2RowXrefList vl_siblingEventXref := {};
f_EPTF_LGenBase_processSiblingListeners(vl_tcIdx,pl_tableIdx,v_LGenBase_fsmTables[pl_tableIdx],vl_siblingIdx,vl_siblingEventXref);
f_EPTF_LGenBase_activateListenersInFsm(
vl_tcIdx,
pl_tableIdx,
v_LGenBase_fsmTables[pl_tableIdx].eventXref,
vl_eFirst,
vl_eCount,
vl_siblingIdx,
vl_newIdxs)
f_EPTF_LGenBase_activateListenersInFsm(
vl_tcIdx,
pl_tableIdx,
vl_siblingEventXref,
vl_eFirst,
vl_eCount,
vl_siblingIdx,
vl_newIdxs)
}
if(ischosen(pl_params.tcData)){
return 0
}else{
return vl_newIdxs[0];
}
}
private function f_EPTF_LGenBase_getFsmTypeOfSiblingFsm(
in integer pl_tcIdx,
in charstring pl_name)
runs on EPTF_LGenBase_Private_CT return charstring
{
for ( var integer i := 0; i < sizeof(v_LGenBase_trafficCases[pl_tcIdx].fsmList) ; i := i+1 )
{
if (v_LGenBase_trafficCases[pl_tcIdx].fsmList[i].siblingName == pl_name) {
return v_LGenBase_fsmTables[v_LGenBase_trafficCases[pl_tcIdx].fsmList[i].fsmTypeIdx].name;
}
}
return ""; // not found
}
private function f_EPTF_LGenBase_activateListenersInFsm(
in integer pl_tcIdx,
in integer pl_tableIdx,
in EPTF_LGenBase_InternalFSMEvent2RowXrefList pl_eventXref,
in integer pl_eFirst,
in integer pl_eCount,
in integer pl_siblingIdx,
in EPTF_IntegerList pl_newIdxs)
runs on EPTF_LGenBase_Private_CT
{
for (var integer vl_event:=0;vl_event<sizeof(pl_eventXref); vl_event:=vl_event+1) {
var integer vl_row := pl_eventXref[vl_event].rowIdx
var integer bIdx:=pl_eventXref[vl_event].event2Listen.bIdx;
var integer iIdx:=pl_eventXref[vl_event].event2Listen.iIdx;
var integer vl_siblingRef := pl_eventXref[vl_event].siblingRef;
select (pl_eventXref[vl_event].event2Listen.eventType) {
case (general) {
f_EPTF_LGenBase_loggingDebugConfig("Activating general listener for tc "&log2str(pl_tcIdx)&
"\nEvent: "&f_EPTF_LGenBase_iIdx2Str(bIdx, iIdx)&
"\nFSM Table: "&v_LGenBase_fsmTables[pl_tableIdx].name&
"\nRow: "&log2str(vl_row)&
"\nSibling ref: "&log2str(vl_siblingRef))
var integer vl_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_genericTcListeners[bIdx][iIdx])
f_EPTF_FBQ_setQueueDidx(vl_idx, {pl_tcIdx,pl_siblingIdx,vl_row,vl_siblingRef}, v_LGenBase_genericTcListeners[bIdx][iIdx])
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_idx, v_LGenBase_genericTcListeners[bIdx][iIdx])
}
case (entity){
f_EPTF_LGenBase_loggingDebugConfig("Activating entity listener for tc "&log2str(pl_tcIdx)&
"\nEvent: "&f_EPTF_LGenBase_iIdx2Str(bIdx, iIdx)&
"\nFSM Table: "&v_LGenBase_fsmTables[pl_tableIdx].name&
"\nRow: "&log2str(vl_row)&
"\nSibling ref: "&log2str(vl_siblingRef))
var integer vl_idx := f_EPTF_FBQ_getOrCreateFreeSlot(v_LGenBase_entityTcListeners[bIdx][iIdx])
f_EPTF_FBQ_setQueueDidx(vl_idx, {pl_tcIdx,pl_siblingIdx,vl_row,vl_siblingRef}, v_LGenBase_entityTcListeners[bIdx][iIdx])
f_EPTF_FBQ_moveFromFreeToBusyTail(vl_idx, v_LGenBase_entityTcListeners[bIdx][iIdx])
}
case (fsm) {
f_EPTF_LGenBase_loggingDebugConfig("FSM listener for tc "&log2str(pl_tcIdx)&
"\nEvent: "&f_EPTF_LGenBase_iIdx2Str(bIdx, iIdx)&
"\nFSM Table: "&v_LGenBase_fsmTables[pl_tableIdx].name&
"\nRow: "&log2str(vl_row))
/*for ( var integer vl_eIdx := 0; vl_eIdx < pl_eCount ; vl_eIdx := vl_eIdx+1 ){
var integer vl_entity := pl_eFirst + vl_eIdx
var integer vl_newFsmCtxIdx:= pl_newIdxs[vl_eIdx]
v_LGenBase_entities[vl_entity].fsmCtxList[vl_newFsmCtxIdx].rowListeners[vl_event]:= {omit};
}*/
}
}
}
}
//vl_eventXref
private function f_EPTF_LGenBase_processSiblingListeners(
in integer pl_tcIdx,
in integer pl_tableIdx,
inout EPTF_LGenBase_InternalFsmTable pl_fsm,
in integer pl_siblingIdx,
inout EPTF_LGenBase_InternalFSMEvent2RowXrefList pl_siblingEventXref)
runs on EPTF_LGenBase_Private_CT
{
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": ",
"FSM: ",pl_fsm.name," Sibling listener rows: ",
pl_fsm.siblingListenerRowList
))
}
for (var integer vl_row:=0; vl_row < sizeof(pl_fsm.siblingListenerRowList); vl_row := vl_row+1) {
if ( ischosen(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.singleEventFromSibling) ){
var charstring vl_fsmType := f_EPTF_LGenBase_getFsmTypeOfSiblingFsm(pl_tcIdx,pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.singleEventFromSibling.siblingName);
if("" == vl_fsmType){
f_EPTF_LGenBase_loggingError(%definitionId&": Sibling FSM "&pl_fsm.name&
" of traffic case "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName&
" refers to a sibling "&
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.singleEventFromSibling.siblingName&
" in row#"&log2str(pl_fsm.siblingListenerRowList[vl_row].row)&
" but it is not present in the TC."
);
}
var integer vl_siblingRef :=
f_EPTF_LGenBase_addSiblingRef(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.singleEventFromSibling.siblingName,pl_fsm);
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": ",
"\nTC: ",v_LGenBase_trafficCases[pl_tcIdx].uniqueName,
"\nFSM: ",pl_fsm.name,
"\nSibling reference list of FSM: ",pl_fsm.referredFsmList,
"\nListener row: ",pl_fsm.siblingListenerRowList[vl_row],
"\nSibling reference: ",vl_siblingRef,
"\nFSM type of referred sibling: ",vl_fsmType
))
}
f_EPTF_LGenBase_appendEventToList(
f_EPTF_LGenBase_convertEvent(
vl_fsmType,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.singleEventFromSibling.iName,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.singleEventFromSibling.eventType,
pl_fsm, pl_fsm.siblingListenerRowList[vl_row].row),
pl_fsm.siblingListenerRowList[vl_row].row,
sizeof(pl_siblingEventXref),
pl_siblingEventXref,
vl_siblingRef)
}
else if ( ischosen(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling) ){
var charstring vl_fsmType := f_EPTF_LGenBase_getFsmTypeOfSiblingFsm(pl_tcIdx,pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling.siblingName);
if("" == vl_fsmType){
f_EPTF_LGenBase_loggingError(%definitionId&": Sibling FSM "&pl_fsm.name&
" of traffic case "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName&
" refers to a sibling "&
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling.siblingName&
" in row#"&log2str(pl_fsm.siblingListenerRowList[vl_row].row)&
" but it is not present in the TC."
);
}
var integer vl_siblingRef :=
f_EPTF_LGenBase_addSiblingRef(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling.siblingName,pl_fsm);
var integer vl_xrefSize := sizeof(pl_siblingEventXref)
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": ",
"\nTC: ",v_LGenBase_trafficCases[pl_tcIdx].uniqueName,
"\nFSM: ",pl_fsm.name,
"\nSibling reference list of FSM: ",pl_fsm.referredFsmList,
"\nListener row: ",pl_fsm.siblingListenerRowList[vl_row],
"\nSibling reference: ",vl_siblingRef,
"\nFSM type of referred sibling: ",vl_fsmType
))
}
for ( var integer vl_i := 0; vl_i < sizeof(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling.iNameList) ; vl_i := vl_i+1 ){
f_EPTF_LGenBase_appendEventToList(
f_EPTF_LGenBase_convertEvent(
vl_fsmType,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling.iNameList[vl_i],
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventListFromSibling.eventType,
pl_fsm, pl_fsm.siblingListenerRowList[vl_row].row),
pl_fsm.siblingListenerRowList[vl_row].row,
vl_xrefSize,
pl_siblingEventXref,
vl_siblingRef)
}
}
else if ( ischosen(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling) ){
var charstring vl_fsmType := f_EPTF_LGenBase_getFsmTypeOfSiblingFsm(pl_tcIdx,pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.siblingName);
if("" == vl_fsmType){
f_EPTF_LGenBase_loggingError(%definitionId&": Sibling FSM "&pl_fsm.name&
" of traffic case "&v_LGenBase_trafficCases[pl_tcIdx].uniqueName&
" refers to a sibling "&
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.siblingName&
" in row#"&log2str(pl_fsm.siblingListenerRowList[vl_row].row)&
" but it is not present in the TC."
);
}
var integer vl_siblingRef :=
f_EPTF_LGenBase_addSiblingRef(pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.siblingName,pl_fsm);
var integer vl_xrefSize := sizeof(pl_siblingEventXref)
// check limits of event interval
var EPTF_LGenBase_EventDescriptor vl_low := f_EPTF_LGenBase_convertEvent(
vl_fsmType,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.iNameMin,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.eventType,
pl_fsm,
pl_fsm.siblingListenerRowList[vl_row].row
);
var EPTF_LGenBase_EventDescriptor vl_hi := f_EPTF_LGenBase_convertEvent(
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.siblingName,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.iNameMax,
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.eventType,
pl_fsm,
pl_fsm.siblingListenerRowList[vl_row].row
);
// check if range is valid
if(vl_low.iIdx > vl_hi.iIdx){
f_EPTF_LGenBase_loggingError(%definitionId&
": The declared event input names <" &
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.iNameMin &", " &
pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling.eventRangeFromSibling.iNameMax &
"> don't specify a valid range!")
}
// iterate through the event range, create internal events and put them to output list
if (c_EPTF_Common_debugSwitch and f_EPTF_LGenBase_isEnabled(c_EPTF_LGenBase_loggingClassIdx_DebugConfig)){
f_EPTF_LGenBase_loggingDebugConfig(log2str(%definitionId,": ",
"\nTC: ",v_LGenBase_trafficCases[pl_tcIdx].uniqueName,
"\nFSM: ",pl_fsm.name,
"\nSibling reference list of FSM: ",pl_fsm.referredFsmList,
"\nListener row: ",pl_fsm.siblingListenerRowList[vl_row],
"\nSibling reference: ",vl_siblingRef,
"\nFSM type of referred sibling: ",vl_fsmType
))
}
for (var integer j:= vl_low.iIdx; j<=vl_hi.iIdx; j:=j+1) {
f_EPTF_LGenBase_appendEventToList(
{vl_low.bIdx, j, vl_low.eventType},
pl_fsm.siblingListenerRowList[vl_row].row,
vl_xrefSize,
pl_siblingEventXref,
vl_siblingRef);
}
} else {
f_EPTF_LGenBase_loggingError(%definitionId&
": Invalid EPTF_LGenBase_EventsFromSibling type: "&
log2str( pl_fsm.siblingListenerRowList[vl_row].eventsFromSibling )&
" in FSM "&pl_fsm.name);
}
}
f_EPTF_LGenBase_fillEventsHasmaps(pl_tableIdx,pl_siblingEventXref,pl_tcIdx,pl_siblingIdx);
}
private function f_EPTF_LGenBase_fsmVarDebugPostproc(
in integer pl_idx,
in EPTF_IntegerList pl_argList)
runs on EPTF_LGenBase_Private_CT{
var charstring vl_varName := f_EPTF_Var_getName(pl_idx)
var EPTF_Var_DirectContent vl_content
f_EPTF_Var_getContent(pl_idx, vl_content)
f_EPTF_LGenBase_loggingDebugFsmVars(%definitionId&": The content of the FSM variable "&
vl_varName&" has been changed to "&log2str(vl_content))
}
type record of EPTF_CharstringList EPTF_CharstringListArray
friend function f_EPTF_LGenBase_registerStatHandlerProviders(
in EPTF_LGenBase_FsmStatProviderDescriptorList pl_providers,
in EPTF_LGenBase_InternalFsmTable plTable,
in integer pl_tIdx,
in integer pl_tcIdx,
in charstring pl_statName,
in integer pl_statScope,
in integer pl_statFSMIdx, // statHandler's newFsmCtxIdx, it is used widely, it should be given each and every call.
in integer pl_statRelEIdx := -1 // statHandler's entityIdx, only used at FSM and siblingFSM scope StatHandler, not in tc scope
)
runs on EPTF_LGenBase_Private_CT{
var integer vl_providerCount := sizeof(pl_providers);
var integer vl_eCount := v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].eCount
var integer vl_eOffset := v_LGenBase_entityGroups[v_LGenBase_trafficCases[pl_tcIdx].eGroupBackref].eOffset
var EPTF_CharstringListArray vl_varNames := {}
var EPTF_CharstringList vl_statHandlerIdList := {}
var EPTF_IntegerList vl_statMeasIdList := {}
//FSM scope statHandler
if(c_EPTF_LGenBase_fsmObjectScopeFSM == pl_statScope) {
for ( var integer vl_provider := 0; vl_provider < vl_providerCount ; vl_provider := vl_provider+1 ){
//FSM scope statHandler with variable provider
if ( ischosen(pl_providers[vl_provider].varXrefList) ){
//Variable providers for FSM scope statHandler
for ( var integer vl_var := 0; vl_var < sizeof(pl_providers[vl_provider].varXrefList) ; vl_var := vl_var+1 ){
var integer vl_varXRef := pl_providers[vl_provider].varXrefList[vl_var];
var EPTF_LGenBase_FsmObjectScope vl_varScope := plTable.varXRefs[vl_varXRef].scope;
var integer vl_idxInScope := plTable.varXRefs[vl_varXRef].idxInScope;
var charstring vl_varName := v_LGenBase_fsmTables[pl_tIdx].varListArray[vl_varScope][vl_idxInScope].name
select( vl_varScope ){
// statHandler : FSM scope, provider : FSM scope variable
case ( c_EPTF_LGenBase_fsmObjectScopeFSM ){
vl_varNames[0][vl_var] := f_EPTF_LGenBase_varNameOfFSMVar( vl_eOffset+pl_statRelEIdx, pl_statFSMIdx, vl_varName);
}
// statHandler : FSM scope, provider : siblingFSM scope variable
case ( c_EPTF_LGenBase_fsmObjectScopeSiblingFSM ){
vl_varNames[0][vl_var] := f_EPTF_LGenBase_varNameOfSiblingFSMsVar( pl_tcIdx, pl_statRelEIdx, vl_varName);
}
// statHandler : FSM scope, provider : TC scope variable
case ( c_EPTF_LGenBase_fsmObjectScopeTC ){
vl_varNames[0][vl_var] := f_EPTF_LGenBase_varNameOfTCVar( pl_tcIdx, vl_varName);
}
// statHandler : FSM scope, provider : not known scope variable
case else
{
f_EPTF_LGenBase_loggingError(%definitionId&": Invalid scope of provider: "&log2str(vl_varScope)&", in case of FSM scope stathandler");
}
}
}
}
//FSM scope statHandler with StatMeas providers
else if ( ischosen(pl_providers[vl_provider].statMeasXref) ){
var integer vl_statMeasXRef := pl_providers[vl_provider].statMeasXref;
var EPTF_LGenBase_FsmObjectScope vl_varScope := v_LGenBase_fsmTables[pl_tIdx].statMeasXRefs[vl_statMeasXRef].scope
var integer vl_idxInScope := v_LGenBase_fsmTables[pl_tIdx].statMeasXRefs[vl_statMeasXRef].idxInScope
var charstring vl_varName := v_LGenBase_fsmTables[pl_tIdx].statMeasStatListArray[