MIDAS
Loading...
Searching...
No Matches
Myfe Class Reference
Inheritance diagram for Myfe:
Collaboration diagram for Myfe:

Public Member Functions

 Myfe (TMFE *mfe, TMFeEquipment *eq)
 
 ~Myfe ()
 
void Init ()
 
void SendEvent (double dvalue)
 
std::string HandleRpc (const char *cmd, const char *args)
 
void HandleBeginRun ()
 
void HandleEndRun ()
 
void HandlePeriodic ()
 
 Myfe (TMFE *mfe, TMFeEquipment *eq)
 
 ~Myfe ()
 
void Init ()
 
void SendEvent (double dvalue)
 
std::string HandleRpc (const char *cmd, const char *args)
 
void HandleBeginRun ()
 
void HandleEndRun ()
 
void HandlePeriodic ()
 
 Myfe (const char *eqname, const char *eqfilename)
 
 ~Myfe ()
 
void SendData (double dvalue)
 
TMFeResult HandleRpc (const char *cmd, const char *args, std::string &response)
 
TMFeResult HandleBeginRun (int run_number)
 
TMFeResult HandleEndRun (int run_number)
 
void HandlePeriodic ()
 
- Public Member Functions inherited from TMFeRpcHandlerInterface
virtual TMFeResult HandleBinaryRpc (const char *cmd, const char *args, std::vector< char > &result)
 
virtual void HandlePauseRun ()
 
virtual void HandleResumeRun ()
 
virtual void HandleStartAbortRun ()
 
- Public Member Functions inherited from TMFeEquipment
 TMFeEquipment (const char *eqname, const char *eqfilename)
 
virtual ~TMFeEquipment ()
 
TMFeResult EqInit (const std::vector< std::string > &args)
 Initialize equipment.
 
TMFeResult EqPreInit ()
 Initialize equipment, before EquipmentBase::Init()
 
TMFeResult EqPostInit ()
 Initialize equipment, after EquipmentBase::Init()
 
TMFeResult EqReadCommon ()
 Read TMFeEqInfo from ODB /Equipment/NAME/Common.
 
TMFeResult EqWriteCommon (bool create=false)
 Write TMFeEqInfo to ODB /Equipment/NAME/Common.
 
virtual TMFeResult HandleInit (const std::vector< std::string > &args)
 
virtual void HandleUsage ()
 
virtual TMFeResult HandlePauseRun (int run_number)
 
virtual TMFeResult HandleResumeRun (int run_number)
 
virtual TMFeResult HandleStartAbortRun (int run_number)
 
virtual bool HandlePoll ()
 
virtual void HandlePollRead ()
 
void EqPollThread ()
 
void EqStartPollThread ()
 
void EqStopPollThread ()
 
TMFeResult ComposeEvent (char *pevent, size_t size) const
 
TMFeResult BkInit (char *pevent, size_t size) const
 
voidBkOpen (char *pevent, const char *bank_name, int bank_type) const
 
TMFeResult BkClose (char *pevent, void *ptr) const
 
int BkSize (const char *pevent) const
 
TMFeResult EqSendEvent (const char *pevent, bool write_to_odb=true)
 
TMFeResult EqSendEvent (const std::vector< char > &event, bool write_to_odb=true)
 
TMFeResult EqSendEvent (const std::vector< std::vector< char > > &event, bool write_to_odb=true)
 
TMFeResult EqSendEvent (int sg_n, const char *sg_ptr[], const size_t sg_len[], bool write_to_odb=true)
 
TMFeResult EqWriteEventToOdb (const char *pevent)
 
TMFeResult EqZeroStatistics ()
 
TMFeResult EqWriteStatistics ()
 
TMFeResult EqSetStatus (const char *status, const char *color)
 
 TMFeEquipment (TMFE *mfe, const char *name, TMFeCommon *common)
 
TMFeError Init ()
 Initialize equipment.
 
TMFeError SendData (const char *data, int size)
 ...
 
TMFeError ComposeEvent (char *pevent, int size)
 
TMFeError BkInit (char *pevent, int size)
 
voidBkOpen (char *pevent, const char *bank_name, int bank_type)
 
TMFeError BkClose (char *pevent, void *ptr)
 
int BkSize (const char *pevent)
 
TMFeError SendEvent (const char *pevent)
 
TMFeError ZeroStatistics ()
 
TMFeError WriteStatistics ()
 
TMFeError SetStatus (const char *status, const char *color)
 

Public Attributes

TMFEfMfe
 
TMFeEquipmentfEq
 
int fEventSize
 
charfEventBuf
 
- Public Attributes inherited from TMFeEquipment
std::string fEqName
 
std::string fEqFilename
 
bool fEqConfEnableRpc = true
 
bool fEqConfEnablePeriodic = true
 
bool fEqConfEnablePoll = false
 
bool fEqConfReadConfigFromOdb = true
 
bool fEqConfEnabled = true
 
uint16_t fEqConfEventID = 1
 
uint16_t fEqConfTriggerMask = 0
 
std::string fEqConfBuffer = "SYSTEM"
 
int fEqConfType = 0
 
int fEqConfSource = 0
 
std::string fEqConfFormat = "MIDAS"
 
int fEqConfReadOn = 0
 
int fEqConfPeriodMilliSec = 1000
 
double fEqConfEventLimit = 0
 
uint32_t fEqConfNumSubEvents = 0
 
int fEqConfLogHistory = 0
 
bool fEqConfHidden = false
 
int fEqConfWriteCacheSize = 10000000
 
bool fEqConfReadOnlyWhenRunning = true
 
bool fEqConfWriteEventsToOdb = false
 
double fEqConfPeriodStatisticsSec = 1.0
 
double fEqConfPollSleepSec = 0.000100
 
size_t fEqConfMaxEventSize = 0
 
size_t fEqConfBufferSize = 0
 
std::mutex fEqMutex
 
TMFEfMfe = NULL
 
TMFrontendfFe = NULL
 
MVOdbfOdbEq = NULL
 ODB Equipment/EQNAME.
 
MVOdbfOdbEqCommon = NULL
 ODB Equipment/EQNAME/Common.
 
MVOdbfOdbEqSettings = NULL
 ODB Equipment/EQNAME/Settings.
 
MVOdbfOdbEqVariables = NULL
 ODB Equipment/EQNAME/Variables.
 
MVOdbfOdbEqStatistics = NULL
 ODB Equipment/EQNAME/Statistics.
 
TMEventBufferfEqEventBuffer = NULL
 
int fEqSerial = 0
 
double fEqStatEvents = 0
 
double fEqStatBytes = 0
 
double fEqStatEpS = 0
 
double fEqStatKBpS = 0
 
double fEqStatLastTime = 0
 
double fEqStatLastEvents = 0
 
double fEqStatLastBytes = 0
 
double fEqStatLastWrite = 0
 
double fEqStatNextWrite = 0
 
double fEqPeriodicLastCallTime = 0
 
double fEqPeriodicNextCallTime = 0
 
std::atomic_bool fEqPollThreadStarting {false}
 
std::atomic_bool fEqPollThreadRunning {false}
 
std::atomic_bool fEqPollThreadShutdownRequested {false}
 
std::thread * fEqPollThread = NULL
 
std::string fName
 
TMFeCommonfCommon
 
int fBufferHandle
 
int fSerial
 
double fStatEvents
 
double fStatBytes
 
double fStatEpS
 
double fStatKBpS
 
double fStatLastTime
 
double fStatLastEvents
 
double fStatLastBytes
 

Detailed Description

Definition at line 15 of file fetest_tmfe.cxx.

Constructor & Destructor Documentation

◆ Myfe() [1/3]

Myfe::Myfe ( TMFE mfe,
TMFeEquipment eq 
)
inline

