Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HbookName.h
Go to the documentation of this file.
1 #ifndef GAUDIALG_HBOOKNAME_H
2 #define GAUDIALG_HBOOKNAME_H 1
3 // Include files
4 #include <string>
5 #include <algorithm>
6 
16 namespace
17 {
32  inline std::string dirHbookName
33  ( const std::string& addr ,
34  const int maxLen = 16 )
35  {
36  // ignore empty locations
37  if( addr.empty() ) { return std::string(); }
38  //
39  std::string old( addr );
40  // remove long names
41  if( 0 < maxLen && maxLen < (int) old.size() )
42  {
44  p1 = old.begin();
45  const char sep('/');
46  while( old.end() != p1 )
47  {
48  p1 =
49  std::find_if( p1 ,
50  old.end() ,
52  p2 = std::find( p1 , old.end() , sep ) ;
53  if( ( p2 - p1 ) <= (int) maxLen ) { p1 = p2 ; continue ; }
54  old.insert( p1 + maxLen , sep ) ;
55  p1 = old.begin() ;
56  }
57  }
59  return old;
60  }
61 
62 } // end of anonymous namespace
63 
64 // ============================================================================
65 // The END
66 // ============================================================================
67 #endif // GAUDIALG_HBOOKNAME_H
68 // ============================================================================

Generated at Wed Dec 4 2013 14:33:07 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004