/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

CbltTraits.cc
Go to the documentation of this file.
00001 /*
00002  *  CbltTraits.cc
00003  *  CbltReadoutFormat
00004  *
00005  *  Created by Simon Patton on 7/21/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 #include "CbltReadoutFormat/CbltTraits.h"
00010 
00011 #include <map>
00012 
00013 #include "CbltReadoutFormat/CbltTraits_v0_0.h"
00014 #include "CbltReadoutFormat/CbltTraits_v1_3.h"
00015 
00016 using DybDaq::CbltTraits;
00017 using DybDaq::CbltTraits_v0_0;
00018 using DybDaq::CbltTraits_v1_3;
00019 
00020 // Components in this format
00021 const unsigned int CbltTraits::kHead = 0;
00022 const unsigned int CbltTraits::kBody = CbltTraits::kHead + 1;
00023 const unsigned int CbltTraits::kFoot = CbltTraits::kBody + 1;
00024 
00025 // Fields
00026 
00027 const unsigned int CbltTraits::kHeadModuleAddress = 0;
00028 const unsigned int CbltTraits::kHeadModuleType = CbltTraits::kHeadModuleAddress + 1;
00029 const unsigned int CbltTraits::kFootModuleAddress = CbltTraits::kHeadModuleType + 1;
00030 const unsigned int CbltTraits::kFootDataLength = CbltTraits::kFootModuleAddress + 1;
00031 const unsigned int CbltTraits::kMajorVersion = CbltTraits::kFootDataLength + 1;
00032 const unsigned int CbltTraits::kMinorVersion = CbltTraits::kMajorVersion + 1;
00033 
00034 // Module enumeration
00035 
00036 const unsigned int CbltTraits::kFeeModule = 0;
00037 const unsigned int CbltTraits::kFadcModule = CbltTraits::kFeeModule + 1;
00038 const unsigned int CbltTraits::kLtbModule = CbltTraits::kFadcModule + 1;
00039 const unsigned int CbltTraits::kRpcRomModule = CbltTraits::kLtbModule + 1;
00040 const unsigned int CbltTraits::kRpcRtmModule = CbltTraits::kRpcRomModule + 1;
00041 const unsigned int CbltTraits::kMtbModule = CbltTraits::kRpcRtmModule + 1;
00042 
00043 static std::map<const char*, CbltTraits*> m_allTraits;
00044 
00045 CbltTraits::CbltTraits() {
00046 }
00047 
00048 CbltTraits::~CbltTraits() {
00049 }
00050 
00051 const CbltTraits& CbltTraits::defaultTraits() {
00052     if (0 == m_allTraits.size()) {
00053         m_allTraits.insert(std::pair<const char*, CbltTraits*>(CbltTraits_v0_0::key(),new CbltTraits_v0_0()));
00054     }
00055     return *m_allTraits[CbltTraits_v0_0::key()];
00056 }
00057 
00058 const CbltTraits* CbltTraits::readTraits(const char*& /* buffer */) {
00059     defaultTraits(); // Initializes traits' map
00060     return m_allTraits[CbltTraits_v0_0::key()];
00061     /*
00062     const unsigned int major = readUnsignedInt(buffer,
00063                                                defaultTraits(),
00064                                                CbltTraits::kMajorVersion);
00065     const unsigned int minor = readUnsignedInt(buffer,
00066                                                defaultTraits(),
00067                                                CbltTraits::kMinorVersion);
00068     const CbltTraits* result = 0;
00069     if (0U == major && 0U == minor) {
00070         result = m_allTraits[CbltTraits_v0_0::key()];
00071     } else if (1U == major && 3U == minor) {
00072         result = m_allTraits[CbltTraits_v1_3::key()];
00073     }
00074     return result;
00075     */
00076 }
00077 
00078 unsigned int CbltTraits::illegalMarker() const {
00079     return 0xffffffffU;
00080 }
00081 
00082 unsigned int CbltTraits::illegalField() const {
00083     return 0xffffffffU;
00084 }
00085 
00086 unsigned int CbltTraits::moduleType(unsigned int module) const {
00087         if (module > maxModuleType()) {
00088                 return 0xffffffffU;
00089         }
00090         return moduleTypes()[module];
00091 }
00092 
00093 const char* CbltTraits::moduleTypeAsString(unsigned int moduleType) const {
00094     return moduleTypeStrings()[moduleType];
00095 }
00096 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:53:11 for CbltReadoutFormat by doxygen 1.7.4