00001 00002 #include "CCAENV830Creator.h" 00003 #include "CCAENV830Module.h" 00004 #include "CReadableObject.h" 00005 #include <TCLInterpreter.h> 00006 #include <TCLResult.h> 00007 00008 #include <assert.h> 00014 CCAENV830Creator::CCAENV830Creator () 00015 : CModuleCreator(string("caenv830")) 00016 { 00017 } 00021 CCAENV830Creator::~CCAENV830Creator ( ) 00022 { 00023 } 00029 CCAENV830Creator::CCAENV830Creator (const CCAENV830Creator& rhs ) 00030 : CModuleCreator (rhs) 00031 { 00032 } 00033 00042 CCAENV830Creator& 00043 CCAENV830Creator::operator= (const CCAENV830Creator& rhs) 00044 { 00045 if(this != &rhs) { 00046 CModuleCreator::operator=(rhs); 00047 } 00048 return *this; 00049 } 00058 int 00059 CCAENV830Creator::operator== (const CCAENV830Creator& rhs) const 00060 { 00061 return (CModuleCreator::operator==(rhs)); 00062 } 00063 00064 // Functions for class CCAENV830Creator 00065 00110 CReadableObject* 00111 CCAENV830Creator::Create(CTCLInterpreter& rInterp, CTCLResult& rResult, 00112 int nArgs, char** pArgs) 00113 { 00114 assert(nArgs >= 2); // Need to have enough parameters. 00115 string sName(*pArgs); 00116 nArgs--; pArgs++; 00117 00118 assert(*pArgs == getModuleType()); 00119 nArgs--; 00120 pArgs++; 00121 00122 CReadableObject* pModule = new CCAENV830Module(sName, rInterp); 00123 if(nArgs) { 00124 int status = pModule->Configure(rInterp, rResult, nArgs, pArgs); 00125 if(status != TCL_OK) { // If configure fails, it will fill in 00126 delete pModule; // rResult, but we must delete and return null. 00127 pModule = (CReadableObject*)NULL; 00128 } 00129 } 00130 return pModule; 00131 00132 } 00133 00141 string 00142 CCAENV830Creator::Help() 00143 { 00144 return string("Creates a CAEN 830 32 channel scaler."); 00145 }