| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# 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/ListItem.h"`
`#include "GaudiKernel/ToStream.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 @585::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 143 of file DataOnDemandSvc.cpp.

    00144   {
    00145     // empty  prefix
    00146     if ( prefix.empty() ) { return 0 ; }                    // RETURN
    00148     for ( typename MAP::iterator it = _map.begin() ; _map.end() != it ; ++it )
    00149     {
    00150       if ( 0 != it->first.find(prefix) )  // valid prefix?
    00151       {
    00152         std::string key   = prefix + it->first ;
    00153         std::string value = it->second ;
    00154         _map.erase ( it ) ;
    00155         _map[ key ] = value  ;
    00156         return 1 + add_prefix ( _map , prefix ) ;    // RETURN, recursion
    00157       }
    00158     }
    00159     //
    00160     return 0 ;
    00161   }

template<class SET>

size_t @585::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 169 of file DataOnDemandSvc.cpp.

    00170   {
    00171     std::string::size_type ifind = object.rfind('/') ;
    00172     // stop recursion
    00173     if ( std::string::npos == ifind ) { return 0 ; } // RETURN
    00174     if ( 0 == ifind                 ) { return 0 ; }
    00175     //
    00176     const std::string top = std::string( object , 0 , ifind) ;
    00177     _set.insert( top ) ;
    00178     return 1 + get_dir ( top , _set ) ;   // RETURN, recursion
    00179   }

template<class MAP, class SET>

size_t @585::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 187 of file DataOnDemandSvc.cpp.

    00188   {
    00189     size_t size = _set.size() ;
    00190     for ( typename MAP::const_iterator item = _map.begin() ;
    00191           _map.end() != item ; ++item ) {  get_dir ( item->first , _set ) ; }
    00192     return _set.size() - size ;
    00193   }

std::string @585::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 128 of file DataOnDemandSvc.cpp.

    00130   {
    00131     return
    00132       !prefix.empty() && 0 == value.find(prefix) ?
    00133       std::string( value , prefix.size() ) : value ;
    00134   }