IDs::generator Class Reference

Streamable identifier for an instance of a generator. More...

#include <IdGenerator.h>

Inheritance diagram for IDs::generator:
TObject

List of all members.

Public Member Functions

 generator (Generator_t g, Config_t c)
 Constructor taking two strings for the Generator type and its configuration.
 generator ()
 Default constructor for a generator ID. Will match true against all generator IDs.
 generator (const std::string &s)
 Construct a source ID from a single string.
virtual ~generator ()
void Reset ()
Generator_t Type () const
 Returns the type of generator that this ID represents.
void Type (const Generator_t &g)
 Set the type of generator that this ID represents.
Config_t Config () const
 Returns the configuration of the generator that this ID represents.
void Config (const Config_t &c)
 Set the configuration of the generator that this ID represents.
bool operator== (const generator &rhs) const
bool matches (const generator &rhs) const
bool operator!= (const generator &rhs) const
bool operator< (const generator &rhs) const
 Not intuitively meaningful but maybe useful for sorting.
bool operator> (const generator &rhs) const
 Not intuitively meaningful but maybe useful for sorting.
std::string str () const
 Get this ID as a string.
IDs::generatoroperator= (const std::string &rhs)
bool isWildCardType () const
 Check if the Generator_t part of the ID is a wildcard.
bool isWildCardConfig () const
 Check if the Config_t part of the ID is a wildcard.
bool isWildCard () const
 Check if any part of the ID is a wildcard.
void Debug () const
 Print the individual components of the ID.

Private Member Functions

 ClassDef (generator, 1)

Private Attributes

Generator_t fType
 Stores the type of this generator.
Config_t fConfig
 Stores the configuration of this generator.

Detailed Description

Streamable identifier for an instance of a generator.

Definition at line 25 of file IdGenerator.h.


Constructor & Destructor Documentation

IDs::generator::generator ( Generator_t  g,
Config_t  c 
) [inline]

Constructor taking two strings for the Generator type and its configuration.

Parameters:
g The type of the generator
c The configuration of the generator

Definition at line 121 of file IdGenerator.h.

References fConfig, and IDs::kAnyConfig.

00121                                                         :
00122         fType(t),fConfig(c){
00123                 if(fConfig=="") fConfig=kAnyConfig;
00124 }

IDs::generator::generator (  )  [inline]

Default constructor for a generator ID. Will match true against all generator IDs.

Definition at line 36 of file IdGenerator.h.

IDs::generator::generator ( const std::string &  s  )  [inline]

Construct a source ID from a single string.

Equivalent to calling the defualt constructor following by operator=(std::string)

Definition at line 41 of file IdGenerator.h.

References operator=().

00042         : fType(kAnyGenerator),fConfig(kAnyConfig) {
00043             operator=(s);
00044         };

virtual IDs::generator::~generator (  )  [inline, virtual]

Definition at line 46 of file IdGenerator.h.

00046 {};


Member Function Documentation

IDs::generator::ClassDef ( generator  ,
 
) [private]
void IDs::generator::Config ( const Config_t c  )  [inline]

Set the configuration of the generator that this ID represents.

Definition at line 61 of file IdGenerator.h.

References fConfig.

00061 {fConfig=c;};

Config_t IDs::generator::Config (  )  const [inline]

Returns the configuration of the generator that this ID represents.

Definition at line 58 of file IdGenerator.h.

References fConfig.

Referenced by Debug(), and operator=().

00058 {return fConfig;};

void IDs::generator::Debug (  )  const

Print the individual components of the ID.

Definition at line 30 of file IdGenerator.cpp.

References Config(), and Type().

Referenced by IDs::source::Debug().

00030                              {
00031     std::cout<<"Generator: "<<Type()<<std::endl;
00032     std::cout<<"Config: "<<Config()<<std::endl;
00033 }

bool IDs::generator::isWildCard (  )  const [inline]

Check if any part of the ID is a wildcard.

Definition at line 89 of file IdGenerator.h.

References isWildCardConfig(), and isWildCardType().

Referenced by IDs::source::isWildCardGenerator().

00089 { return isWildCardConfig() || isWildCardType(); }

bool IDs::generator::isWildCardConfig (  )  const [inline]

Check if the Config_t part of the ID is a wildcard.

Definition at line 86 of file IdGenerator.h.

References fConfig, and IDs::kAnyConfig.

Referenced by isWildCard(), and matches().

00086 { return fConfig == kAnyConfig; }