Definition at line 26 of file fetest_tmfe.cxx.

27 {
28 fMfe = mfe;
29 fEq = eq;
30 fEventSize = 0;
32 }
TMFeEquipment * fEq
char * fEventBuf
TMFE * fMfe
int fEventSize
std::vector< FMT_ID > eq
Definition mdump.cxx:55
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function:

◆ ~Myfe() [1/3]

Myfe::~Myfe ( )
inline

Definition at line 34 of file fetest_tmfe.cxx.

35 {
36 if (fEventBuf) {
37 free(fEventBuf);
39 }
40 }
Here is the call graph for this function:

◆ Myfe() [2/3]

Myfe::Myfe ( TMFE mfe,
TMFeEquipment eq 
)
inline

Definition at line 27 of file fetest_tmfe_thread.cxx.

28 {
29 fMfe = mfe;
30 fEq = eq;
31 fEventSize = 0;
33 }
Here is the call graph for this function:

◆ ~Myfe() [2/3]

Myfe::~Myfe ( )
inline

Definition at line 35 of file fetest_tmfe_thread.cxx.

36 {
37 if (fEventBuf) {
38 free(fEventBuf);
40 }
41 }
Here is the call graph for this function:

◆ Myfe() [3/3]

Myfe::Myfe ( const char eqname,
const char eqfilename 
)
inline

Definition at line 21 of file tmfe_example_multithread.cxx.

23 {
24 }
TMFeEquipment()
Definition tmfe.h:255

◆ ~Myfe() [3/3]

Myfe::~Myfe ( )
inline

Definition at line 26 of file tmfe_example_multithread.cxx.

27 {
28 }

Member Function Documentation

◆ HandleBeginRun() [1/3]

void Myfe::HandleBeginRun ( )
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 70 of file fetest_tmfe.cxx.

