1 #ifndef GAUDIUTILS_MULTIFILECATALOG_H
2 #define GAUDIUTILS_MULTIFILECATALOG_H
27 typedef const std::string&
CSTR;
31 template <
class T>
void _exec(T pmf)
const {
35 template <
class A1,
class F> std::string
_find(A1& arg1,F pmf)
const {
38 if ( !(result= ((*i)->*pmf)(arg1)).empty() )
break;
41 template <
class A1,
class F>
void _collect(A1 arg1,F pmf)
const {
45 arg1.insert(arg1.end(),tmp.begin(),tmp.end());
48 template <
class A1,
class A2,
class F>
void _collect(A1 arg1,A2& arg2,F pmf)
const {
51 ((*i)->*pmf)(arg1,tmp);
52 arg2.insert(arg2.end(),tmp.begin(),tmp.end());
69 virtual std::string createFID()
const;
71 virtual CSTR connectInfo()
const;
80 virtual bool readOnly()
const;
82 virtual bool dirty()
const;
88 {
return _find(pfn,&IFileCatalog::lookupPFN); }
94 {
return _find(lfn,&IFileCatalog::lookupLFN); }
97 {
return 0 !=
getCatalog(fid,
false,
false,
false); }
100 {
_collect(fid,files,&IFileCatalog::getPFN); }
103 {
_collect(fid,files,&IFileCatalog::getLFN); }
107 {
_collect(fids,&IFileCatalog::getFID); }
112 virtual void registerPFN(
CSTR fid,
CSTR pfn,
CSTR ftype)
const;
114 virtual void registerLFN(
CSTR fid,
CSTR lfn)
const;
120 {
_collect(fid,attr,&IFileCatalog::getMetaData); }
122 virtual std::string getMetaDataItem(
CSTR fid,
CSTR name)
const;
135 virtual IFileCatalog* findCatalog(
CSTR connect,
bool must_be_writable)
const;
137 virtual void addCatalog(
CSTR connect);
141 virtual void removeCatalog(
CSTR connect);
154 virtual void setWriteCatalog(
CSTR connect);
158 IFileCatalog* getCatalog(
CSTR fid,
bool throw_if_not,
bool writable=
true,
bool prt=
true)
const;
160 Catalogs::iterator i_findCatalog(
CSTR connect,
bool must_be_writable);
166 void printError(
CSTR msg,
bool throw_exc=
true)
const;
167 std::string lookupFID(
CSTR lfn)
const;