Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ModelColourMap< T > Class Template Reference

#include <G4ModelColourMap.hh>

Public Member Functions

 G4ModelColourMap ()
 
virtual ~G4ModelColourMap ()
 
void Set (const T &, const G4Colour &)
 
void Set (const T &, const G4String &)
 
G4Colouroperator[] (const T &quantity)
 
bool GetColour (const T &, G4Colour &) const
 
void Print (std::ostream &ostr) const
 

Detailed Description

template<typename T>
class G4ModelColourMap< T >

Definition at line 41 of file G4ModelColourMap.hh.

Constructor & Destructor Documentation

◆ G4ModelColourMap()

template<typename T >
G4ModelColourMap< T >::G4ModelColourMap

Definition at line 70 of file G4ModelColourMap.hh.

70{}

◆ ~G4ModelColourMap()

template<typename T >
G4ModelColourMap< T >::~G4ModelColourMap
virtual

Definition at line 73 of file G4ModelColourMap.hh.

73{}

Member Function Documentation

◆ GetColour()

template<typename T >
bool G4ModelColourMap< T >::GetColour ( const T &  quantity,
G4Colour colour 
) const

Definition at line 105 of file G4ModelColourMap.hh.

106{
107 typename std::map<T, G4Colour>::const_iterator iter = fMap.find(quantity);
108
109 if (iter != fMap.end()) {
110 colour = iter->second;
111 return true;
112 }
113
114 return false;
115}

Referenced by G4TrajectoryDrawByCharge::Draw(), G4TrajectoryDrawByOriginVolume::Draw(), and G4TrajectoryDrawByParticleID::Draw().

◆ operator[]()

template<typename T >
G4Colour & G4ModelColourMap< T >::operator[] ( const T &  quantity)

Definition at line 67 of file G4ModelColourMap.hh.

67{return fMap[quantity];}

◆ Print()

template<typename T >
void G4ModelColourMap< T >::Print ( std::ostream &  ostr) const

Definition at line 119 of file G4ModelColourMap.hh.

120{
121 typename std::map<T, G4Colour>::const_iterator iter = fMap.begin();
122
123 while (iter != fMap.end()) {
124 ostr<< iter->first <<" : "<< iter->second <<G4endl;
125 iter++;
126 }
127}
#define G4endl
Definition: G4ios.hh:52

Referenced by G4TrajectoryDrawByCharge::Print(), G4TrajectoryDrawByOriginVolume::Print(), and G4TrajectoryDrawByParticleID::Print().

◆ Set() [1/2]

template<typename T >
void G4ModelColourMap< T >::Set ( const T &  quantity,
const G4Colour colour 
)

Definition at line 98 of file G4ModelColourMap.hh.

99{
100 fMap[quantity] = colour;
101}

Referenced by G4TrajectoryDrawByCharge::Set(), G4TrajectoryDrawByOriginVolume::Set(), and G4TrajectoryDrawByParticleID::Set().

◆ Set() [2/2]

template<typename T >
void G4ModelColourMap< T >::Set ( const T &  quantity,
const G4String colour 
)

Definition at line 77 of file G4ModelColourMap.hh.

78{
79 G4Colour myColour;
80
81 // Will not setup the map if colour key does not exist
82 if (!G4Colour::GetColour(colour, myColour)) {
84 ed << "G4Colour with key "<<colour<<" does not exist ";
86 ("G4ColourMap::Set(Charge charge, const G4String& colour)",
87 "modeling0108", JustWarning, ed);
88 return;
89 }
90
91
92 // Will not modify myColour if colour key does not exist
93 Set(quantity, myColour);
94}
@ JustWarning
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:123
void Set(const T &, const G4Colour &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

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