| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- File List
- File Members

# DataOnDemandSvc.cpp File Reference

`#include <string>`
`#include <set>`
`#include <map>`
`#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 "DataOnDemandSvc.h"`
`#include "boost/format.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 @581::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 141 of file DataOnDemandSvc.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::empty(), and std::basic_string< _CharT, _Traits, _Alloc >::erase().

Referenced by DataOnDemandSvc::update().

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

template<class SET>

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

References std::basic_string< _CharT, _Traits, _Alloc >::npos, and std::basic_string< _CharT, _Traits, _Alloc >::rfind().

Referenced by get_dirs().

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

template<class MAP, class SET>

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

References get_dir().

Referenced by DataOnDemandSvc::update().

    00184   {
    00185     size_t size = _set.size() ;
    00186     for ( typename MAP::const_iterator item = _map.begin() ;
    00187           _map.end() != item ; ++item ) {  get_dir ( item->first , _set ) ; }
    00188     return _set.size() - size ;
    00189   }

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

remove the prefix from the string

Parameters:

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

Returns:
  input string without prefix

Definition at line 127 of file DataOnDemandSvc.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::empty(), std::basic_string< _CharT, _Traits, _Alloc >::find(), and std::basic_string< _CharT, _Traits, _Alloc >::size().

Referenced by DataOnDemandSvc::dump().

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