7 #ifndef GAUDIKERNEL_IFILEMGR_H 8 #define GAUDIKERNEL_IFILEMGR_H 1 45 int f()
const {
return _f; }
53 operator int()
const {
return _f; }
61 if ( strict ) {
return (
_f == fa ); }
63 return ( (
_f & 3 ) == ( fa & 3 ) );
69 const int SHIFT = 8 *
sizeof( int ) - 1;
70 const unsigned MASK = 1 << SHIFT;
72 for (
int i = 1; i <= SHIFT + 1; ++i ) {
73 s += (
f & MASK ?
'1' :
'0' );
75 if ( i % 8 == 0 )
s +=
' ';
96 for (
int i = 0; i < 32; ++i ) {
98 if ( b & f ) ff += s_names.
at( (
IoFlag )( b ) ) +
"|";
115 size_t j( 0 ), k( 0 );
117 while ( ( k = f.
find(
"|", j ) ) != std::string::npos ) {
118 fs = f.
substr( j, k - j );
123 fl = fl | s_n.
at( fs );
132 fl = fl | s_n.
at( fs );
150 return t < tbl.
size() ?
s << tbl[t] :
s;
196 os <<
"name: \"" << fa.
name() <<
"\" tech: " << fa.
tech() <<
" desc: " << fa.
desc()
197 <<
" flags: " << IoFlagName( fa.
flags() ) <<
" i_flags: " << IoFlagName( fa.
iflags() ) <<
" Fd: " << fa.
fd()
198 <<
" ptr: " << fa.
fptr() << ( fa.
isOpen() ?
" [o]" :
" [c]" ) << ( fa.
isShared() ?
" [s]" :
" [u]" );
273 {
"OPEN",
"CLOSE",
"REOPEN",
"OPEN_ERR",
"CLOSE_ERR",
"REOPEN_ERR",
"INVALID_ACTION"}};
274 return t < tbl.
size() ?
s << tbl[t] :
s;
277 #define FILEMGR_CALLBACK_ARGS const Io::FileAttr*, const std::string& 308 virtual void listHandlers()
const = 0;
309 virtual void listFiles()
const = 0;
325 bool onlyOpen =
true )
const = 0;
327 bool onlyOpen =
true )
const = 0;
339 virtual const std::string& fname(
void* )
const = 0;
343 virtual Io::Fd fd(
void* fptr )
const = 0;
346 virtual void* fptr(
const std::string& )
const = 0;
347 virtual void* fptr(
const Io::Fd& )
const = 0;
361 void*&,
const std::string& desc,
const bool shared =
false ) = 0;
377 virtual void suppressAction(
const std::string& ) = 0;
std::function< Io::reopen_t(void *, Io::IoFlags)> bfcn_reopenP_t
IoFlags operator|(const IoFlags &fa) const
void flags(const IoFlags &f)
GAUDI_API unsigned long getLastError()
Get last system known error.
bfcn_reopen_t b_reopen_fcn
void name(const std::string &n)
std::function< Io::close_t(Io::Fd)> bfcn_close_t
const std::string & name() const
std::function< Io::reopen_t(Io::Fd, Io::IoFlags)> bfcn_reopen_t
bool operator==(const int &fa) const
std::function< Io::open_t(const std::string &, Io::IoFlags, const std::string &, Io::Fd &, void *&)> bfcn_open_t
FileHdlr(IoTech t, bfcn_open_t o, bfcn_close_t c, bfcn_reopen_t r)
#define FILEMGR_CALLBACK_ARGS
std::function< Io::close_t(void *)> bfcn_closeP_t
FileAttr(Fd f, std::string n, std::string d, IoTech t, IoFlags fa, void *p, bool o, bool s=false)
void iflags(const IoFlags &f)
IoFlags IoFlagFromName(const std::string &f)
General service interface definition.
This class is used for returning status codes from appropriate routines.
std::ostream & operator<<(std::ostream &s, const IoFlag &f)
bfcn_closeP_t b_closeP_fcn
FileHdlr(IoTech t, bfcn_open_t o, bfcn_closeP_t c, bfcn_reopenP_t r)
bfcn_reopenP_t b_reopenP_fcn
bool match(const IoFlags &fa, bool strict=true) const
bool operator==(const IoFlags &fa) const
const std::string & desc() const
std::function< StatusCode(FILEMGR_CALLBACK_ARGS)> bfcn_action_t
void tech(const IoTech &t)
FileHdlr(IoTech t, bfcn_open_t o, bfcn_close_t c1, bfcn_closeP_t c2, bfcn_reopen_t r1, bfcn_reopenP_t r2)
bool operator<(const FileAttr &rhs) const
DeclareInterfaceID(IService, 4, 0)
InterfaceID.
void desc(const std::string &d)
IoFlags operator|(const int &fa) const
bool operator==(const FileAttr &fa) const
friend std::ostream & operator<<(std::ostream &os, const FileAttr &fa)