bool IDs::generator::isWildCardType (  )  const [inline]

Check if the Generator_t part of the ID is a wildcard.

Definition at line 83 of file IdGenerator.h.

References fType, and IDs::kAnyGenerator.

Referenced by isWildCard(), and matches().

00083 { return fType == kAnyGenerator; }

bool IDs::generator::matches ( const generator rhs  )  const [inline]

Definition at line 107 of file IdGenerator.h.

References fConfig, fType, isWildCardConfig(), and isWildCardType().

Referenced by PlotTDPs::BeforeFirstEntry(), and IDs::source::matches().

00107                                                           {
00108         return (isWildCardType() || rhs.isWildCardType() || fType==rhs.fType) 
00109                 && (isWildCardConfig() || rhs.isWildCardConfig() || fConfig==rhs.fConfig) ;
00110 }

bool IDs::generator::operator!= ( const generator rhs  )  const [inline]

Is this generator the different to another, and do both this and the other id have fields not set to kAny

Definition at line 70 of file IdGenerator.h.

References operator==().

00070 {return !(this->operator==(rhs));};

bool IDs::generator::operator< ( const generator rhs  )  const [inline]

Not intuitively meaningful but maybe useful for sorting.

Definition at line 117 of file IdGenerator.h.

References fConfig, and fType.

00117                                                                {
00118         int type_cmp=fType.compare(rhs.fType);
00119         return  type_cmp<0 || (type_cmp==0 && fConfig.compare(rhs.fConfig)<0);
00120 }

IDs::generator & IDs::generator::operator= ( const std::string &  rhs  ) 

Definition at line 17 of file IdGenerator.cpp.

References Config(), IDs::field_separator, and Type().

Referenced by generator().

00017                                                          {
00018     // Find the first delimiter
00019     size_t delim=rhs.find(IDs::field_separator.c_str());
00020     if(delim==std::string::npos){
00021         std::cout<<"Warning: Strange looking string given to IDs::source: "<<rhs<<std::endl;
00022         Type(rhs);
00023     } else{
00024         Type(rhs.substr(0,delim));
00025         Config(rhs.substr(delim+1));
00026     }
00027     return *this;
00028 }

bool IDs::generator::operator== ( const generator rhs  )  const [inline]

Is this generator the same as another, or is this or the other id have fields set to kAny

Definition at line 103 of file IdGenerator.h.

References fConfig, and fType.

Referenced by operator!=().

00103                                                                 {
00104         return (fType==rhs.fType) && (fConfig==rhs.fConfig) ;
00105 }

bool IDs::generator::operator> ( const generator rhs  )  const [inline]

Not intuitively meaningful but maybe useful for sorting.

Definition at line 112 of file IdGenerator.h.

References fConfig, and fType.

00112                                                                {
00113         int type_cmp=fType.compare(rhs.fType);
00114         return  type_cmp>0 || (type_cmp==0 && fConfig.compare(rhs.fConfig)>0);
00115 }

void IDs::generator::Reset (  )  [inline]

Definition at line 48 of file IdGenerator.h.

References fConfig, fType, IDs::kAnyConfig, and IDs::kAnyGenerator.

Referenced by IDs::source::Reset().

std::string IDs::generator::str (  )  const

Get this ID as a string.

Definition at line 8 of file IdGenerator.cpp.

References fConfig, IDs::field_separator, and fType.

Referenced by IDs::source::str().

00008                                 {
00009   return fType+IDs::field_separator+fConfig;
00010 }

void IDs::generator::Type ( const Generator_t g  )  [inline]

Set the type of generator that this ID represents.

Definition at line 55 of file IdGenerator.h.

References fType.

00055 { fType=g;};

Generator_t IDs::generator::Type (  )  const [inline]

Returns the type of generator that this ID represents.

Definition at line 52 of file IdGenerator.h.

References fType.

Referenced by MakeDetectorPulses::BeforeFirstEntry(), Debug(), TAPGeneratorFactory::GetTAPType(), and operator=().

00052 {return fType;};


Member Data Documentation

Stores the configuration of this generator.

Definition at line 98 of file IdGenerator.h.

Referenced by Config(), generator(), isWildCardConfig(), matches(), operator<(), operator==(), operator>(), Reset(), and str().

Stores the type of this generator.

Definition at line 96 of file IdGenerator.h.

Referenced by isWildCardType(), matches(), operator<(), operator==(), operator>(), Reset(), str(), and Type().


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

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1