Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

SctApiMulti.cxx

00001 
00008 #include <utility>
00009 
00010 #include "SctApi.h"
00011 #include "SctApiHisto.h"
00012 #include "SctApiRodInfo.h"
00013 #include "SctApiException.h"
00014 
00015 using namespace std;
00016 
00017 namespace SctApi {
00018 
00019 RodScanEx &ScanEx::getOrNewRod(const RodLabel &l, RodScanEx defaultEx) {
00020   RodInfoMap::iterator result = rodInfo.find(l);
00021   if(result == rodInfo.end()) {
00022     rodInfo.insert(std::make_pair(l, defaultEx));
00023     result = rodInfo.find(l);
00024   }
00025   return result->second;
00026 }
00027 
00028 const RodScanEx &ScanEx::getRodScanInfo(const RodLabel &l) const {
00029   RodInfoMap::const_iterator result = rodInfo.find(l);
00030   if(result == rodInfo.end()) {
00031     cerr << " getRodScanInfo const: ROD not found\n";
00032     throw SctApiException("Bad ROD");
00033   }
00034   return result->second;
00035 }
00036 
00037 RodScanEx &ScanEx::getRodScanInfo(const RodLabel &l) {
00038   RodInfoMap::iterator result = rodInfo.find(l);
00039   if(result == rodInfo.end()) {
00040     cerr << " getRodScanInfo: ROD not found\n";
00041     throw SctApiException("Bad ROD");
00042   }
00043   return result->second;
00044 }
00045 
00046 const std::list<RodLabel> SctApi::listRods() const {
00047   return rodList;
00048 }
00049 
00050   /*
00051     const std::list<CrateLabel> SctApi::listCrates() const {
00052     std::list<CrateLabel> crateList;
00053     
00054     crateList.push_back(CrateLabel(prt(), crt()));
00055     
00056     return crateList;
00057     }
00058   */
00059 
00060 void SctApi::addRodToList(RodLabel newRod) {
00061   rodList.push_back(newRod);
00062   RodInfo newInfo;
00063   rodInfoList.insert(make_pair(newRod, newInfo));
00064 }
00065 
00066 RodInfo &SctApi::getRodInfo(const RodLabel &l){
00067   std::map<RodLabel, RodInfo>::iterator result = rodInfoList.find(l);
00068   if(result == rodInfoList.end()) {
00069     cerr << " getRodInfo: ROD not found\n";
00070     throw SctApiException("Bad ROD");
00071   }
00072   return result->second;
00073 }
00074 }

Generated on Fri Sep 16 18:01:58 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5