| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 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 @615::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 184 of file DataOnDemandSvc.cpp.

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

template<class SET>

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

    00211   {
    00212     std::string::size_type ifind = object.rfind('/') ;
    00213     // stop recursion
    00214     if ( std::string::npos == ifind ) { return 0 ; } // RETURN
    00215     if ( 0 == ifind                 ) { return 0 ; }
    00216     //
    00217     const std::string top = std::string( object , 0 , ifind) ;
    00218     _set.insert( top ) ;
    00219     return 1 + get_dir ( top , _set ) ;   // RETURN, recursion
    00220   }

template<class MAP, class SET>

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

    00229   {
    00230     size_t size = _set.size() ;
    00231     for ( typename MAP::const_iterator item = _map.begin() ;
    00232           _map.end() != item ; ++item ) {  get_dir ( item->first , _set ) ; }
    00233     return _set.size() - size ;
    00234   }

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

    00171   {
    00172     return
    00173       !prefix.empty() && 0 == value.find(prefix) ?
    00174       std::string( value , prefix.size() ) : value ;
    00175   }