71 {
72 fMfe->Msg(MINFO, "HandleBeginRun", "Begin run!");
73 fEq->SetStatus("Running", "#00FF00");
74 }
void Msg(int message_type, const char *filename, int line, const char *routine, const char *format,...) MATTRPRINTF(6
Definition tmfe.cxx:991
TMFeError SetStatus(const char *status, const char *color)
#define MINFO
Definition midas.h:560
Here is the call graph for this function:

◆ HandleBeginRun() [2/3]

void Myfe::HandleBeginRun ( )
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 71 of file fetest_tmfe_thread.cxx.

72 {
73 fMfe->Msg(MINFO, "HandleBeginRun", "Thread %s, Begin run!", TMFE::GetThreadId().c_str());
74 fEq->SetStatus("Running", "#00FF00");
75 }
static std::string GetThreadId()
return identification of this thread
Definition tmfe.cxx:1140
Here is the call graph for this function:

◆ HandleBeginRun() [3/3]

TMFeResult Myfe::HandleBeginRun ( int  run_number)
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 49 of file tmfe_example_multithread.cxx.

50 {
51 fMfe->Msg(MINFO, "HandleBeginRun", "Thread %s, Begin run %d!", TMFE::GetThreadId().c_str(), run_number);
52 EqSetStatus("Running", "#00FF00");
53 return TMFeOk();
54 }
TMFeResult EqSetStatus(const char *status, const char *color)
Definition tmfe.cxx:2215
INT run_number[2]
Definition mana.cxx:246
TMFeResult TMFeOk()
Definition tmfe.h:106
Here is the call graph for this function:

◆ HandleEndRun() [1/3]

void Myfe::HandleEndRun ( )
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 76 of file fetest_tmfe.cxx.

77 {
78 fMfe->Msg(MINFO, "HandleEndRun", "End run!");
79 fEq->SetStatus("Stopped", "#00FF00");
80 }
Here is the call graph for this function:

◆ HandleEndRun() [2/3]

void Myfe::HandleEndRun ( )
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 77 of file fetest_tmfe_thread.cxx.

78 {
79 fMfe->Msg(MINFO, "HandleEndRun", "Thread %s, End run!", TMFE::GetThreadId().c_str());
80 fEq->SetStatus("Stopped", "#00FF00");
81 }
Here is the call graph for this function:

◆ HandleEndRun() [3/3]

TMFeResult Myfe::HandleEndRun ( int  run_number)
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 56 of file tmfe_example_multithread.cxx.

57 {
58 fMfe->Msg(MINFO, "HandleEndRun", "Thread %s, End run %d!", TMFE::GetThreadId().c_str(), run_number);
59 EqSetStatus("Stopped", "#00FF00");
60 return TMFeOk();
61 }
Here is the call graph for this function:

◆ HandlePeriodic() [1/3]

void Myfe::HandlePeriodic ( )
inlinevirtual

Implements TMFePeriodicHandlerInterface.

Definition at line 88 of file fetest_tmfe.cxx.

89 {
90 printf("periodic!\n");
91 //char buf[256];
92 //sprintf(buf, "buffered %d (max %d), dropped %d, unknown %d, max flushed %d", gUdpPacketBufSize, fMaxBuffered, fCountDroppedPackets, fCountUnknownPackets, fMaxFlushed);
93 //fEq->SetStatus(buf, "#00FF00");
94 //fEq->WriteStatistics();
95 }
Here is the call graph for this function:

◆ HandlePeriodic() [2/3]

void Myfe::HandlePeriodic ( )
inlinevirtual

Implements TMFePeriodicHandlerInterface.

Definition at line 83 of file fetest_tmfe_thread.cxx.

84 {
85 printf("Thread %s, periodic!\n", TMFE::GetThreadId().c_str());
86 //char buf[256];
87 //sprintf(buf, "buffered %d (max %d), dropped %d, unknown %d, max flushed %d", gUdpPacketBufSize, fMaxBuffered, fCountDroppedPackets, fCountUnknownPackets, fMaxFlushed);
88 //fEq->SetStatus(buf, "#00FF00");
89 //fEq->WriteStatistics();
90 }
Here is the call graph for this function:

◆ HandlePeriodic() [3/3]

void Myfe::HandlePeriodic ( )
inlinevirtual

Implements TMFePeriodicHandlerInterface.

Definition at line 70 of file tmfe_example_multithread.cxx.

71 {
72 printf("Thread %s, periodic!\n", TMFE::GetThreadId().c_str());
73 double t = TMFE::GetTime();
74 double data = 100.0*sin(M_PI/2.0+M_PI*t/60);
76 fOdbEqVariables->WD("data", data);
77 char status_buf[256];
78 sprintf(status_buf, "value %.1f", data);
79 EqSetStatus(status_buf, "#00FF00");
80 }
void SendData(double dvalue)
static double GetTime()
return current time in seconds, with micro-second precision
Definition tmfe.cxx:1011
MVOdb * fOdbEqVariables
ODB Equipment/EQNAME/Variables.
Definition tmfe.h:214
void * data
Definition mana.cxx:268
Here is the call graph for this function:

◆ HandleRpc() [1/3]

std::string Myfe::HandleRpc ( const char cmd,
const char args 
)
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 64 of file fetest_tmfe.cxx.

65 {
66 fMfe->Msg(MINFO, "HandleRpc", "RPC cmd [%s], args [%s]", cmd, args);
67 return "OK";
68 }
Here is the call graph for this function:

◆ HandleRpc() [2/3]

std::string Myfe::HandleRpc ( const char cmd,
const char args 
)
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 65 of file fetest_tmfe_thread.cxx.

66 {
67 fMfe->Msg(MINFO, "HandleRpc", "Thread %s, RPC cmd [%s], args [%s]", TMFE::GetThreadId().c_str(), cmd, args);
68 return "OK";
69 }
Here is the call graph for this function:

◆ HandleRpc() [3/3]

TMFeResult Myfe::HandleRpc ( const char cmd,
const char args,
std::string &  response 
)
inlinevirtual

Reimplemented from TMFeRpcHandlerInterface.

Definition at line 43 of file tmfe_example_multithread.cxx.

44 {
45 fMfe->Msg(MINFO, "HandleRpc", "Thread %s, RPC cmd [%s], args [%s]", TMFE::GetThreadId().c_str(), cmd, args);
46 return TMFeOk();
47 }
Here is the call graph for this function:

◆ Init() [1/2]

void Myfe::Init ( )
inline

Definition at line 42 of file fetest_tmfe.cxx.

43 {
44 fEventSize = 100;
45 fEq->fOdbEqSettings->RI("event_size", &fEventSize, true);
46 if (fEventBuf) {
47 free(fEventBuf);
48 }
49 fEventBuf = (char*)malloc(fEventSize);
50 }
MVOdb * fOdbEqSettings
ODB Equipment/EQNAME/Settings.
Definition tmfe.h:213
Here is the call graph for this function:

◆ Init() [2/2]

void Myfe::Init ( )
inline

Definition at line 43 of file fetest_tmfe_thread.cxx.

44 {
45 fEventSize = 100;
46 fEq->fOdbEqSettings->RI("event_size", &fEventSize, true);
47 if (fEventBuf) {
48 free(fEventBuf);
49 }
50 fEventBuf = (char*)malloc(fEventSize);
51 }
Here is the call graph for this function:

◆ SendData()

void Myfe::SendData ( double  dvalue)
inline

Definition at line 30 of file tmfe_example_multithread.cxx.

31 {
32 char buf[1024];
33 ComposeEvent(buf, sizeof(buf));
34 BkInit(buf, sizeof(buf));
35
36 double* ptr = (double*)BkOpen(buf, "test", TID_DOUBLE);
37 *ptr++ = dvalue;
38 BkClose(buf, ptr);
39
40 EqSendEvent(buf);
41 }
void * BkOpen(char *pevent, const char *bank_name, int bank_type) const
Definition tmfe.cxx:2201
TMFeResult BkInit(char *pevent, size_t size) const
Definition tmfe.cxx:2195
TMFeResult BkClose(char *pevent, void *ptr) const
Definition tmfe.cxx:2208
TMFeResult ComposeEvent(char *pevent, size_t size) const
Definition tmfe.cxx:1995
TMFeResult EqSendEvent(const char *pevent, bool write_to_odb=true)
Definition tmfe.cxx:2006
#define TID_DOUBLE
Definition midas.h:343
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendEvent() [1/2]

void Myfe::SendEvent ( double  dvalue)
inline

Definition at line 52 of file fetest_tmfe.cxx.

53 {
56
57 double* ptr = (double*)fEq->BkOpen(fEventBuf, "test", TID_DOUBLE);
58 *ptr = dvalue;
59 fEq->BkClose(fEventBuf, ptr+1);
60
62 }
TMFeError SendEvent(const char *pevent)
Here is the call graph for this function:

◆ SendEvent() [2/2]

void Myfe::SendEvent ( double  dvalue)
inline

Definition at line 53 of file fetest_tmfe_thread.cxx.

54 {
57
58 double* ptr = (double*)fEq->BkOpen(fEventBuf, "test", TID_DOUBLE);
59 *ptr = dvalue;
60 fEq->BkClose(fEventBuf, ptr+1);
61
63 }
Here is the call graph for this function:

Member Data Documentation

◆ fEq

TMFeEquipment * Myfe::fEq

Definition at line 21 of file fetest_tmfe.cxx.

◆ fEventBuf

char * Myfe::fEventBuf

Definition at line 24 of file fetest_tmfe.cxx.

◆ fEventSize

int Myfe::fEventSize

Definition at line 23 of file fetest_tmfe.cxx.

◆ fMfe

TMFE * Myfe::fMfe

Definition at line 20 of file fetest_tmfe.cxx.


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