Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:21:01

0001 #include "example_plugin.h"
0002 #include <daq_device_pluginexample.h>
0003 
0004 #include <strings.h>
0005 
0006 int example_plugin::create_device(deviceblock *db)
0007 {
0008 
0009   //std::cout << __LINE__ << "  " << __FILE__ << "  " << db->argv0 << std::endl;
0010 
0011   if ( strcasecmp(db->argv0,"device_pluginexample") == 0 ) 
0012     {
0013       // we need at least 4 params
0014       if ( db->npar <4 ) return 1; // indicate wrong params
0015       
0016       int eventtype  = atoi ( db->argv1); // event type
0017       int subid = atoi ( db->argv2); // subevent id
0018 
0019       if  ( db->npar == 4)
0020     {
0021 
0022       add_readoutdevice ( new daq_device_pluginexample( eventtype,
0023                                                      subid,
0024                              atoi ( db->argv3)));
0025       return 0;  // say "we handled this request" 
0026     }
0027       else
0028     {
0029 
0030       add_readoutdevice ( new daq_device_pluginexample( eventtype,
0031                                                      subid,
0032                              atoi ( db->argv3),
0033                              atoi ( db->argv4)));
0034       return 0;  // say "we handled this request" 
0035     }
0036     }
0037 
0038   return -1; // say " this is not out device"
0039 }
0040 
0041 void example_plugin::identify(std::ostream& os, const int flag) const
0042 {
0043 
0044   if ( flag <=2 )
0045     {
0046       os << " - Example Plugin" << std::endl;
0047     }
0048   else
0049     {
0050       os << " - Example Plugin, provides - " << std::endl;
0051       os << " -     device_pluginexample (evttype, subid, nwords [,triggerenable]) - readout a silly plugin example device" << std::endl;
0052 
0053     }
0054       
0055 }
0056 
0057 example_plugin _ep;
0058