Ignore:
Timestamp:
Jun 11, 2008, 4:16:27 PM (16 years ago)
Author:
garnier
Message:

updates from the head of geant4 in order to compile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/intercoms/src/G4UIcommandTree.cc

    r821 r842  
    2525//
    2626//
    27 // $Id: G4UIcommandTree.cc,v 1.13 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 $
    2929//
    3030
     
    156156}
    157157
     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
    158161G4UIcommand * G4UIcommandTree::FindPath(const char* commandPath)
    159162{
     
    183186      if( nextPath == tree[i_thTree]->GetPathName() )
    184187      { 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 */
     199G4UIcommandTree * 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      }
    185220    }
    186221  }
Note: See TracChangeset for help on using the changeset viewer.