| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# DataOnDemandSvc.cpp File Reference

`#include <string>`
`#include <set>`
`#include <map>`
`#include <math.h>`
`#include "GaudiKernel/MsgStream.h"`
`#include "GaudiKernel/Tokenizer.h"`
`#include "GaudiKernel/DataObject.h"`
`#include "GaudiKernel/IAlgorithm.h"`
`#include "GaudiKernel/ISvcLocator.h"`
`#include "GaudiKernel/IAlgManager.h"`
`#include "GaudiKernel/IIncidentSvc.h"`
`#include "GaudiKernel/DataIncident.h"`
`#include "GaudiKernel/IDataProviderSvc.h"`
`#include "GaudiKernel/TypeNameString.h"`
`#include "GaudiKernel/ToStream.h"`
`#include "GaudiKernel/Chrono.h"`
`#include "GaudiKernel/LockedChrono.h"`
`#include "DataOnDemandSvc.h"`
`#include "boost/format.hpp"`
`#include "boost/lexical_cast.hpp"`

Include dependency graph for DataOnDemandSvc.cpp:

Go to the source code of this file.

## Functions
std::string | no_prefix (const std::string &value, const std::string &prefix)
| remove the prefix from the string
template<class MAP>
size_t | add_prefix (MAP &_map, const std::string &prefix)
| add a prefix (if needed) to all keys of the map the previus key is removed
template<class SET>
size_t | get_dir (const std::string &object, SET &_set)
| get the list of directories for a certain TES location
template<class MAP, class SET>
size_t | get_dirs (const MAP &_map, SET &_set)
| get the list of directories for a all keys of the input map

## Function Documentation

template<class MAP>

size_t @609::add_prefix | ( | MAP & | _map,
|  | const std::string & | prefix |
| ) |  |  | `[inline, static]`

add a prefix (if needed) to all keys of the map the previus key is removed

Parameters:

  | _map | map to be modified
  | prefix | prefix to be added

Returns:
  number of modified keys

loop over all entries to find the proper keys

Definition at line 179 of file DataOnDemandSvc.cpp.

    00180   {
    00181     // empty  prefix
    00182     if ( prefix.empty() ) { return 0 ; }                    // RETURN
    00184     for ( typename MAP::iterator it = _map.begin() ; _map.end() != it ; ++it )
    00185     {
    00186       if ( 0 != it->first.find(prefix) )  // valid prefix?
    00187       {
    00188         std::string key   = prefix + it->first ;
    00189         std::string value = it->second ;
    00190         _map.erase ( it ) ;
    00191         _map[ key ] = value  ;
    00192         return 1 + add_prefix ( _map , prefix ) ;    // RETURN, recursion
    00193       }
    00194     }
    00195     //
    00196     return 0 ;
    00197   }

template<class SET>

size_t @609::get_dir | ( | const std::string & | object,
|  | SET & | _set |
| ) |  |  | `[inline, static]`

get the list of directories for a certain TES location

Parameters:

  | object | to be inspected
  | _set | (output) the set with directoiry list

Returns:
  incrment of the output set size

Definition at line 205 of file DataOnDemandSvc.cpp.

    00206   {
    00207     std::string::size_type ifind = object.rfind('/') ;
    00208     // stop recursion
    00209     if ( std::string::npos == ifind ) { return 0 ; } // RETURN
    00210     if ( 0 == ifind                 ) { return 0 ; }
    00211     //
    00212     const std::string top = std::string( object , 0 , ifind) ;
    00213     _set.insert( top ) ;
    00214     return 1 + get_dir ( top , _set ) ;   // RETURN, recursion
    00215   }

template<class MAP, class SET>

size_t @609::get_dirs | ( | const MAP & | _map,
|  | SET & | _set |
| ) |  |  | `[inline, static]`

get the list of directories for a all keys of the input map

Parameters:

  | _map | (input) map to be inspected
  | _set | (output) the set with directoiry list

Returns:
  incrment of the output set size

Definition at line 223 of file DataOnDemandSvc.cpp.

    00224   {
    00225     size_t size = _set.size() ;
    00226     for ( typename MAP::const_iterator item = _map.begin() ;
    00227           _map.end() != item ; ++item ) {  get_dir ( item->first , _set ) ; }
    00228     return _set.size() - size ;
    00229   }

std::string @609::no_prefix | ( | const std::string & | value,
|  | const std::string & | prefix |
| ) |  |  | `[inline, static]`

remove the prefix from the string

Parameters:

  | value | input tring
  | prefix | prefix to be removed

Returns:
  input string without prefix

Definition at line 164 of file DataOnDemandSvc.cpp.

    00166   {
    00167     return
    00168       !prefix.empty() && 0 == value.find(prefix) ?
    00169       std::string( value , prefix.size() ) : value ;
    00170   }