]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updated class description: added class name title, author
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Aug 2001 19:36:47 +0000 (19:36 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 21 Aug 2001 19:36:47 +0000 (19:36 +0000)
explicit map declaration replaced with typedef,
added constness (using const iterator)

TGeant4/TG4IntMap.cxx
TGeant4/TG4IntMap.h
TGeant4/TG4NameMap.cxx
TGeant4/TG4NameMap.h

index 85b18ab671231e0db94bcb4314927d4fcf1b58c3..f078c29cd5d1d90b26416e292a28aaf7c8583b0e 100644 (file)
@@ -1,6 +1,10 @@
 // $Id$
 // Category: global
 //
+// Author: I. Hrivnacova
+//
+// Class TG4IntMap
+// ---------------
 // See the class description in the header file.
 
 #include "TG4IntMap.h"
@@ -9,9 +13,6 @@
 #include "g4std/iomanip"
 #include "globals.hh"
 
-typedef G4std::map<G4String, G4int, G4std::less<G4String> >
-  :: iterator IntMapIterator;
-
 //_____________________________________________________________________________
 TG4IntMap::TG4IntMap(){
 //
@@ -49,7 +50,7 @@ G4bool TG4IntMap::IsDefined(const G4String& first)
 // 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                 
@@ -79,7 +80,7 @@ G4int TG4IntMap::GetSecond(const G4String& name)
 // 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.";
@@ -92,7 +93,7 @@ G4int TG4IntMap::GetSecond(const G4String& name)
 }
 
 //_____________________________________________________________________________
-void TG4IntMap::PrintAll()
+void TG4IntMap::PrintAll() const
 {
 // Dumps all map.
 // ---
@@ -100,7 +101,7 @@ void TG4IntMap::PrintAll()
   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++ << "   " 
index 6c72f91eae676a698ba041107e7c10c27399a1c3..df2a340c7ff1b46923bd832f6f683e2fa3dd72a6 100644 (file)
@@ -1,6 +1,10 @@
 // $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
@@ -20,7 +28,7 @@ class TG4IntMap
     // methods
     G4bool Add(const G4String& first, G4int second);  
     G4int GetSecond(const G4String& name);
-    void PrintAll();
+    void PrintAll() const;
     void Clear();
 
   protected:
@@ -33,7 +41,7 @@ class TG4IntMap
     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
index 5877eb41eb2ba9d58faad484b1d871a228d5fbef..9d7e313931eac568550b88f169e823eff5629b69 100644 (file)
@@ -1,6 +1,10 @@
 // $Id$
 // Category: global
 //
+// Author: I. Hrivnacova
+//
+// Class TG4NameMap
+// ----------------
 // See the class description in the header file.
 
 #include "TG4NameMap.h"
@@ -11,9 +15,6 @@
 
 G4String TG4NameMap::fgUndefined = "Undefined";
 
-typedef G4std::map<G4String, G4String, G4std::less<G4String> >
-  :: iterator MapIterator;
-
 //_____________________________________________________________________________
 TG4NameMap::TG4NameMap() 
   : fSecond(fgUndefined) {
@@ -91,7 +92,7 @@ const G4String& TG4NameMap::GetSecond(const G4String& name)
 }
 
 //_____________________________________________________________________________
-void TG4NameMap::PrintAll()
+void TG4NameMap::PrintAll() const
 {
 // Dumps all map.
 // ---
@@ -99,7 +100,7 @@ void TG4NameMap::PrintAll()
   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++ << "   " 
index ee69f439d59915eff8f09f787164faedfeec2cea..73698c7df56395e0b4f9e483e74fa9964640f84d 100644 (file)
@@ -1,6 +1,10 @@
 // $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
@@ -24,7 +32,7 @@ class TG4NameMap
     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
@@ -41,8 +49,8 @@ class TG4NameMap
     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