2 #include <boost/numeric/conversion/bounds.hpp>
3 #include <boost/filesystem.hpp>
4 #include <boost/foreach.hpp>
5 #include <boost/lexical_cast.hpp>
8 #include "GaudiKernel/IRegistry.h"
9 #include "GaudiKernel/IDataManagerSvc.h"
10 #include "GaudiKernel/IDataProviderSvc.h"
11 #include "GaudiKernel/IOpaqueAddress.h"
12 #include "GaudiKernel/DataStoreItem.h"
13 #include "GaudiKernel/DataObject.h"
14 #include "GaudiKernel/MsgStream.h"
21 namespace bf = boost::filesystem;
22 using boost::lexical_cast;
23 using boost::bad_lexical_cast;
30 declareProperty(
"EventsPerFile", m_eventsPerFile
31 = boost::numeric::bounds< unsigned int>::highest() );
32 declareProperty(
"NumericFilename", m_numericFilename =
false );
33 declareProperty(
"NumbersAdded", m_nNumbersAdded = 6 );
70 string filename = outputPath.filename().string();
71 bf::path dir = outputPath.parent_path();
72 string stem = outputPath.stem().string();
73 string extension = outputPath.extension().string();
76 if ( !bf::exists( dir ) ) {
78 stream <<
"Directory " << dir <<
" does not exist.";
86 m_iFile = lexical_cast<
unsigned int >( stem );
87 }
catch(
const bad_lexical_cast& ) {
89 stream <<
"Filename " << filename
90 <<
" is not a number, which was needed.";
94 stringstream iFileStream;
96 string iFile( iFileStream.str() );
97 unsigned int length = 0;
99 if ( stem.length() > iFile.length() ) {
100 length = stem.length() - iFile.length();
104 if ( !dir.empty() ) {
107 for (
unsigned int i = 0;
i < length; ++
i ) {
110 name << iFile << extension;
114 size_t pos = stem.rfind(
"_" );
115 stem = stem.substr( 0, pos );
118 stringstream iFileStream;
120 string iFile( iFileStream.str() );
122 unsigned int length = 0;
128 name << dir <<
"/" << stem;
129 for (
unsigned int i = 0;
i < length; ++
i ) {
130 if (
i == 0 ) name <<
"_";
133 name << iFile << extension;