LCOV - code coverage report
Current view: top level - progs - tmfe_example_indexed.cxx (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 27 0
Test Date: 2025-11-11 10:26:08 Functions: 0.0 % 4 0

            Line data    Source code
       1              : /*******************************************************************\
       2              : 
       3              :   Name:         tmfe_example_indexed.cxx
       4              :   Created by:   K.Olchanski
       5              : 
       6              :   Contents:     Example of indexed equipment
       7              : 
       8              : \********************************************************************/
       9              : 
      10              : #undef NDEBUG // midas required assert() to be always enabled
      11              : 
      12              : #include <stdio.h>
      13              : #include <math.h> // M_PI
      14              : 
      15              : #include "tmfe.h"
      16              : 
      17              : class EqPeriodic :
      18              :    public TMFeEquipment
      19              : {
      20              : public:
      21            0 :    EqPeriodic(const char* eqname, const char* eqfilename) // ctor
      22            0 :       : TMFeEquipment(eqname, eqfilename)
      23              :    {
      24              :       /* configure your equipment here */
      25              : 
      26            0 :       fEqConfReadConfigFromOdb = false;
      27            0 :       fEqConfEventID = 3;
      28            0 :       fEqConfBuffer = "BUF%02d";
      29            0 :       fEqConfPeriodMilliSec = 1000; // in milliseconds
      30            0 :       fEqConfLogHistory = 0;
      31            0 :       fEqConfWriteEventsToOdb = false;
      32            0 :    }
      33              : 
      34            0 :    void HandlePeriodic()
      35              :    {
      36              :       char buf[1024];
      37              : 
      38            0 :       ComposeEvent(buf, sizeof(buf));
      39            0 :       BkInit(buf, sizeof(buf));
      40              : 
      41              :       /* create SCLR bank */
      42            0 :       uint32_t* pdata = (uint32_t*)BkOpen(buf, "PRDC", TID_UINT32);
      43              :       
      44              :       /* following code "simulates" some values in sine wave form */
      45            0 :       for (int a = 0; a < 16; a++)
      46            0 :          *pdata++ = 100*sin(M_PI*time(NULL)/60+a/2.0)+100;
      47              :       
      48            0 :       BkClose(buf, pdata);
      49              : 
      50            0 :       EqSendEvent(buf);
      51            0 :    }
      52              : };
      53              : 
      54              : class FeExample: public TMFrontend
      55              : {
      56              : public:
      57            0 :    FeExample() // ctor
      58            0 :    {
      59              :       /* register with the framework */
      60            0 :       FeSetName("example_%02d");
      61            0 :       FeAddEquipment(new EqPeriodic("example_%02d", __FILE__));
      62            0 :    }
      63              : };
      64              : 
      65            0 : int main(int argc, char* argv[])
      66              : {
      67            0 :    FeExample fe_example;
      68            0 :    return fe_example.FeMain(argc, argv);
      69            0 : }
      70              : 
      71              : /* emacs
      72              :  * Local Variables:
      73              :  * tab-width: 8
      74              :  * c-basic-offset: 3
      75              :  * indent-tabs-mode: nil
      76              :  * End:
      77              :  */
        

Generated by: LCOV version 2.0-1