EmulatedSequentialReadoutModule.cpp

00001 //$Id: EmulatedSequentialReadoutModule.cpp,v 1.2 2005/09/21 15:17:52 sctroddq Exp $
00002 /************************************************************************/
00003 /*                                  */
00004 /* File             : EmulatedSequentialReadoutModule.cpp       */
00005 /*                                  */
00006 /* Authors          : B.Gorini, M.Joos, J.Petersen ATD/CERN     */
00007 /*                                  */
00008 /********* C 2004 - ROS/RCD  ********************************************/
00009 
00010 #include <unistd.h>
00011 #include <iostream>
00012 #include "ROSModules/EmulatedSequentialDataChannel.h"
00013 #include "ROSModules/EmulatedSequentialReadoutModule.h"
00014 #include "DFDebug/DFDebug.h"
00015 #include "DFError/DFOutputStream.h"
00016 
00017 using namespace ROS;
00018 
00019 /******************************************************************/
00020 EmulatedSequentialReadoutModule::EmulatedSequentialReadoutModule() 
00021 /******************************************************************/
00022 { 
00023   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::constructor: Entered");
00024 }
00025 
00026 /*******************************************************************/
00027 EmulatedSequentialReadoutModule::~EmulatedSequentialReadoutModule() 
00028 /*******************************************************************/
00029 {
00030   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::destructor: Entered");
00031 
00032   while (m_dataChannels.size() > 0) {
00033     DataChannel *channel = m_dataChannels.back();
00034     m_dataChannels.pop_back();
00035     delete channel;     // we created them
00036   }
00037 
00038 }
00039 
00040 // setup gets parameters from configuration
00041 /**************************************************************************************/
00042 void EmulatedSequentialReadoutModule::setup(DFCountedPointer<Config> configuration) 
00043 /**************************************************************************************/
00044 { 
00045   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::setup: Entered");
00046 
00047   m_configuration = configuration;
00048 
00049   bool usePollingModule = true;
00050 
00051   m_numberOfDataChannels = configuration->getInt("numberOfChannels");
00052   DEBUG_TEXT(DFDB_ROSFM, 20, "EmulatedSequentialReadoutModule::setup: numberOfDataChannels = "
00053                               << m_numberOfDataChannels);
00054 
00055 std::cout << "We are in the setup method" << std::endl;
00056 
00057   // channel parameters
00058   for(int chan = 0; chan < m_numberOfDataChannels; chan++) {
00059     m_id.push_back(0);
00060     m_rolPhysicalAddress.push_back(0);
00061     m_usePolling.push_back(0);
00062   }
00063 
00064   for (int chan = 0; chan < m_numberOfDataChannels; chan++)
00065   {
00066     m_id[chan] = configuration->getInt("channelId",chan);
00067     m_rolPhysicalAddress[chan] = configuration->getInt("channelPhysicalAddress",chan);
00068     DEBUG_TEXT(DFDB_ROSFM, 20, "EmulatedSequentialReadoutModule::setup: chan = "
00069                                 << chan << "  id = " << m_id[chan]
00070                         << " rolPhysicalAddress = " << m_rolPhysicalAddress[chan]);
00071     m_usePolling[chan] = usePollingModule;
00072   }
00073 
00074 }
00075 
00076 /*****************************************************/
00077 void EmulatedSequentialReadoutModule::load(void)
00078 /*****************************************************/
00079 {
00080   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::load: Entered");
00081 
00082   //Create the DataChannel objects
00083   for (int chan = 0; chan < m_numberOfDataChannels; chan++) {
00084 
00085     // chan == the Config Id
00086     EmulatedSequentialDataChannel *channel = new EmulatedSequentialDataChannel(
00087                          m_id[chan],
00088                              chan,
00089                          m_rolPhysicalAddress[chan],
00090                          m_usePolling[chan],
00091                          m_configuration);
00092     m_dataChannels.push_back(channel);
00093 
00094   }
00095 
00096   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::load: Done");
00097 }
00098 
00099 /*****************************************************/
00100 void EmulatedSequentialReadoutModule::unload(void)
00101 /*****************************************************/
00102 {
00103   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::unload: Entered");
00104 
00105   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::unload: Done");
00106 }
00107 
00108 
00109 /********************************************************/
00110 void EmulatedSequentialReadoutModule::configure(void)
00111 /********************************************************/
00112 {
00113  
00114   DEBUG_TEXT(DFDB_ROSFM, 20, "EmulatedSequentialReadoutModule::configure: Entered");
00115 
00116   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::configure: Done");
00117 }
00118 
00119 
00120 /**********************************************************/
00121 void EmulatedSequentialReadoutModule::unconfigure(void)
00122 /**********************************************************/
00123 {
00124   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::unconfigure: Entered");
00125   
00126   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::unconfigure: Done");
00127 }
00128     
00129 
00130 /************************************************************/    
00131 void EmulatedSequentialReadoutModule::prepareForRun(void)
00132 /************************************************************/    
00133 {
00134   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::prepareForRun: Entered");
00135 
00136 }
00137 
00138 /************************************************************/    
00139 void EmulatedSequentialReadoutModule::startTrigger(void)
00140 /************************************************************/    
00141 {
00142   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::startTrigger: Entered");
00143 
00144   for (int chan = 0; chan < m_numberOfDataChannels; chan++) {
00145     dynamic_cast<EmulatedSequentialDataChannel *>(m_dataChannels[chan])->startTrigger();
00146   }
00147 
00148 }
00149 
00150 /************************************************************/    
00151 void EmulatedSequentialReadoutModule::stopTrigger(void)
00152 /************************************************************/    
00153 {
00154   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::stopTrigger: Entered");
00155 
00156   for (int chan = 0; chan < m_numberOfDataChannels; chan++) {
00157     dynamic_cast<EmulatedSequentialDataChannel *>(m_dataChannels[chan])->stopTrigger();
00158   }
00159 
00160 }
00161 
00162 /*****************************************************/
00163 void EmulatedSequentialReadoutModule::stopFE(void)
00164 /*****************************************************/
00165 {
00166   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::stopFE: Done");
00167 }
00168 
00169 /*************************************************************************/
00170 DFCountedPointer < Config > EmulatedSequentialReadoutModule::getInfo()
00171 /*************************************************************************/
00172 {
00173   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::getInfo: Entered");
00174 
00175   DFCountedPointer<Config> configuration = Config::New();
00176   return( configuration);
00177 
00178 }
00179 
00180 
00181 /****************************************************/
00182 void EmulatedSequentialReadoutModule::clearInfo()
00183 /****************************************************/
00184 {
00185   DEBUG_TEXT(DFDB_ROSFM, 15, "EmulatedSequentialReadoutModule::clearInfo  Function entered");
00186 
00187 }
00188 
00189 //FOR THE PLUGIN FACTORY
00190 extern "C" 
00191 {
00192   extern ReadoutModule* createEmulatedSequentialReadoutModule();
00193 }
00194 ReadoutModule* createEmulatedSequentialReadoutModule()
00195 {
00196   return (new EmulatedSequentialReadoutModule());
00197 }

Generated on Mon Feb 6 14:01:19 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6