LDMX Software
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
simcore::VisAttributesStore Class Reference

Global store of G4VisAttributes created from GDML data. More...

#include <VisAttributesStore.h>

Public Types

typedef std::map< std::string, G4VisAttributes * > VisAttributesMap
 Map of name to vis attributes.
 

Public Member Functions

 ~VisAttributesStore ()
 Destructor.
 
G4VisAttributes * getVisAttributes (const std::string &name)
 Get vis attributes by name.
 
void addVisAttributes (const std::string &name, G4VisAttributes *visAttributes)
 Register a vis attributes by name.
 

Static Public Member Functions

static VisAttributesStoregetInstance ()
 Get the global instance of the store.
 

Private Attributes

VisAttributesMap visAttributesMap_
 The map of names to vis attributes.
 

Detailed Description

Global store of G4VisAttributes created from GDML data.

Definition at line 19 of file VisAttributesStore.h.

Member Typedef Documentation

◆ VisAttributesMap

typedef std::map<std::string, G4VisAttributes*> simcore::VisAttributesStore::VisAttributesMap

Map of name to vis attributes.

Definition at line 24 of file VisAttributesStore.h.

Constructor & Destructor Documentation

◆ ~VisAttributesStore()

simcore::VisAttributesStore::~VisAttributesStore ( )
inline

Destructor.

Cleans up G4VisAttributes

Definition at line 40 of file VisAttributesStore.h.

40 {
41 for (auto& nameAtt : visAttributesMap_) {
42 delete nameAtt.second;
43 }
44 visAttributesMap_.clear();
45 }
VisAttributesMap visAttributesMap_
The map of names to vis attributes.

References visAttributesMap_.

Member Function Documentation

◆ addVisAttributes()

void simcore::VisAttributesStore::addVisAttributes ( const std::string &  name,
G4VisAttributes *  visAttributes 
)
inline

Register a vis attributes by name.

Parameters
nameThe name of the vis attributes.
visAttributesThe vis attributes to register.

Definition at line 67 of file VisAttributesStore.h.

68 {
69 visAttributesMap_[name] = visAttributes;
70 }

References visAttributesMap_.

Referenced by simcore::geo::AuxInfoReader::createVisAttributes().

◆ getInstance()

static VisAttributesStore * simcore::VisAttributesStore::getInstance ( )
inlinestatic

Get the global instance of the store.

Returns
The vis attributes store.

Definition at line 30 of file VisAttributesStore.h.

30 {
31 static VisAttributesStore INSTANCE;
32 return &INSTANCE;
33 }

Referenced by simcore::geo::AuxInfoReader::assignAuxInfoToVolumes(), and simcore::geo::AuxInfoReader::createVisAttributes().

◆ getVisAttributes()

G4VisAttributes * simcore::VisAttributesStore::getVisAttributes ( const std::string &  name)
inline

Get vis attributes by name.

Parameters
nameThe name of the vis attributes.
Returns
The vis attributes or nullptr if does not exist.

Definition at line 52 of file VisAttributesStore.h.

52 {
53 try {
54 return visAttributesMap_.at(name);
55 } catch (const std::out_of_range& oor) {
56 G4cout << "[ WARN ] : VisAttribute '" << name
57 << "' not recognized. Ignoring." << G4endl;
58 return nullptr;
59 }
60 }

References visAttributesMap_.

Referenced by simcore::geo::AuxInfoReader::assignAuxInfoToVolumes().

Member Data Documentation

◆ visAttributesMap_

VisAttributesMap simcore::VisAttributesStore::visAttributesMap_
private

The map of names to vis attributes.

Definition at line 76 of file VisAttributesStore.h.

Referenced by addVisAttributes(), getVisAttributes(), and ~VisAttributesStore().


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