22 #define GAUDISVC_NTUPLESVC_CPP
55 inline std::string
toStr(
long id) {
56 std::ostringstream
s; s << id;
90 for ( DBaseEntries::iterator j =
m_input.begin(); j !=
m_input.end(); ++j ) {
114 if ( 0 != pRegistry ) {
118 std::string
path = (idx==std::string::npos) ? full : full.substr(0, idx);
121 return (*i).second.service;
128 typedef std::vector<IRegistry*> Leaves;
129 long need_update = 0;
139 for ( Leaves::iterator d = leaves.begin(); d != leaves.end(); d++ ) {
140 if ( (*d)->object() ) {
143 unsigned long typ = pA->
ipar()[1];
144 if ( typ ==
'R' || typ ==
'N' || typ ==
'U' ) {
152 for(
int i = sel->size()-1;
i >= 0;
i-- ) {
160 for(
int j = sel->size()-1; j >= 0; j-- ) {
168 if ( iret.
isSuccess() ) need_update += sel->size();
180 else if ( need_update > 0 ) {
190 isvc->finalize().ignore();
227 return connect(ident, logName);
237 std::vector<Prop> props;
238 long loc = ident.find(
" ");
239 std::string filename, auth, svc =
"", db_typ =
"";
240 logname = ident.substr(0,loc);
241 tok.
analyse(ident.substr(loc+1,ident.length()),
" ",
"",
"",
"=",
"'",
"'");
242 for ( Tokenizer::Items::iterator
i = tok.
items().begin();
i != tok.
items().end(); ++
i) {
243 const std::string& tag = (*i).tag();
249 filename = (*i).value();
252 switch( ::
toupper((*i).value()[0]) ) {
271 db_typ = (*i).value();
274 props.push_back(
Prop((*i).tag(), (*i).value()));
290 log <<
MSG::ERROR <<
"Cannot add " << ident <<
" invalid filename!" <<
endmsg;
295 const std::string& typ,
296 const std::vector<Prop>& ,
313 log <<
MSG::ERROR <<
"Could not get NTuple Persistency format"
314 <<
" from ApplicationMgr properties" <<
endmsg;
319 if ( sp.
value() ==
"HBOOK" ) {
322 else if ( sp.
value() ==
"ROOT" ) {
333 if ( typ.length() > 0 && typ != sp.
value() ) {
336 <<
"Type given by job option "
337 <<
"NTupleSvc.Input/Output ignored!" <<
endmsg;
389 std::string
path = fullPath;
400 std::string p_path (path, 0, sep);
401 std::string o_path (path, sep, path.length());
406 log <<
MSG::ERROR <<
"Cannot book N-tuple " << path <<
" (Unknown reason)" <<
endmsg;
410 log <<
MSG::ERROR <<
"Cannot book N-tuple " << path <<
" (Invalid parent directory)" <<
endmsg;
413 log <<
MSG::ERROR <<
"Cannot book N-tuple " << path <<
" (Invalid path)" <<
endmsg;
416 log <<
MSG::ERROR <<
"Cannot book N-tuple " << path <<
" (Exists already)" <<
endmsg;
422 std::string full = dirPath;
425 return book(full, type, title);
430 return book( dirPath,
toStr(
id), type, title);
440 status =
create( type, title, pObj);
457 const std::string& title) {
458 return book( pParent,
toStr(
id), type, title);
463 const std::string& relPath) {
464 if ( 0 != pParent ) {
468 full += (relPath[0]==
'/') ?
"" :
"/";
488 std::string full = dirPath;
489 full += (relPath[0]==
'/') ?
"" :
"/";
503 entryname += logname;
508 log <<
MSG::INFO <<
"Added stream file:" << filename <<
" as " << logname <<
endmsg;
513 log <<
MSG::ERROR <<
"Cannot add file:" << filename <<
" as " << logname <<
endmsg;
524 std::string relPath = fullPath.substr(0, sep2);
572 return save ( pObj );
574 return INVALID_OBJ_PATH;
584 if ( 0 != pSvc && 0 != pReg ) {
597 return INVALID_OBJECT;
605 return save ( pObj );
607 return INVALID_OBJ_PATH;
635 return INVALID_OBJECT;
645 return INVALID_OBJ_PATH;
655 return INVALID_OBJ_PATH;
672 status = pSvc->
updateObj(pAddr, n_tuple);
681 status = INVALID_OBJECT;
694 return INVALID_OBJ_PATH;
704 return INVALID_OBJ_PATH;