TpcDataTool.h
Go to the documentation of this file.
1 // TpcDataTool.h
2 
3 // David Adams
4 // April 2018
5 //
6 // Interface for tools that view or update TpcData objects.
7 //
8 // It inherits from AdcChannelTool and the default implementation here
9 // calls the ADC channel map methods of that class.
10 
11 #ifndef TpcDataTool_H
12 #define TpcDataTool_H
13 
16 
17 class TpcDataTool : public AdcChannelTool {
18 
19 public:
20 
21  // Modify TpcData.
22  virtual DataMap updateTpcData(TpcData&) const;
23 
24  // View TpcData.
25  virtual DataMap viewTpcData(const TpcData&) const;
26 
27  // Method indicating how unimplemented calls to TpcData should be forwarded.
28  // 0: No forward.
29  // 1: AdcChannelDataMap
30  virtual int forwardTpcData() const { return 1; }
31 
32 };
33 
34 //**********************************************************************
35 // Definitions for the above declarations.
36 //**********************************************************************
37 
38 inline
40  if ( forwardTpcData() == 1 ) {
41  DataMap dm;
42  for ( TpcData::AdcDataPtr padc : tpd.getAdcData() ) {
43  if ( padc ) dm = updateMap(*padc);
44  }
45  return dm;
46  } else if ( updateWithView() ) {
47  return viewTpcData(tpd);
48  }
50 }
51 
52 //**********************************************************************
53 
54 inline
56  if ( forwardTpcData() == 1 ) {
57  DataMap dm;
58  for ( TpcData::AdcDataPtr padc : tpd.getAdcData() ) {
59  if ( padc ) dm = viewMap(*padc);
60  }
61  return dm;
62  }
63  // We do not copy TpcData.
65 }
66 
67 //**********************************************************************
68 
69 #endif
virtual DataMap viewMap(const AdcChannelDataMap &acds) const
static int interfaceNotImplemented()
std::shared_ptr< AdcChannelDataMap > AdcDataPtr
Definition: TpcData.h:35
virtual DataMap viewTpcData(const TpcData &) const
Definition: TpcDataTool.h:55
AdcDataVector & getAdcData()
Definition: TpcData.h:55
virtual DataMap updateTpcData(TpcData &) const
Definition: TpcDataTool.h:39
virtual DataMap updateMap(AdcChannelDataMap &acds) const
virtual bool updateWithView() const
virtual int forwardTpcData() const
Definition: TpcDataTool.h:30