ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
Public Member Functions | Public Attributes | List of all members
rec.simulator.Simulator Class Reference

Simulator that implements RecCmdsSyncService and sets up simulation behaviour for Simulator. More...

Public Member Functions

def __init__ (self, name, mal, dataroot)
 
RecStatus RecStart (self, RecProperties properties)
 
RecStatus RecStop (self)
 
str RecAbort (self)
 
RecStatus RecWait (self, RecWaitSpec spec)
 
RecStatus RecStatus (self, str rec_id)
 
RecStatus RecPause (self)
 
Recording get_recording (self, rec_id)
 Get recording or raise ExceptionErr. More...
 
RecStatus make_rec_status (self, rec_id)
 <struct name="RecStatus"> <member name="dpFiles" type="string" arrayDimensions="(32)"> <member name="endTime" type="double"> <member name="filesGenerated" type="int32_t"> <member name="framesProcessed" type="int32_t"> <member name="framesRemaining" type="int32_t"> <member name="id" type="string"> <member name="info" type="string"> <member name="remainingTime" type="double"> <member name="sizeRecorded" type="int32_t"> <member name="startTime" type="double"> <member name="status" type="nonBasic" nonBasicTypeName="RecStatusNames"> <member name="timeElapsed" type="double"> </struct> More...
 
RecStatus populate_rec_status (self, Recording rec, RecStatus status)
 Populates RecStatus from status. More...
 
RecWaitStatus make_rec_wait_status (self, rec_id)
 Creates RecWaitStatus and populates attributes. More...
 
def add_sim_hook (self, str cmd_name, hook)
 Add the simulation hook hook for the specified command cmd_name (e.g. More...
 
def reset (self)
 Reset simulator to initial default state. More...
 
def clear_sim_hooks (self)
 Remove all simulation hooks. More...
 
def run_sim_hook (self, result, *args)
 Runs simulation hook that may modify or replace the default implementation. More...
 

Public Attributes

 name
 
 mal
 
 dataroot
 
 current_rec
 
 recordings
 
 sim_hooks
 

Detailed Description

Simulator that implements RecCmdsSyncService and sets up simulation behaviour for Simulator.

Registered hooks are run once and then removed before executed. Each hook is a callable that takes the result from the default implementation as well as the arguments given to the original implementation. The hook can then choose to modify the existing result or replace it.

Definition at line 50 of file simulator.py.

Constructor & Destructor Documentation

◆ __init__()

def rec.simulator.Simulator.__init__ (   self,
  name,
  mal,
  dataroot 
)

Definition at line 52 of file simulator.py.

Member Function Documentation

◆ add_sim_hook()

def rec.simulator.Simulator.add_sim_hook (   self,
str  cmd_name,
  hook 
)

Add the simulation hook hook for the specified command cmd_name (e.g.

"RecStart").

Any previous hooks will be replaced.

Definition at line 230 of file simulator.py.

◆ clear_sim_hooks()

def rec.simulator.Simulator.clear_sim_hooks (   self)

Remove all simulation hooks.

Definition at line 240 of file simulator.py.

◆ get_recording()

Recording rec.simulator.Simulator.get_recording (   self,
  rec_id 
)

Get recording or raise ExceptionErr.

Definition at line 161 of file simulator.py.

◆ make_rec_status()

RecStatus rec.simulator.Simulator.make_rec_status (   self,
  rec_id 
)

<struct name="RecStatus"> <member name="dpFiles" type="string" arrayDimensions="(32)"> <member name="endTime" type="double"> <member name="filesGenerated" type="int32_t"> <member name="framesProcessed" type="int32_t"> <member name="framesRemaining" type="int32_t"> <member name="id" type="string"> <member name="info" type="string"> <member name="remainingTime" type="double"> <member name="sizeRecorded" type="int32_t"> <member name="startTime" type="double"> <member name="status" type="nonBasic" nonBasicTypeName="RecStatusNames"> <member name="timeElapsed" type="double"> </struct>

Definition at line 182 of file simulator.py.

◆ make_rec_wait_status()

RecWaitStatus rec.simulator.Simulator.make_rec_wait_status (   self,
  rec_id 
)

Creates RecWaitStatus and populates attributes.

Definition at line 211 of file simulator.py.

◆ populate_rec_status()

RecStatus rec.simulator.Simulator.populate_rec_status (   self,
Recording  rec,
RecStatus  status 
)

Populates RecStatus from status.

Definition at line 190 of file simulator.py.

◆ RecAbort()

str rec.simulator.Simulator.RecAbort (   self)

Definition at line 116 of file simulator.py.

◆ RecPause()

RecStatus rec.simulator.Simulator.RecPause (   self)

Definition at line 156 of file simulator.py.

◆ RecStart()

RecStatus rec.simulator.Simulator.RecStart (   self,
RecProperties  properties 
)

Definition at line 62 of file simulator.py.

◆ RecStatus()

RecStatus rec.simulator.Simulator.RecStatus (   self,
str  rec_id 
)

Definition at line 150 of file simulator.py.

◆ RecStop()

RecStatus rec.simulator.Simulator.RecStop (   self)

Definition at line 75 of file simulator.py.

◆ RecWait()

RecStatus rec.simulator.Simulator.RecWait (   self,
RecWaitSpec   spec 
)
   For the moment we simply simulate that the recording was completed
   as soon as this request was received.

Definition at line 141 of file simulator.py.

◆ reset()

def rec.simulator.Simulator.reset (   self)

Reset simulator to initial default state.

Definition at line 234 of file simulator.py.

◆ run_sim_hook()

def rec.simulator.Simulator.run_sim_hook (   self,
  result,
args 
)

Runs simulation hook that may modify or replace the default implementation.

   The hook to execute is automatically determined from the call stack, so
   this should only ever be executed directly from the service command
   implementation method.

Definition at line 249 of file simulator.py.

Member Data Documentation

◆ current_rec

rec.simulator.Simulator.current_rec

Definition at line 56 of file simulator.py.

◆ dataroot

rec.simulator.Simulator.dataroot

Definition at line 55 of file simulator.py.

◆ mal

rec.simulator.Simulator.mal

Definition at line 54 of file simulator.py.

◆ name

rec.simulator.Simulator.name

Definition at line 53 of file simulator.py.

◆ recordings

rec.simulator.Simulator.recordings

Definition at line 57 of file simulator.py.

◆ sim_hooks

rec.simulator.Simulator.sim_hooks

Definition at line 59 of file simulator.py.


The documentation for this class was generated from the following file: