| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DirHbookName.h

Go to the documentation of this file.
00001 // $Id: DirHbookName.h,v 1.2 2005/01/25 14:41:07 cattanem Exp $
00002 // =============================================================================
00003 // CVS tag $Name: v4r10p1 $ 
00004 // =============================================================================
00005 #ifndef DETDESCCHECKS_DIRHBOOKNAME_H 
00006 #define DETDESCCHECKS_DIRHBOOKNAME_H 1
00007 
00008 namespace Local
00009 {
00026   inline std::string dirHbookName 
00027   ( const std::string& addr       , 
00028     const int          maxLen = 8 )
00029   {
00030     // ignore empty locations 
00031     if( addr.empty() ) { return std::string(); }
00032     //
00033     std::string old( addr );
00034     // remove long names
00035     if( 0 < maxLen &&  maxLen < (int) old.size() ) 
00036       { 
00037         std::string::iterator p1,p2;
00038         p1 = old.begin();
00039         const char sep('/');
00040         while( old.end() != p1 )
00041           {
00042             p1 = 
00043               std::find_if( p1        , 
00044                             old.end() , 
00045                             std::bind2nd(std::not_equal_to<char>(),sep));
00046             p2 = std::find( p1 , old.end() , sep ) ;
00047             if( ( p2 - p1 ) <= (int) maxLen  ) { p1 = p2 ; continue ; }
00048             old.insert( p1 + maxLen , sep ) ;  
00049             p1 = old.begin() ; 
00050           }
00051       }
00053     return old;
00054   }; 
00055   
00056 }; // end of namespace Local 
00057 // =============================================================================
00058 
00059 
00060 // =============================================================================
00061 // The END 
00062 // =============================================================================
00063 #endif // DETDESCCHECKS_DIRHBOOKNAME_H
00064 // =============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:05:13 2011 for DetDescChecks by doxygen 1.4.7