CMS 3D CMS Logo

CSCDMBTrailer.cc
Go to the documentation of this file.
5 #include <iostream>
6 
7 CSCDMBTrailer::CSCDMBTrailer(uint16_t firmware_version) : theTrailerFormat(), theFirmwareVersion(firmware_version) {
8  if (theFirmwareVersion == 2013) {
9  theTrailerFormat = std::make_shared<CSCDMBTrailer2013>();
10  } else {
11  theTrailerFormat = std::make_shared<CSCDMBTrailer2005>();
12  }
13 }
14 
15 CSCDMBTrailer::CSCDMBTrailer(const uint16_t *buf, uint16_t firmware_version)
16  : theTrailerFormat(), theFirmwareVersion(firmware_version) {
17  if (theFirmwareVersion == 2013) {
18  theTrailerFormat = std::make_shared<CSCDMBTrailer2013>(buf);
19  } else {
20  theTrailerFormat = std::make_shared<CSCDMBTrailer2005>(buf);
21  }
22 }
23 
25  const CSCDMBTrailer2005 *result = dynamic_cast<const CSCDMBTrailer2005 *>(theTrailerFormat.get());
26  if (result == nullptr) {
27  throw cms::Exception("Could not get 2005 DMB trailer format");
28  }
29  return *result;
30 }
31 
33  const CSCDMBTrailer2013 *result = dynamic_cast<const CSCDMBTrailer2013 *>(theTrailerFormat.get());
34  if (result == nullptr) {
35  throw cms::Exception("Could not get 2013 DMB trailer format");
36  }
37  return *result;
38 }
int theFirmwareVersion
Definition: CSCDMBTrailer.h:71
CSCDMBTrailer2005 dmbTrailer2005() const
will throw if the cast fails
CSCDMBTrailer2013 dmbTrailer2013() const
CSCDMBTrailer(uint16_t firmware_version=2005)
Definition: CSCDMBTrailer.cc:7
std::shared_ptr< CSCVDMBTrailerFormat > theTrailerFormat
Definition: CSCDMBTrailer.h:70