Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Hardware::Element Class Reference

#include <HardwareElements.h>

Inheritance diagram for Hardware::Element:
Hardware::HardwareID Hardware::APA Hardware::APAGroup Hardware::ASIC Hardware::Board Hardware::Cryostat Hardware::TPC

Public Member Functions

 Element (ID id, std::string this_type)
 
std::vector< raw::ChannelID_t > const & getChannels () const
 
std::set< raw::ChannelID_t > const & getChannelsSet () const
 
size_t getNChannels () const
 
size_t getNChannelsSet () const
 
std::vector< HardwareID > const & getHardwareIDs () const
 
std::set< HardwareID > const & getHardwareIDsSet () const
 
size_t getNHardwareIDs () const
 
size_t getNHardwareIDsSet () const
 
void addChannel (raw::ChannelID_t channel)
 
void addHardwareID (HardwareID id)
 
- Public Member Functions inherited from Hardware::HardwareID
 HardwareID ()
 
 HardwareID (ID id, std::string this_type)
 
ID const & getID () const
 
std::string const & getType () const
 

Private Member Functions

bool addChannelToSet (raw::ChannelID_t this_channel)
 
bool addHardwareIDToSet (HardwareID this_hardwareid)
 

Private Attributes

std::vector< raw::ChannelID_tfChannelIDs
 
std::set< raw::ChannelID_tfChannelIDsSet
 
std::set< HardwareIDfHardwareIDsSet
 
std::vector< HardwareIDfHardwareIDs
 

Friends

std::ostream & operator<< (std::ostream &os, Element const &rhs)
 

Additional Inherited Members

- Protected Member Functions inherited from Hardware::HardwareID
int getTypeOrder () const
 

Detailed Description

Definition at line 71 of file HardwareElements.h.

Constructor & Destructor Documentation

Hardware::Element::Element ( ID  id,
std::string  this_type 
)
inline

Definition at line 74 of file HardwareElements.h.

74 : HardwareID(id, this_type) {}

Member Function Documentation

void Hardware::Element::addChannel ( raw::ChannelID_t  channel)
inline

Definition at line 85 of file HardwareElements.h.

85  {
86  //jpd -- Only add channel to the vector if it is not already in the set
87  //addChannelToSet returns true if channel was no already in the set and false otherwise
89  }
std::vector< raw::ChannelID_t > fChannelIDs
uint8_t channel
Definition: CRTFragment.hh:201
bool addChannelToSet(raw::ChannelID_t this_channel)
bool Hardware::Element::addChannelToSet ( raw::ChannelID_t  this_channel)
inlineprivate

Definition at line 131 of file HardwareElements.h.

131  {
132  auto result = fChannelIDsSet.insert(this_channel);
133  if(result.first != fChannelIDsSet.end()) return result.second;
134  else return false;
135  }
static QCString result
std::set< raw::ChannelID_t > fChannelIDsSet
void Hardware::Element::addHardwareID ( HardwareID  id)
inline

Definition at line 91 of file HardwareElements.h.

91  {
92  //jpd -- Only add hardwareID to the vector if it is not already in the set
93  //addHardwareIDToSet returns true if hardwareID was no already in the set and false otherwise
94  if(addHardwareIDToSet(id)) fHardwareIDs.push_back(id);
95  }
bool addHardwareIDToSet(HardwareID this_hardwareid)
std::vector< HardwareID > fHardwareIDs
bool Hardware::Element::addHardwareIDToSet ( HardwareID  this_hardwareid)
inlineprivate

Definition at line 139 of file HardwareElements.h.

139  {
140  auto result = fHardwareIDsSet.insert(this_hardwareid);
141  if(result.first != fHardwareIDsSet.end()) return result.second;
142  else return false;
143  }
static QCString result
std::set< HardwareID > fHardwareIDsSet
std::vector<raw::ChannelID_t> const& Hardware::Element::getChannels ( ) const
inline

Definition at line 75 of file HardwareElements.h.

75 { return fChannelIDs;}
std::vector< raw::ChannelID_t > fChannelIDs
std::set<raw::ChannelID_t> const& Hardware::Element::getChannelsSet ( ) const
inline

Definition at line 76 of file HardwareElements.h.

76 { return fChannelIDsSet;}
std::set< raw::ChannelID_t > fChannelIDsSet
std::vector<HardwareID> const& Hardware::Element::getHardwareIDs ( ) const
inline

Definition at line 80 of file HardwareElements.h.

80 { return fHardwareIDs;}
std::vector< HardwareID > fHardwareIDs
std::set<HardwareID> const& Hardware::Element::getHardwareIDsSet ( ) const
inline

Definition at line 81 of file HardwareElements.h.

81 { return fHardwareIDsSet;}
std::set< HardwareID > fHardwareIDsSet
size_t Hardware::Element::getNChannels ( ) const
inline

Definition at line 77 of file HardwareElements.h.

77 { return fChannelIDs.size();}
std::vector< raw::ChannelID_t > fChannelIDs
size_t Hardware::Element::getNChannelsSet ( ) const
inline

Definition at line 78 of file HardwareElements.h.

78 { return fChannelIDsSet.size();}
std::set< raw::ChannelID_t > fChannelIDsSet
size_t Hardware::Element::getNHardwareIDs ( ) const
inline

Definition at line 82 of file HardwareElements.h.

82 { return fHardwareIDs.size();}
std::vector< HardwareID > fHardwareIDs
size_t Hardware::Element::getNHardwareIDsSet ( ) const
inline

Definition at line 83 of file HardwareElements.h.

83 { return fHardwareIDsSet.size();}
std::set< HardwareID > fHardwareIDsSet

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
Element const &  rhs 
)
friend

Definition at line 97 of file HardwareElements.h.

97  {
98  HardwareID const& base = rhs;
99  os << base << " has "<< rhs.getNChannels() << " channels";
100 
101  std::set<raw::ChannelID_t> channels = rhs.getChannelsSet();
102  unsigned int max_num_channels = 16;
103  unsigned int this_channel_num = 0;
104  for(auto channel : channels){
105  if(this_channel_num==0) os << ":";
106  if(this_channel_num++ >= max_num_channels) {
107  os << " ...";
108  break;
109  }
110  os << " " << channel;
111  }
112 
113  os << "\n";
114  os << "Contains: " << rhs.getNHardwareIDs() << " pieces of hardware\n";
115  for(auto hardwareid : rhs.getHardwareIDsSet()){
116  os << hardwareid << "\n";
117  }
118 
119  return os;
120  }
uint8_t channel
Definition: CRTFragment.hh:201

Member Data Documentation

std::vector<raw::ChannelID_t> Hardware::Element::fChannelIDs
private

Definition at line 123 of file HardwareElements.h.

std::set<raw::ChannelID_t> Hardware::Element::fChannelIDsSet
private

Definition at line 124 of file HardwareElements.h.

std::vector<HardwareID> Hardware::Element::fHardwareIDs
private

Definition at line 126 of file HardwareElements.h.

std::set<HardwareID> Hardware::Element::fHardwareIDsSet
private

Definition at line 125 of file HardwareElements.h.


The documentation for this class was generated from the following file: