00001 #ifndef __CCAENCHAIN_H 00002 #define __CCAENCHAIN_H 00003 00004 /* 00005 This software is Copyright by the Board of Trustees of Michigan 00006 State University (c) Copyright 2005. 00007 00008 You may use this software under the terms of the GNU public license 00009 (GPL). The terms of this license are described at: 00010 00011 http://www.gnu.org/licenses/gpl.txt 00012 00013 Author: 00014 Ron Fox 00015 NSCL 00016 Michigan State University 00017 East Lansing, MI 48824-1321 00018 */ 00019 00020 00021 00022 // Headers required: 00023 00024 #ifndef __STL_VECTOR 00025 #include <vector> 00026 #define __STL_VECTOR 00027 #endif 00028 00029 #ifndef __STL_STRING 00030 #include <string> 00031 #define __STL_STRING 00032 #endif 00033 00034 #ifndef __CRANGEERROR_H 00035 #include <RangeError.h> 00036 #endif 00037 00038 // Forward class definitions: 00039 00040 class CAENcard; 00041 00042 00043 00099 class CCAENChain { 00100 // Private data. 00101 private: 00102 STD(vector)<CAENcard*> m_vCards; 00103 unsigned long m_nCBLTAddress; 00104 int m_nCrate; 00105 void* m_pHandle; 00106 unsigned short m_nMaxBytes; 00107 void* m_pBase; 00108 00109 // Constructors and other canonical operations. 00110 public: 00111 CCAENChain(int nFirstSlot, int nLastSlot, 00112 STD(vector)<unsigned long>& vBases, 00113 int nCrate = 0, bool geo=true) throw (STD(string)); 00114 ~CCAENChain(); 00115 00116 // Canonicals that are not allowed: 00117 private: 00118 CCAENChain(const CCAENChain& rhs); 00119 CCAENChain& operator= (const CCAENChain& rhs); 00120 int operator==(const CCAENChain& rhs); 00121 int operator!=(const CCAENChain& rhs); 00122 public: 00123 00124 00125 // Selectors: 00126 public: 00127 STD(vector)<CAENcard*> getCards() { 00128 return m_vCards; 00129 } 00130 unsigned long getCBLTAddress() const { 00131 return m_nCBLTAddress; 00132 } 00133 int getCrate() const { 00134 return m_nCrate; 00135 } 00136 void* getVmeHandle() { 00137 return m_pHandle; 00138 } 00139 unsigned short getMaxBytes() const { 00140 return m_nMaxBytes; 00141 } 00142 00143 00144 // Mutators: - intended mostly for derived classes that might need to 00145 // set these things during construction. 00146 00147 protected: 00148 void setCards(const STD(vector)<CAENcard*> vCards) { 00149 m_vCards = vCards; 00150 } 00151 void setCBLTAddress(unsigned long nCBLTAddress) { 00152 m_nCBLTAddress = nCBLTAddress; 00153 } 00154 void setCrate(int nCrate) { 00155 m_nCrate = nCrate; 00156 } 00157 void setHandle(void* pHandle) { 00158 m_pHandle = pHandle; 00159 } 00160 void setMaxBytes(unsigned short nBytes) { 00161 m_nMaxBytes = nBytes; 00162 } 00163 00164 // Class Functions: 00165 public: 00166 00167 CAENcard* operator[](int index) throw (CRangeError); 00168 int ReadEvent(void* pBuffer); 00169 void ClearData(); 00170 void lastModuleEmptyEnable(); ; 00171 void lastModuleEmptyDisable(); 00172 00173 // Utilities: 00174 00175 private: 00176 void FreeModules(); 00177 CAENcard* lastCard(); // Return the last card in the chain. 00178 }; 00179 00180 00181 #endif 00182 00183 00184