Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 // $Id: HbookName.h,v 1.2 2006/12/10 19:11:56 leggett Exp $
002 // ============================================================================
003 #ifndef GAUDIALG_HBOOKNAME_H 
004 #define GAUDIALG_HBOOKNAME_H 1
005 // Include files
006 #include <string>
007 #include <algorithm>
008 
009 /** @file 
010  *  few useful function to construct names of Hbook histograms 
011  *  and directories 
012  *  functions are imported from 
013  *  Tools/LoKi and Calo/CaloUtils packages 
014  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
015  *  @date   2002-07-25
016  */
017 
018 namespace 
019 {
020   /** @fn dirHbookName
021    *  
022    *  simple function to convert any valid Gaudi address
023    *  (name in Transient Store)
024    *  to address, which is simultaneously valid for Hbook directory
025    *
026    *    examples:  
027    *   "verylongname"  -->  "verylong/name"
028    *
029    *  @param   old    old address 
030    *  @param   maxLen maximum allowed length of directory name (16 for Hbook) 
031    *  @return  new  address 
032    *
033    *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
034    *  @date   06/07/2001
035    */
036   inline std::string dirHbookName 
037   ( const std::string& addr        , 
038     const int          maxLen = 16 )
039   {
040     // ignore empty locations 
041     if( addr.empty() ) { return std::string(); }
042     //
043     std::string old( addr );
044     // remove long names
045     if( 0 < maxLen &&  maxLen < (int) old.size() ) 
046     { 
047       std::string::iterator p1,p2;
048       p1 = old.begin();
049       const char sep('/');
050       while( old.end() != p1 )
051       {
052         p1 = 
053           std::find_if( p1        , 
054                         old.end() , 
055                         std::bind2nd(std::not_equal_to<char>(),sep));
056         p2 = std::find( p1 , old.end() , sep ) ;
057         if( ( p2 - p1 ) <= (int) maxLen  ) { p1 = p2 ; continue ; }
058         old.insert( p1 + maxLen , sep ) ;  
059         p1 = old.begin() ; 
060       }
061     }
062     ///
063     return old;
064   }
065   
066   /** @fn histoHbookName
067    *  
068    *  simple function to convert any valid 
069    *   Gaudi address(name in Transient Store)
070    *  to address, which is simultaneously valid for Hbook histogram
071    *
072    *    examples:  
073    *   "verylongname/116"  -->  "verylong/name/116"
074    *   "verylongname"      -->  "verylong/name/1"
075    *   "somename/here/"    -->  "somename/here/1"
076    *   "directory/object"  -->  "director/y/object/1"
077    *
078    *  @param   old    old address 
079    *  @param   maxLen maximum allowed length of directory name (8 for Hbook) 
080    *  @return  new  address 
081    *
082    *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
083    *  @date   06/07/2001
084    */
085   inline std::string histoHbookName 
086   ( const std::string& addr       , 
087     const int          maxLen = 8 )
088   {
089     // ignore empty locations 
090     if( addr.empty() ) { return std::string(); }
091     //
092     std::string old( addr );
093     { // make valid histogram ID (integer)  
094       std::string::size_type pos 
095         = old.find_last_of( '/' );
096       if      ( std::string::npos == pos ) { old += "/1" ; }
097       else if ( old.size() - 1    == pos ) { old += '1'  ; }
098       else
099       {
100         const int id = 
101           atoi( std::string( old , pos + 1 , std::string::npos ).c_str() );
102         if( 0 == id ) { old+="/1"; }
103       }
104     }
105     // remove long names
106     if( 0 < maxLen &&  maxLen < (int) old.size() ) 
107     { 
108       std::string::iterator p1,p2;
109       p1 = old.begin();
110       const char sep('/');
111       while( old.end() != p1 )
112       {
113         p1 = 
114           std::find_if( p1        , 
115                         old.end() , 
116                         std::bind2nd(std::not_equal_to<char>(),sep));
117         p2 = std::find( p1 , old.end() , sep ) ;
118         if( ( p2 - p1 ) <= (int) maxLen  ) { p1 = p2 ; continue ; }
119         old.insert( p1 + maxLen , sep ) ;  
120         p1 = old.begin() ; 
121       }
122     }
123     //
124     return old;
125   }
126   
127 } // end of anynous namespace 
128 
129 // ============================================================================
130 // The END 
131 // ============================================================================
132 #endif // GAUDIALG_HBOOKNAME_H
133 // ============================================================================
134 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!