Go to the documentation of this file.
   17 #ifndef GAUDIKERNEL_IFILEMGR_H 
   18 #define GAUDIKERNEL_IFILEMGR_H 1 
   55     unsigned f()
 const { 
return _f; }
 
   58     bool operator==( 
const unsigned& fa )
 const { 
return ( 
_f == fa ); }
 
   63     operator unsigned()
 const { 
return _f; }
 
   71       if ( strict ) { 
return ( 
_f == fa ); }
 
   73       return ( ( 
_f & 3 ) == ( fa & 3 ) );
 
   79       const unsigned SHIFT = 8 * 
sizeof( unsigned ) - 1;
 
   80       const unsigned MASK  = 1u << SHIFT;
 
   82       for ( 
unsigned i = 1; i <= SHIFT + 1; ++i ) {
 
   83         s += ( 
f & MASK ? 
'1' : 
'0' );
 
   85         if ( i % 8 == 0 ) 
s += 
' ';
 
  106     for ( 
unsigned i = 0; i < 32; ++i ) {
 
  107       auto b = ( 1u << i );
 
  108       if ( b & f ) ff += s_names.
at( (
IoFlag)( b ) ) + 
"|";
 
  125     size_t      j( 0 ), k( 0 );
 
  127     while ( ( k = f.
find( 
"|", 
j ) ) != std::string::npos ) {
 
  133         fl = fl | s_n.
at( fs );
 
  142       fl = fl | s_n.
at( fs );
 
  160     return t < tbl.
size() ? 
s << tbl[
t] : 
s;
 
  206       os << 
"name: \"" << fa.
name() << 
"\"  tech: " << fa.
tech() << 
"  desc: " << fa.
desc()
 
  207          << 
"  flags: " << IoFlagName( fa.
flags() ) << 
"  i_flags: " << IoFlagName( fa.
iflags() ) << 
"  Fd: " << fa.
fd()
 
  208          << 
"  ptr: " << fa.
fptr() << ( fa.
isOpen() ? 
"  [o]" : 
"  [c]" ) << ( fa.
isShared() ? 
" [s]" : 
" [u]" );
 
  283         { 
"OPEN", 
"CLOSE", 
"REOPEN", 
"OPEN_ERR", 
"CLOSE_ERR", 
"REOPEN_ERR", 
"INVALID_ACTION" } };
 
  284     return t < tbl.
size() ? 
s << tbl[
t] : 
s;
 
  287 #define FILEMGR_CALLBACK_ARGS const Io::FileAttr*, const std::string& 
  335                         bool onlyOpen = 
true ) 
const = 0;
 
  337                         bool onlyOpen = 
true ) 
const = 0;
 
  371                            void*&, 
const std::string& desc, 
const bool shared = 
false ) = 0;
 
  
 
