00001 /************************************************************************************************/ 00002 /*! \file DAQCard.cpp 00003 * \brief C++ encapsulation of the c-level DAQ card code 00004 * \author $Author: shoemaker $ 00005 * \version $Revision: 1.3 $ 00006 * \date $Date: 2004/05/27 19:08:26 $ 00007 ************************************************************************************************/ 00008 /*! 00009 * 00010 ************************************************************************************************/ 00011 00012 #include <iostream> 00013 #include "DAQCard.h" 00014 00015 using namespace std; 00016 00017 DAQCard* DAQCard::s_instance = NULL; 00018 00019 DAQCard::DAQCard() 00020 { 00021 m_cardData = new card_t; 00022 Initialize(); 00023 } 00024 00025 DAQCard* DAQCard::Instance() 00026 { 00027 /* If first time being called, return a pointer 00028 to an instance of a new DAQCard. Otherwise return 00029 a pointer to an instance of a DAQCard which was made 00030 earlier. Essentially, there can be only one DAQCard. */ 00031 if (s_instance==NULL) 00032 { 00033 //cout << " you have an instance of a new DAQ card " << endl; 00034 s_instance = new DAQCard(); 00035 } 00036 return s_instance; 00037 } 00038 00039 int DAQCard::Initialize() 00040 { 00041 // assume this stuff (or the stuff in "daqcard.h") will alwyas be hardcoded? 00042 // seems like very low-level stuff have to include in config file 00043 00044 // if we feel we need to have these settings easily changeable, we can rewrite to pass additional 00045 // arguments into "InitDAQCard" 00046 00047 if (InitDAQCard(m_cardData) != 0) 00048 { 00049 cout << " oops, 'InitDAQCard()' failed " << endl; 00050 return 1; 00051 } 00052 return 0; 00053 } 00054 00055 DAQCard::~DAQCard() 00056 { 00057 // Deconstructor 00058 // free the memory used by DAQ card 00059 ShutDownDAQCard(m_cardData); 00060 } 00061 00062 // Do not change the comments below - they will be added automatically by CVS 00063 /***************************************************************************** 00064 * $Log: DAQCard.cpp,v $ 00065 * Revision 1.3 2004/05/27 19:08:26 shoemaker 00066 * Made changes corresponding to new daq card settings and calibration methods 00067 * 00068 * Revision 1.2 2004/04/11 19:35:50 shoemaker 00069 * Fixed bugs in analog code and cleaned up random messages 00070 * 00071 * Revision 1.1 2004/04/02 19:59:49 shoemaker 00072 * Initial submission 00073 * 00074 * 00075 ******************************************************************************/ 00076