| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 {
43 auto p1 = old.begin();
44 const char sep('/');
45 while( old.end() != p1 )
46 {
47 p1 =
48 std::find_if( p1 ,
49 old.end() ,
50 [&](const char& c) { return c!=sep; } );
51 auto p2 = std::find( p1 , old.end() , sep ) ;
52 if( ( p2 - p1 ) <= (int) maxLen ) { p1 = p2 ; continue ; }
53 old.insert( p1 + maxLen , sep ) ;
54 p1 = old.begin() ;
55 }
56 }
58 return old;
59 }
60
61 } // end of anonymous namespace
62
63 // ============================================================================
64 // The END
65 // ============================================================================
66 #endif // GAUDIALG_HBOOKNAME_H
67 // ============================================================================
std::string::empty
T empty(T...args)
gaudirun.c
tuple c
Definition: gaudirun.py:391
HiveAlgSequencer.p2
tuple p2
Definition: HiveAlgSequencer.py:23
std::string
STL class.
std::find_if
T find_if(T...args)
HiveAlgSequencer.p1
tuple p1
Definition: HiveAlgSequencer.py:22