Changeset 842 for trunk/source/intercoms
- Timestamp:
- Jun 11, 2008, 4:16:27 PM (17 years ago)
- Location:
- trunk/source/intercoms
- Files:
-
- 3 edited
-
History (modified) (2 diffs)
-
include/G4UIcommandTree.hh (modified) (2 diffs)
-
src/G4UIcommandTree.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/intercoms/History
r821 r842 1 $Id: History,v 1.7 0 2007/08/10 09:47:43 kmuraExp $1 $Id: History,v 1.71 2008/01/30 11:20:03 lgarnier Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 30th January 2007, Laurent Garnier 21 - Add a new function in G4UIcommandTree to find a subtree 19 22 20 23 August 10, 2007 K.Murakami (intercoms-V09-00-01) -
trunk/source/intercoms/include/G4UIcommandTree.hh
r821 r842 25 25 // 26 26 // 27 // $Id: G4UIcommandTree.hh,v 1.1 5 2006/06/29 19:08:11 gunter Exp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4UIcommandTree.hh,v 1.16 2008/01/30 11:20:03 lgarnier Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 … … 56 56 void RemoveCommand(G4UIcommand * aCommand); 57 57 G4UIcommand * FindPath(const char* commandPath); 58 G4UIcommandTree * FindCommandTree(const char* commandPath); 58 59 void List(); 59 60 void ListCurrent(); -
trunk/source/intercoms/src/G4UIcommandTree.cc
r821 r842 25 25 // 26 26 // 27 // $Id: G4UIcommandTree.cc,v 1.1 3 2006/06/29 19:08:58 gunter Exp $28 // GEANT4 tag $Name: geant4-09-01-patch-02$27 // $Id: G4UIcommandTree.cc,v 1.14 2008/01/30 11:20:03 lgarnier Exp $ 28 // GEANT4 tag $Name: HEAD $ 29 29 // 30 30 … … 156 156 } 157 157 158 // L. Garnier 01.28.08 This function has not a good name. In fact, it try 159 // to match a command name, not a path. It should be rename as FindCommandName 160 158 161 G4UIcommand * G4UIcommandTree::FindPath(const char* commandPath) 159 162 { … … 183 186 if( nextPath == tree[i_thTree]->GetPathName() ) 184 187 { return tree[i_thTree]->FindPath( commandPath ); } 188 } 189 } 190 return NULL; 191 } 192 193 194 /** 195 * Try to match a command or a path with the one given. 196 * @commandPath : command or path to match 197 * @return the commandTree found or NULL if not 198 */ 199 G4UIcommandTree * G4UIcommandTree::FindCommandTree(const char* commandPath) 200 { 201 G4String remainingPath = commandPath; 202 if( remainingPath.index( pathName ) == std::string::npos ) 203 { return NULL; } 204 remainingPath.remove(0,pathName.length()); 205 G4int i = remainingPath.first('/'); 206 if( i != G4int(std::string::npos) ) 207 { 208 // Find path 209 G4String nextPath = pathName; 210 nextPath.append(remainingPath(0,i+1)); 211 G4int n_treeEntry = tree.size(); 212 for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ ) 213 { 214 if (tree[i_thTree]->GetPathName() == commandPath) { 215 return tree[i_thTree]; 216 } 217 else if( nextPath == tree[i_thTree]->GetPathName() ) { 218 return tree[i_thTree]->FindCommandTree( commandPath ); 219 } 185 220 } 186 221 }
Note:
See TracChangeset
for help on using the changeset viewer.
