Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BeamMonSwicRel.cxx

Go to the documentation of this file.
00001 #include "BeamMonSwicRel.h"
00002 
00003 #include <DatabaseInterface/DbiResultSet.h>
00004 #include <DatabaseInterface/DbiOutRowStream.h>
00005 
00006 using namespace std;
00007 
00008 BeamMonSwicRel::BeamMonSwicRel(const char* devicename)
00009     : fDeviceName(devicename), fChannel(96,0)
00010 {
00011 }
00012 
00014 DbiTableRow* BeamMonSwicRel::CreateTableRow() const
00015 {
00016     return new BeamMonSwicRel;
00017 }
00018 
00020 void BeamMonSwicRel::Fill(DbiResultSet& rs, const DbiValidityRec* /*vrec*/)
00021 {
00022     this->ClearData();
00023 
00024     rs >> fDeviceName ;
00025     for (int ind=0; ind<96; ++ind) {
00026         float tmp=0;
00027         rs >> tmp;
00028         fChannel[ind] = tmp;
00029     }
00030 }
00031 
00033 void BeamMonSwicRel::Store(DbiOutRowStream& ors, const DbiValidityRec* /*vrec*/) const
00034 {
00035     ors << fDeviceName;
00036     for (int ind=0; ind<96; ++ind) ors << fChannel[ind];
00037 }
00038 
00039 void BeamMonSwicRel::ClearData()
00040 {
00041     for (int ind=0; ind<96; ++ind) fChannel[ind] = 0.0;
00042 }
00043 
00044 void BeamMonSwicRel::SetChannels(const std::vector<double>& channels)
00045 {
00046     if (channels.size() != 96) return; // shouldn't happen
00047     for (size_t ind=0; ind<96; ++ind) fChannel[ind] = (float)channels[ind];
00048 }
00049 
00050 std::vector<double> BeamMonSwicRel::GetChannelsAsDoubles() const
00051 {
00052     vector<double> ret(96,0);
00053     for (size_t ind=0; ind<96; ++ind) ret[ind] = fChannel[ind];
00054     return ret;
00055 }
00056 
00057 
00058 ClassImp(BeamMonSwicRel)
00059     

Generated on Mon Feb 15 11:06:25 2010 for loon by  doxygen 1.3.9.1