bfcn_closeP_t b_closeP_fcn
virtual int getFiles(std::vector< std::string > &FILES, bool onlyOpen=true) const =0
DeclareInterfaceID(IFileMgr, 1, 0)
virtual void listHandlers() const =0
virtual void listFiles() const =0
bool match(const IoFlags &fa, bool strict=true) const
virtual StatusCode deregHandler(const Io::IoTech &)=0
bool operator==(const unsigned &fa) const
FileHdlr(IoTech t, bfcn_open_t o, bfcn_closeP_t c, bfcn_reopenP_t r)
virtual const std::string & fname(void *) const =0
std::function< Io::open_t(const std::string &, Io::IoFlags, const std::string &, Io::Fd &, void *&)> bfcn_open_t
bool operator==(const IoFlags &fa) const
bool operator==(const FileAttr &fa) const
virtual StatusCode getFileAttr(const Io::Fd, const Io::FileAttr *&) const =0
virtual Io::reopen_t reopen(void *, const Io::IoFlags &, const std::string &)=0
virtual int getFd(const Io::IoTech &, const Io::IoFlags &, std::vector< Io::Fd > &) const =0
friend std::ostream & operator<<(std::ostream &os, const FileAttr &fa)
void iflags(const IoFlags &f)
virtual int getFiles(const Io::IoTech &, const Io::IoFlags &, std::vector< std::string > &FILES, bool onlyOpen=true) const =0
std::ostream & operator<<(std::ostream &s, const IoFlag &f)
virtual int getFiles(const Io::IoTech &, std::vector< std::string > &FILES, bool onlyOpen=true) const =0
virtual void suppressAction(const std::string &)=0
std::function< Io::reopen_t(void *, Io::IoFlags)> bfcn_reopenP_t
virtual Io::reopen_t reopen(const Io::Fd, const Io::IoFlags &, const std::string &)=0
const std::string & name() const
void name(const std::string &n)
virtual StatusCode regAction(Io::bfcn_action_t, const Io::Action &, const std::string &d="")=0
virtual StatusCode regAction(Io::bfcn_action_t, const Io::Action &, const Io::IoTech &, const std::string &d="")=0
FileHdlr(IoTech t, bfcn_open_t o, bfcn_close_t c, bfcn_reopen_t r)
virtual StatusCode getHandler(const std::string &, Io::FileHdlr &) const =0
IoFlags operator|(const IoFlags &fa) const
FileAttr(Fd f, std::string n, std::string d, IoTech t, IoFlags fa, void *p, bool o, bool s=false)
bfcn_reopen_t b_reopen_fcn
virtual int getFiles(const Io::IoTech &, std::vector< const Io::FileAttr * > &FILES, bool onlyOpen=true) const =0
virtual StatusCode getFileAttr(void *, const Io::FileAttr *&) const =0
virtual int getFiles(std::vector< const Io::FileAttr * > &FILES, bool onlyOpen=true) const =0
IoFlags IoFlagFromName(const std::string &f)
std::function< Io::close_t(void *)> bfcn_closeP_t
virtual const std::string & fname(const Io::Fd &) const =0
virtual StatusCode regHandler(Io::FileHdlr)=0
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &, const std::string &desc, const bool shared=false)=0
virtual Io::Fd fd(const std::string &) const =0
void desc(const std::string &d)
bfcn_reopenP_t b_reopenP_fcn
virtual int getFiles(const Io::IoTech &, const Io::IoFlags &, std::vector< const Io::FileAttr * > &FILES, bool onlyOpen=true) const =0
virtual int getFileAttr(const std::string &, std::vector< const Io::FileAttr * > &) const =0
virtual int getLastError(std::string &) const =0
virtual int getFd(const Io::IoTech &, std::vector< Io::Fd > &) const =0
#define FILEMGR_CALLBACK_ARGS
virtual void suppressAction(const std::string &, const Io::Action &)=0
virtual StatusCode getHandler(const Io::IoTech &, Io::FileHdlr &) const =0
const std::string & desc() const
void flags(const IoFlags &f)
void tech(const IoTech &t)
virtual Io::Fd fd(void *fptr) const =0
std::function< StatusCode(FILEMGR_CALLBACK_ARGS)> bfcn_action_t
virtual int getFd(std::vector< Io::Fd > &) const =0
virtual Io::close_t close(void *, const std::string &caller)=0
virtual Io::close_t close(const Io::Fd, const std::string &caller)=0
virtual StatusCode hasHandler(const Io::IoTech &) const =0
bool operator<(const FileAttr &rhs) const
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, void *&, const std::string &desc, const bool shared=false)=0
FileHdlr(IoTech t, bfcn_open_t o, bfcn_close_t c1, bfcn_closeP_t c2, bfcn_reopen_t r1, bfcn_reopenP_t r2)
virtual void * fptr(const Io::Fd &) const =0
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &, void *&, const std::string &desc, const bool shared=false)=0
std::function< Io::close_t(Io::Fd)> bfcn_close_t
std::function< Io::reopen_t(Io::Fd, Io::IoFlags)> bfcn_reopen_t
IoFlags operator|(const unsigned &fa) const
virtual void * fptr(const std::string &) const =0