Commit in slic on MAIN
include/G4CmdQueue.hh+2-11.12 -> 1.13
src/G4CmdQueue.cc+21-211.13 -> 1.14
+23-22
2 modified files


slic/include
G4CmdQueue.hh 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- G4CmdQueue.hh	17 May 2006 23:14:56 -0000	1.12
+++ G4CmdQueue.hh	17 May 2006 23:58:11 -0000	1.13
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/include/G4CmdQueue.hh,v 1.12 2006/05/17 23:14:56 jeremy Exp $
+// $Header: /cvs/lcd/slic/include/G4CmdQueue.hh,v 1.13 2006/05/17 23:58:11 jeremy Exp $
 
 #ifndef slic_G4CmdQueue_hh
 #define slic_G4CmdQueue_hh
@@ -76,6 +76,7 @@
     void reorderBeamOn();
     void reorderLimits();
     void reorder_dumpGDML();
+    CmdVecType::const_iterator find_init();
 
   private:
 

slic/src
G4CmdQueue.cc 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- G4CmdQueue.cc	17 May 2006 23:14:56 -0000	1.13
+++ G4CmdQueue.cc	17 May 2006 23:58:11 -0000	1.14
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/slic/src/G4CmdQueue.cc,v 1.13 2006/05/17 23:14:56 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/G4CmdQueue.cc,v 1.14 2006/05/17 23:58:11 jeremy Exp $
 #include "G4CmdQueue.hh"
 
 #include "G4UImanager.hh"
@@ -74,14 +74,13 @@
   {
     bool gotdump = false;
     std::string dumpstr = std::string("/lcdd/dumpGDML");
-
-    CmdVecType::iterator iter = m_commands.begin();
+    std::string cmd;
+    CmdVecType::const_iterator iter = m_commands.begin();
     for ( ;
 	  iter != m_commands.end();
 	  iter++ ) {
-      std::string cmd = *iter;
-
-      if ( cmd.find(dumpstr) != std::string::npos ) {
+      if ( (*iter).find(dumpstr) != std::string::npos ) {
+	cmd = (*iter);
 	gotdump = true;
 	break;
       }
@@ -94,21 +93,9 @@
       return;
     }
 
-    bool gotInit = false;
-    iter = m_commands.begin();
-    for ( ;
-	  iter != m_commands.end();
-	  iter++ ) {
-      std::string cmd = *iter;
-
-      if ( cmd.find("/run/initialize") != std::string::npos ) {
-	gotInit = true;
-	break;
-      }
-    }
-
-    if ( gotInit ) {
-      m_commands.insert(iter + 1, dumpstr);
+    iter = find_init();
+    if (iter != m_commands.end()) {
+      m_commands.insert(iter + 1, cmd);
     }
   }
 
@@ -194,4 +181,17 @@
       m_commands.insert(lastCmd, std::string("/run/initialize") );
     }
   }
+
+  G4CmdQueue::CmdVecType::const_iterator G4CmdQueue::find_init()
+  {
+    CmdVecType::const_iterator iter = m_commands.begin();
+    for ( ;
+	  iter != m_commands.end();
+	  iter++ ) {
+      if ( (*iter).find("/run/initialize") != std::string::npos ) {
+	break;
+      }
+    }
+    return iter;
+  }
 }
CVSspam 0.2.8