// $Id$
// Category: global
//
+// Author: I. Hrivnacova
+//
+// Class TG4IntMap
+// ---------------
// See the class description in the header file.
#include "TG4IntMap.h"
#include "g4std/iomanip"
#include "globals.hh"
-typedef G4std::map<G4String, G4int, G4std::less<G4String> >
- :: iterator IntMapIterator;
-
//_____________________________________________________________________________
TG4IntMap::TG4IntMap(){
//
// Returns true if the first is already in the map.
// ---
- IntMapIterator i = fMap.find(first);
+ MapIterator i = fMap.find(first);
if (i == fMap.end())
return false;
else
// Gets second name associated with given name.
// ---
- IntMapIterator i = fMap.find(name);
+ MapIterator i = fMap.find(name);
if (i == fMap.end()) {
G4String text = " TG4IntMap::GetSecond: ";
text = text + name + " is not defined.";
}
//_____________________________________________________________________________
-void TG4IntMap::PrintAll()
+void TG4IntMap::PrintAll() const
{
// Dumps all map.
// ---
if (fMap.size()) {
G4cout << "Dump of TG4IntMap - " << fMap.size() << " entries:" << G4endl;
G4int counter = 0;
- for (IntMapIterator i=fMap.begin(); i != fMap.end(); i++) {
+ for (MapConstIterator i=fMap.begin(); i != fMap.end(); i++) {
const G4String& first = (*i).first;
G4int second = (*i).second;
G4cout << "Map element " << G4std::setw(3) << counter++ << " "
// $Id$
// Category: global
//
+// Author: I. Hrivnacova
+//
+// Class TG4IntMap
+// ---------------
// The map container for integer numbers associated with names.
#ifndef TG4_INT_MAP_H
class TG4IntMap
{
+ typedef G4std::map<G4String, G4int, G4std::less<G4String> > Map;
+ typedef Map:: iterator MapIterator;
+ typedef Map:: const_iterator MapConstIterator;
+
public:
TG4IntMap();
// --> protected
// methods
G4bool Add(const G4String& first, G4int second);
G4int GetSecond(const G4String& name);
- void PrintAll();
+ void PrintAll() const;
void Clear();
protected:
G4bool IsDefined(const G4String& first);
// data members
- G4std::map<G4String, G4int, G4std::less<G4String> > fMap; //map container
+ Map fMap; //map container
};
#endif //TG4_NAME_MAP_H
// $Id$
// Category: global
//
+// Author: I. Hrivnacova
+//
+// Class TG4NameMap
+// ----------------
// See the class description in the header file.
#include "TG4NameMap.h"
G4String TG4NameMap::fgUndefined = "Undefined";
-typedef G4std::map<G4String, G4String, G4std::less<G4String> >
- :: iterator MapIterator;
-
//_____________________________________________________________________________
TG4NameMap::TG4NameMap()
: fSecond(fgUndefined) {
}
//_____________________________________________________________________________
-void TG4NameMap::PrintAll()
+void TG4NameMap::PrintAll() const
{
// Dumps all map.
// ---
if (fMap.size()) {
G4cout << "Dump of TG4NameMap - " << fMap.size() << " entries:" << G4endl;
G4int counter = 0;
- for (MapIterator i=fMap.begin(); i != fMap.end(); i++) {
+ for (MapConstIterator i=fMap.begin(); i != fMap.end(); i++) {
const G4String& first = (*i).first;
const G4String& second = (*i).second;
G4cout << "Map element " << G4std::setw(3) << counter++ << " "
// $Id$
// Category: global
//
+// Author: I. Hrivnacova
+//
+// Class TG4NameMap
+// ----------------
// The map container for associated names.
// The names can be added into map either in pairs (Add() method)
// or standalone - then they are paired with the fSecond data member
class TG4NameMap
{
+ typedef G4std::map<G4String, G4String, G4std::less<G4String> > Map;
+ typedef Map::iterator MapIterator;
+ typedef Map::const_iterator MapConstIterator;
+
public:
TG4NameMap();
// --> protected
G4bool Add(const G4String& first, const G4String& second);
G4bool AddName(const G4String& name);
const G4String& GetSecond(const G4String& name);
- void PrintAll();
+ void PrintAll() const;
void Clear();
// set methods
static G4String fgUndefined; //the value of undefined second
// data members
- G4std::map<G4String, G4String, G4std::less<G4String> > fMap; //map container
- G4String fSecond; //the current second
+ Map fMap; //map container
+ G4String fSecond; //the current second
};
// inline methods