LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
rndm::SeedMasterHelper::EngineId Struct Reference

Identifier for a engine, made of module name and optional instance name. More...

#include "EngineId.h"

Classes

struct  Global_t
 structure to identify a "global" flavour constructor More...
 

Public Member Functions

 EngineId (std::string const &mod, std::string const &inst=std::string())
 Constructor (module name is required) More...
 
 EngineId (std::string const &inst, Global_t)
 Constructor (module name is required) More...
 
bool isGlobal () const
 Returns whether the label is "global" (no module context) More...
 
bool hasInstanceName () const
 Returns whether the instance label is defined. More...
 
void setGlobal (std::string inst)
 Sets this ID to the specified global instance. More...
 
bool operator== (EngineId const &rhs) const
 Returns true if both module and instance names match. More...
 
bool operator< (EngineId const &rhs) const
 Lexicographic sort (module name first, then instance name) More...
 
 operator std::string () const
 Converts the information in a module_name[.instance_name] string. More...
 
std::string artName () const
 Converts the information in a module_name:instance_name string. More...
 

Public Attributes

std::string moduleLabel
 module label More...
 
std::string instanceName
 instance name More...
 

Static Public Attributes

static Global_t global
 A constant to select a "global" flavour constructor. More...
 

Detailed Description

Identifier for a engine, made of module name and optional instance name.

Definition at line 22 of file EngineId.h.

Constructor & Destructor Documentation

rndm::SeedMasterHelper::EngineId::EngineId ( std::string const &  mod,
std::string const &  inst = std::string() 
)
inline

Constructor (module name is required)

Definition at line 31 of file EngineId.h.

31  :
32  moduleLabel(mod),
33  instanceName(inst)
34  {}
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85
rndm::SeedMasterHelper::EngineId::EngineId ( std::string const &  inst,
Global_t   
)
inline

Constructor (module name is required)

Definition at line 37 of file EngineId.h.

37  :
38  moduleLabel(),
39  instanceName(inst)
40  {}
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85

Member Function Documentation

std::string rndm::SeedMasterHelper::EngineId::artName ( ) const
inline

Converts the information in a module_name:instance_name string.

Definition at line 82 of file EngineId.h.

References instanceName, and moduleLabel.

82 { return moduleLabel + ':' + instanceName; }
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85
bool rndm::SeedMasterHelper::EngineId::hasInstanceName ( ) const
inline

Returns whether the instance label is defined.

Definition at line 48 of file EngineId.h.

References instanceName.

Referenced by operator std::string().

48 { return !instanceName.empty(); }
std::string instanceName
instance name
Definition: EngineId.h:85
bool rndm::SeedMasterHelper::EngineId::isGlobal ( ) const
inline

Returns whether the label is "global" (no module context)

Definition at line 45 of file EngineId.h.

References moduleLabel.

Referenced by rndm::SeedMaster< SEED >::print().

45 { return moduleLabel.empty(); }
std::string moduleLabel
module label
Definition: EngineId.h:84
rndm::SeedMasterHelper::EngineId::operator std::string ( ) const
inline

Converts the information in a module_name[.instance_name] string.

Definition at line 74 of file EngineId.h.

References hasInstanceName(), instanceName, and moduleLabel.

75  {
76  std::string id = moduleLabel;
77  if (hasInstanceName()) id.append(1, '.').append(instanceName);
78  return id;
79  } // operator std::string()
bool hasInstanceName() const
Returns whether the instance label is defined.
Definition: EngineId.h:48
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85
bool rndm::SeedMasterHelper::EngineId::operator< ( EngineId const &  rhs) const
inline

Lexicographic sort (module name first, then instance name)

Definition at line 64 of file EngineId.h.

References instanceName, and moduleLabel.

65  {
66  if (moduleLabel < rhs.moduleLabel) return true;
67  if (moduleLabel == rhs.moduleLabel) {
68  if (instanceName < rhs.instanceName) return true;
69  }
70  return false;
71  } // operator< ()
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85
bool rndm::SeedMasterHelper::EngineId::operator== ( EngineId const &  rhs) const
inline

Returns true if both module and instance names match.

Definition at line 56 of file EngineId.h.

References instanceName, and moduleLabel.

57  {
58  if ( moduleLabel != rhs.moduleLabel ) return false;
59  if ( instanceName != rhs.instanceName ) return false;
60  return true;
61  } // operator== ()
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85
void rndm::SeedMasterHelper::EngineId::setGlobal ( std::string  inst)
inline

Sets this ID to the specified global instance.

Definition at line 51 of file EngineId.h.

References instanceName, and moduleLabel.

52  { moduleLabel.clear(); instanceName = inst; }
std::string moduleLabel
module label
Definition: EngineId.h:84
std::string instanceName
instance name
Definition: EngineId.h:85

Member Data Documentation

Global_t rndm::SeedMasterHelper::EngineId::global
static

A constant to select a "global" flavour constructor.

Definition at line 28 of file EngineId.h.

Referenced by rndm::NuRandomService::getGlobalSeed().

std::string rndm::SeedMasterHelper::EngineId::instanceName

instance name

Definition at line 85 of file EngineId.h.

Referenced by artName(), hasInstanceName(), operator std::string(), operator<(), operator==(), and setGlobal().

std::string rndm::SeedMasterHelper::EngineId::moduleLabel

module label

Definition at line 84 of file EngineId.h.

Referenced by artName(), isGlobal(), operator std::string(), operator<(), operator==(), and setGlobal().


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