All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FileMgr Class Reference

#include <src/FileMgr/FileMgr.h>

Inheritance diagram for FileMgr:
Collaboration diagram for FileMgr:

Public Member Functions

 FileMgr (const std::string &name, ISvcLocator *svc)
 
virtual ~FileMgr ()
 
virtual StatusCode initialize ()
 Initialization (from CONFIGURED to INITIALIZED). More...
 
virtual StatusCode finalize ()
 Finalize (from INITIALIZED to CONFIGURED). More...
 
virtual void handle (const Incident &)
 Inform that a new incident has occurred. More...
 
virtual StatusCode regHandler (FileHdlr)
 
virtual StatusCode hasHandler (const IoTech &) const
 
virtual StatusCode deregHandler (const IoTech &)
 
virtual StatusCode getHandler (const IoTech &, FileHdlr &) const
 
virtual StatusCode getHandler (const std::string &, FileHdlr &) const
 
virtual int getFileAttr (const std::string &, std::vector< const FileAttr * > &) const
 
virtual StatusCode getFileAttr (const Fd, const FileAttr *&) const
 
virtual StatusCode getFileAttr (void *, const FileAttr *&) const
 
virtual void listHandlers () const
 
virtual void listFiles () const
 
virtual void listActions () const
 
virtual void listSuppression () const
 
virtual int getFiles (std::vector< std::string > &, bool onlyOpen=true) const
 
virtual int getFiles (std::vector< const Io::FileAttr * > &, bool onlyOpen=true) const
 
virtual int getFiles (const Io::IoTech &, std::vector< std::string > &, bool onlyOpen=true) const
 
virtual int getFiles (const Io::IoTech &, std::vector< const Io::FileAttr * > &, bool onlyOpen=true) const
 
virtual int getFiles (const Io::IoTech &, const Io::IoFlags &, std::vector< std::string > &, bool onlyOpen=true) const
 
virtual int getFiles (const Io::IoTech &, const Io::IoFlags &, std::vector< const Io::FileAttr * > &, bool onlyOpen=true) const
 
virtual int getFd (std::vector< Fd > &) const
 
virtual int getFd (const Io::IoTech &, std::vector< Io::Fd > &) const
 
virtual int getFd (const Io::IoTech &, const Io::IoFlags &, std::vector< Io::Fd > &) const
 
virtual const std::string & fname (const Io::Fd &) const
 
virtual const std::string & fname (void *) const
 
virtual Io::Fd fd (const std::string &) const
 
virtual Io::Fd fd (void *) const
 
virtual void * fptr (const std::string &) const
 
virtual void * fptr (const Io::Fd &) const
 
virtual int getLastError (std::string &) const
 
virtual Io::open_t open (const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &fd, void *&ptr, const std::string &desc="", const bool shared=false)
 
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)
 
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)
 
virtual Io::close_t close (const Fd, const std::string &caller)
 
virtual Io::close_t close (void *, const std::string &caller)
 
virtual Io::reopen_t reopen (const Fd, const IoFlags &, const std::string &caller)
 
virtual Io::reopen_t reopen (void *, const IoFlags &, const std::string &caller)
 
virtual StatusCode regAction (Io::bfcn_action_t, const Io::Action &, const std::string &desc="")
 
virtual StatusCode regAction (Io::bfcn_action_t, const Io::Action &, const Io::IoTech &, const std::string &desc="")
 
virtual void suppressAction (const std::string &)
 
virtual void suppressAction (const std::string &, const Io::Action &)
 
- Public Member Functions inherited from extends2< Service, IFileMgr, IIncidentListener >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends2 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends2 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces2< IFileMgr, IIncidentListener >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IFileMgr
virtual ~IFileMgr ()
 
 DeclareInterfaceID (IFileMgr, 1, 0)
 
virtual StatusCode deregHandler (const Io::IoTech &)=0
 
virtual StatusCode hasHandler (const Io::IoTech &) const =0
 
virtual StatusCode getHandler (const Io::IoTech &, Io::FileHdlr &) const =0
 
virtual StatusCode getFileAttr (const Io::Fd, const Io::FileAttr *&) const =0
 
virtual int getFd (std::vector< Io::Fd > &) const =0
 
virtual Io::close_t close (const Io::Fd, const std::string &caller)=0
 
virtual Io::reopen_t reopen (const Io::Fd, const Io::IoFlags &, const std::string &)=0
 
- Public Member Functions inherited from IIncidentListener
 DeclareInterfaceID (IIncidentListener, 2, 0)
 InterfaceID. More...
 

Private Types

typedef std::pair
< Io::bfcn_action_t,
std::string > 
bfcn_desc_t
 
typedef std::map< Io::Action,
std::list< bfcn_desc_t > > 
actionMap
 
typedef std::multimap
< std::string, FileAttr * > 
fileMap
 
typedef std::list< FileAttr * > fileList
 
typedef std::map< std::string,
int > 
supMap
 

Private Member Functions

virtual Io::open_t open (const IoTech &, const std::string &caller, const std::string &fname, const std::string &desc, const IoFlags &, Fd &, void *&, const bool shared)
 
StatusCode execAction (Io::FileAttr *, const std::string &, const Io::Action &) const
 
StatusCode execActs (Io::FileAttr *, const std::string &, const Io::Action &, const actionMap &m) const
 
bool accessMatch (const Io::IoFlags &, const Io::IoFlags &, bool strict=false) const
 
bool isShareable (const std::string &filename, const Io::IoFlags &) const
 

Private Attributes

StringProperty m_logfile
 
BooleanProperty m_printSummary
 
BooleanProperty m_loadRootHandler
 
BooleanProperty m_loadPosixHandler
 
StringProperty m_ssl_proxy
 
StringProperty m_ssl_cert
 
fileMap m_files
 
std::map< IoTech, FileHdlrm_handlers
 
std::map< Fd, FileAttr * > m_descriptors
 
std::map< void *, FileAttr * > m_fptr
 
std::vector< FileAttr * > m_attr
 
fileList m_oldFiles
 
std::map< IoTech, actionMapm_actions
 
supMap m_supMap
 
std::string m_lastErrS
 
int m_lastErr
 
RootFileHandlerm_rfh
 
POSIXFileHandlerm_pfh
 
MsgStream m_log
 

Additional Inherited Members

- Public Types inherited from extends2< Service, IFileMgr, IIncidentListener >
typedef extends2 base_class
 Typedef to this class. More...
 
typedef extend_interfaces2
< IFileMgr, IIncidentListener
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces2< IFileMgr, IIncidentListener >
typedef mpl::fold< typename
IFileMgr::iid::iids::type,
typename
IIncidentListener::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Detailed Description

Definition at line 32 of file FileMgr.h.

Member Typedef Documentation

typedef std::map<Io::Action, std::list<bfcn_desc_t> > FileMgr::actionMap
private

Definition at line 145 of file FileMgr.h.

typedef std::pair<Io::bfcn_action_t,std::string> FileMgr::bfcn_desc_t
private

Definition at line 144 of file FileMgr.h.

typedef std::list<FileAttr*> FileMgr::fileList
private

Definition at line 163 of file FileMgr.h.

typedef std::multimap<std::string, FileAttr*> FileMgr::fileMap
private

Definition at line 155 of file FileMgr.h.

typedef std::map<std::string, int> FileMgr::supMap
private

Definition at line 168 of file FileMgr.h.

Constructor & Destructor Documentation

FileMgr::FileMgr ( const std::string &  name,
ISvcLocator svc 
)

Definition at line 38 of file FileMgr.cpp.

39  : base_class( name, svc ),m_rfh(0), m_pfh(0),
40  m_log(msgSvc(), name )
41  {
42 
43  declareProperty("LogFile",m_logfile="");
44  declareProperty("PrintSummary",m_printSummary=false);
45  declareProperty("LoadROOTHandler", m_loadRootHandler=true);
46  declareProperty("LoadPOSIXHandler", m_loadPosixHandler=true);
47 
48  declareProperty("TSSL_UserProxy", m_ssl_proxy="X509");
49  declareProperty("TSSL_CertDir", m_ssl_cert="X509");
50 
51  m_lastErrS = "";
52 
53 }
StringProperty m_logfile
Definition: FileMgr.h:135
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
extends2 base_class
Typedef to this class.
Definition: extends.h:77
MsgStream m_log
Definition: FileMgr.h:176
BooleanProperty m_printSummary
Definition: FileMgr.h:136
std::string m_lastErrS
Definition: FileMgr.h:171
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
RootFileHandler * m_rfh
Definition: FileMgr.h:174
BooleanProperty m_loadRootHandler
Definition: FileMgr.h:136
POSIXFileHandler * m_pfh
Definition: FileMgr.h:175
BooleanProperty m_loadPosixHandler
Definition: FileMgr.h:136
StringProperty m_ssl_cert
Definition: FileMgr.h:137
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
StringProperty m_ssl_proxy
Definition: FileMgr.h:137
FileMgr::~FileMgr ( )
virtual

Definition at line 57 of file FileMgr.cpp.

57  {
58 
59 }

Member Function Documentation

bool FileMgr::accessMatch ( const Io::IoFlags fold,
const Io::IoFlags fnew,
bool  strict = false 
) const
private

Definition at line 1679 of file FileMgr.cpp.

1680  {
1681 
1682  ON_VERBOSE
1683  m_log << MSG::VERBOSE << "accessMatch old: " << fold
1684  << " new: " << fnew
1685  << endmsg;
1686 
1687 
1688  if ( ((fold == Io::READ) && (fnew == Io::READ)) ||
1689  ((fold & Io::WRITE) != 0 && (fnew & Io::WRITE) != 0) ||
1690  ((fold & Io::RDWR) != 0 && (fnew & Io::RDWR) != 0) ) {
1691  return true;
1692  } else {
1693  return false;
1694  }
1695 
1696 }
MsgStream m_log
Definition: FileMgr.h:176
#define ON_VERBOSE
Definition: FileMgr.cpp:15
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual Io::close_t FileMgr::close ( const Fd  ,
const std::string &  caller 
)
virtual
close_t FileMgr::close ( void *  vp,
const std::string &  caller 
)
virtual

Implements IFileMgr.

Definition at line 668 of file FileMgr.cpp.

668  {
669 
670  // return codes:
671  // < 0 : error condition
672  // 0 : actual close of one file
673  // > 0 : shared file, removed from list, no actual close, returns
674  // number of shared files still open.
675 
676  ON_VERBOSE
677  m_log << MSG::VERBOSE << "close(" << vp << ")"
678  << endmsg;
679 
680  close_t r = -1;
681 
682  fileMap::iterator itr;
683  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
684  if (itr->second->fptr() == vp) {
685  break;
686  }
687  }
688 
689  if (itr == m_files.end()) {
690  m_log << MSG::ERROR << "unknown file ptr \"" << vp
691  << "\" when calling close()"
692  << endmsg;
693  return r;
694  }
695 
696  IoTech tech = itr->second->tech();
697 
698  FileHdlr fh;
699 
700  if (getHandler(tech,fh).isFailure()) {
701  return r;
702  }
703  if (fh.b_closeP_fcn.empty()) {
704  m_log << MSG::ERROR << "no close(" << tech << ",void*) function registered"
705  << endmsg;
706  return -1;
707  }
708 
709  FileAttr *fa = itr->second;
710 
711  // find how many times this file is open
712  pair<fileMap::const_iterator, fileMap::const_iterator> fitr =
713  m_files.equal_range(fa->name());
714 
715  int i(0);
716  for (fileMap::const_iterator it=fitr.first; it != fitr.second; ++it) {
717  if (it->second->fptr() == vp) {
718  i++;
719  }
720  }
721 
722  ON_VERBOSE
723  m_log << MSG::VERBOSE << " ref count: " << i
724  << endmsg;
725 
726  if (i > 1 && fa->isShared()) {
727  // file open multiple times in shared access. don't do the actual close
728  ON_DEBUG
729  m_log << MSG::DEBUG << "closing file " << fa->name() << " opened "
730  << i << " times with fptr " << vp << endmsg;
731  m_files.erase(itr);
732 
733  r = i-1;
734 
735  } else if (i == 1 || (i>1 && !fa->isShared()) ) {
736  ON_DEBUG
737  m_log << MSG::DEBUG << "closing: " << *fa << endmsg;
738 
739  try {
740  r = fh.b_closeP_fcn(vp);
741  } catch (const boost::bad_function_call& err) {
742  m_log << MSG::ERROR << "when calling close handler for " << tech
743  << " on file " << fa->name()
744  << " caught " << err.what() << endmsg;
745  execAction(fa, caller, CLOSE_ERR ).ignore();
746  return -1;
747  } catch (...) {
748  m_log << MSG::ERROR << "when calling close handler for " << tech
749  << " on file " << fa->name()
750  << " caught an unknown exception." << endmsg;
751  execAction(fa, caller, CLOSE_ERR ).ignore();
752  return -1;
753  }
754 
755  if (r < 0) {
757  << "close of file with ptr \"" << vp
758  << "\", name: \"" << fa->name()
759  << "\", tech: \"" << tech << "\" failed"
760  << endmsg;
761 
762  return r;
763  }
764 
765  m_files.erase(itr);
766 
767  } else {
768  // this should never happen!
769  m_log << MSG::ERROR
770  << "ref count: " << i << " < 0 when closing " << fa
771  << ". This should never happen"
772  << endmsg;
773  return -1;
774 
775  }
776 
777  fa->fd(-1);
778  fa->flags(INVALID);
779  fa->isOpen(false);
780  fa->fptr(0);
781  m_oldFiles.push_back( fa );
782 
783 
784  // exec all callbacks
785  if (execAction(fa, caller, CLOSE).isFailure()) {
787  << "at least one close callback action failed"
788  << endmsg;
789  }
790 
791  return r;
792 
793 }
IoTech
Definition: IFileMgr.h:170
MsgStream m_log
Definition: FileMgr.h:176
void * fptr() const
Definition: IFileMgr.h:215
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
bool isOpen() const
Definition: IFileMgr.h:216
StatusCode execAction(Io::FileAttr *, const std::string &, const Io::Action &) const
Definition: FileMgr.cpp:1588
virtual StatusCode getHandler(const IoTech &, FileHdlr &) const
Fd fd() const
Definition: IFileMgr.h:209
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
const std::string & name() const
Definition: IFileMgr.h:210
bool isShared() const
Definition: IFileMgr.h:217
bfcn_closeP_t b_closeP_fcn
Definition: IFileMgr.h:294
#define ON_DEBUG
Definition: FileMgr.cpp:14
void ignore() const
Definition: StatusCode.h:94
list i
Definition: ana.py:128
IoFlags flags() const
Definition: IFileMgr.h:213
#define ON_VERBOSE
Definition: FileMgr.cpp:15
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int close_t
Definition: IFileMgr.h:279
StatusCode FileMgr::deregHandler ( const IoTech )
virtual

Definition at line 284 of file FileMgr.cpp.

284  {
285  FileHdlr hdlr;
286 
287  map<IoTech,FileHdlr>::iterator itr = m_handlers.find(tech);
288  if (itr == m_handlers.end()) {
289  m_log << MSG::ERROR << "Can't de-register tech " << tech
290  << " as it hasn't been registered!"
291  << endmsg;
292  return StatusCode::FAILURE;
293  } else {
294  m_handlers.erase(itr);
295  }
296 
297  return StatusCode::SUCCESS;
298 
299 }
MsgStream m_log
Definition: FileMgr.h:176
std::map< IoTech, FileHdlr > m_handlers
Definition: FileMgr.h:158
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode FileMgr::execAction ( Io::FileAttr fa,
const std::string &  caller,
const Io::Action a 
) const
private

Definition at line 1588 of file FileMgr.cpp.

1589  {
1590 
1591  Io::IoTech tech = fa->tech();
1592 
1593  StatusCode s1,s2;
1594 
1595  std::map<IoTech, actionMap>::const_iterator itr;
1596  itr = m_actions.find(Io::UNKNOWN);
1597 
1598  if (itr != m_actions.end() && itr->second.size() != 0) {
1599  const actionMap &m = itr->second;
1600  s1 = execActs(fa, caller, a, m);
1601  }
1602 
1603  itr = m_actions.find(tech);
1604  if (itr != m_actions.end() && itr->second.size() != 0) {
1605  const actionMap &m = itr->second;
1606  s2 = execActs(fa, caller, a, m);
1607  }
1608 
1609  if (s1.isFailure() || s2.isFailure()) {
1610  return StatusCode::FAILURE;
1611  } else {
1612  return StatusCode::SUCCESS;
1613  }
1614 
1615 }
IoTech
Definition: IFileMgr.h:170
std::map< Io::Action, std::list< bfcn_desc_t > > actionMap
Definition: FileMgr.h:145
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
StatusCode execActs(Io::FileAttr *, const std::string &, const Io::Action &, const actionMap &m) const
Definition: FileMgr.cpp:1620
string s1
Definition: ana.py:142
IoTech tech() const
Definition: IFileMgr.h:212
string s2
Definition: ana.py:143
std::map< IoTech, actionMap > m_actions
Definition: FileMgr.h:166
StatusCode FileMgr::execActs ( Io::FileAttr fa,
const std::string &  caller,
const Io::Action a,
const actionMap m 
) const
private

Definition at line 1620 of file FileMgr.cpp.

1621  {
1622 
1623  actionMap::const_iterator mitr = m.find(a);
1624 
1625  if (mitr == m.end() || mitr->second.size() == 0) {
1626  return StatusCode::SUCCESS;
1627  }
1628 
1629  ON_DEBUG
1630  m_log << MSG::DEBUG
1631  << "executing " << mitr->second.size() << " " << a
1632  << " actions on "
1633  << *fa << " from "
1634  << caller
1635  << endmsg;
1636 
1637 
1638  bool fail(false);
1639 
1640  supMap::const_iterator it2 = m_supMap.find(fa->name());
1641  if (it2 != m_supMap.end()) {
1642  if (get_bit(it2->second,a) || get_bit(it2->second,Io::INVALID_ACTION)) {
1643  ON_DEBUG
1644  m_log << MSG::DEBUG << " --> suppressing callback action for "
1645  << a
1646  << endmsg;
1647  return StatusCode::SUCCESS;
1648  }
1649  }
1650 
1651  for (list<bfcn_desc_t>::const_iterator itr = mitr->second.begin();
1652  itr != mitr->second.end(); ++itr) {
1653 
1654  ON_DEBUG
1655  m_log << MSG::DEBUG << "executing "
1656  << itr->second << endmsg;
1657 
1658  if ( (((itr->first))(fa,caller)).isFailure() ) {
1659  m_log << MSG::WARNING << "execution of "
1660  << itr->second << " on " << *fa
1661  << " failed during " << a << " action"
1662  << endmsg;
1663  fail = true;
1664  }
1665 
1666  }
1667 
1668  if (fail) {
1669  return StatusCode::FAILURE;
1670  } else {
1671  return StatusCode::SUCCESS;
1672  }
1673 
1674 }
MsgStream m_log
Definition: FileMgr.h:176
supMap m_supMap
Definition: FileMgr.h:169
const std::string & name() const
Definition: IFileMgr.h:210
bool get_bit(const int &f, const unsigned int &b)
Definition: FileMgr.cpp:31
#define ON_DEBUG
Definition: FileMgr.cpp:14
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Io::Fd FileMgr::fd ( const std::string &  fname) const
virtual

Implements IFileMgr.

Definition at line 1327 of file FileMgr.cpp.

1327  {
1328 
1329  pair<fileMap::const_iterator,fileMap::const_iterator> fitr =
1330  m_files.equal_range(fname);
1331 
1332  fileMap::const_iterator itr;
1333  for (itr=fitr.first; itr != fitr.second; ++itr) {
1334  if (itr->second->fd() != -1) {
1335  return itr->second->fd();
1336  }
1337  }
1338 
1339  return -1;
1340 
1341 }
fileMap m_files
Definition: FileMgr.h:157
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
Io::Fd FileMgr::fd ( void *  fptr) const
virtual

Implements IFileMgr.

Definition at line 1346 of file FileMgr.cpp.

1346  {
1347 
1348  fileMap::const_iterator itr;
1349  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
1350  if (itr->second->fptr() == fptr) {
1351  return itr->second->fd();
1352  }
1353  }
1354 
1355  return -1;
1356 
1357 }
fileMap m_files
Definition: FileMgr.h:157
virtual void * fptr(const std::string &) const
Definition: FileMgr.cpp:1362
StatusCode FileMgr::finalize ( )
virtual

Finalize (from INITIALIZED to CONFIGURED).

Reimplemented from Service.

Definition at line 145 of file FileMgr.cpp.

145  {
146  ON_VERBOSE
147  m_log << MSG::VERBOSE << "FileMgr::finalize()" << endmsg;
148 
149 
150  if (m_printSummary || outputLevel() <= MSG::DEBUG) {
151  listHandlers();
152  listFiles();
153  listActions();
154  listSuppression();
155  }
156 
157 
158  if (m_files.size() > 0) {
159  m_log << MSG::WARNING
160  << "At finalize, the following files remained open:"
161  << endl;
162  map<string,FileAttr*>::const_iterator itr;
163  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
164  m_log << *(itr->second) << endl;
165  }
166  m_log << endmsg;
167  }
168 
169 
170 
171  if (m_logfile.value() != "") {
172  std::ofstream ofs;
173  ofs.open(m_logfile.value().c_str());
174  if (!ofs) {
175  m_log << MSG::ERROR << "Unable to open output file \"" << m_logfile.value()
176  << "\" for writing"
177  << endmsg;
178  } else {
179  ON_DEBUG
180  m_log << MSG::DEBUG << "Saving log to \"" << m_logfile.value() << "\""
181  << endmsg;
182  fileMap::const_iterator itr;
183  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
184  ofs << itr->second->name() << " " << itr->second->tech() << " "
185  << itr->second->desc() << " " << itr->second->iflags() << endl;
186  }
187 
188  set<FileAttr> fs;
189  set<FileAttr>::const_iterator it3;
190  list<FileAttr*>::const_iterator it2;
191  for (it2=m_oldFiles.begin(); it2 != m_oldFiles.end(); ++it2) {
192  fs.insert(**it2);
193  }
194 
195  for (it3=fs.begin(); it3!=fs.end(); ++it3) {
196  ofs << (it3)->name() << " " << (it3)->tech() << " " << (it3)->desc()
197  << " " << (it3)->iflags()
198  << ( (it3->isShared()) ? " SHARED" : "" )
199  << endl;
200  }
201 
202  ofs.close();
203  }
204  }
205 
206  // cleanup FileAttrs
207  for (vector<FileAttr*>::iterator itr = m_attr.begin(); itr != m_attr.end();
208  ++itr) {
209  delete(*itr);
210  }
211  m_attr.clear();
212 
213  delete m_rfh;
214  delete m_pfh;
215 
216 
217  StatusCode status = Service::finalize();
218 
219  ON_DEBUG
220  if ( status.isSuccess() )
221  m_log << MSG::DEBUG << "Service finalised successfully" << endmsg;
222 
223  return status;
224 
225 }
StringProperty m_logfile
Definition: FileMgr.h:135
virtual void listFiles() const
Definition: FileMgr.cpp:1396
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
MsgStream m_log
Definition: FileMgr.h:176
fileMap m_files
Definition: FileMgr.h:157
int outputLevel() const
get the Service's output level
Definition: Service.h:250
fileList m_oldFiles
Definition: FileMgr.h:164
virtual void listActions() const
Definition: FileMgr.cpp:1541
std::vector< FileAttr * > m_attr
Definition: FileMgr.h:161
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
BooleanProperty m_printSummary
Definition: FileMgr.h:136
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
RootFileHandler * m_rfh
Definition: FileMgr.h:174
POSIXFileHandler * m_pfh
Definition: FileMgr.h:175
virtual void listSuppression() const
Definition: FileMgr.cpp:1726
#define ON_DEBUG
Definition: FileMgr.cpp:14
#define ON_VERBOSE
Definition: FileMgr.cpp:15
virtual void listHandlers() const
Definition: FileMgr.cpp:1481
virtual StatusCode finalize()
Finalize (from INITIALIZED to CONFIGURED).
Definition: Service.cpp:199
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
const std::string & FileMgr::fname ( const Io::Fd fd) const
virtual

Implements IFileMgr.

Definition at line 1293 of file FileMgr.cpp.

1293  {
1294 
1295  fileMap::const_iterator itr;
1296  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
1297  if (itr->second->fd() == fd) {
1298  return itr->second->name();
1299  }
1300  }
1301 
1302  static const std::string s_empty = "";
1303  return s_empty;
1304 
1305 }
fileMap m_files
Definition: FileMgr.h:157
virtual Io::Fd fd(const std::string &) const
Definition: FileMgr.cpp:1327
const std::string & FileMgr::fname ( void *  vp) const
virtual

Implements IFileMgr.

Definition at line 1310 of file FileMgr.cpp.

1310  {
1311 
1312  fileMap::const_iterator itr;
1313  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
1314  if (itr->second->fptr() == vp) {
1315  return itr->second->name();
1316  }
1317  }
1318 
1319  static const std::string s_empty = "";
1320  return s_empty;
1321 
1322 }
fileMap m_files
Definition: FileMgr.h:157
void * FileMgr::fptr ( const std::string &  fname) const
virtual

Implements IFileMgr.

Definition at line 1362 of file FileMgr.cpp.

1362  {
1363  pair<fileMap::const_iterator,fileMap::const_iterator> fitr =
1364  m_files.equal_range(fname);
1365 
1366  fileMap::const_iterator itr;
1367  for (itr=fitr.first; itr != fitr.second; ++itr) {
1368  if (itr->second->fptr() != 0) {
1369  return itr->second->fptr();
1370  }
1371  }
1372 
1373  return 0;
1374 
1375 }
fileMap m_files
Definition: FileMgr.h:157
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
void * FileMgr::fptr ( const Io::Fd fd) const
virtual

Implements IFileMgr.

Definition at line 1380 of file FileMgr.cpp.

1380  {
1381 
1382  fileMap::const_iterator itr;
1383  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
1384  if (itr->second->fd() == fd) {
1385  return itr->second->fptr();
1386  }
1387  }
1388 
1389  return 0;
1390 
1391 }
fileMap m_files
Definition: FileMgr.h:157
virtual Io::Fd fd(const std::string &) const
Definition: FileMgr.cpp:1327
virtual int FileMgr::getFd ( std::vector< Fd > &  ) const
virtual
int FileMgr::getFd ( const Io::IoTech tech,
std::vector< Io::Fd > &  fd 
) const
virtual

Implements IFileMgr.

Definition at line 1251 of file FileMgr.cpp.

1251  {
1252 
1253  if (tech == UNKNOWN) {
1254  return getFd( fd );
1255  }
1256 
1257  fd.clear();
1258  map<Fd,FileAttr*>::const_iterator itr;
1259  for (itr=m_descriptors.begin(); itr != m_descriptors.end(); ++itr) {
1260  if (itr->second->tech() == tech) {
1261  fd.push_back(itr->first);
1262  }
1263  }
1264 
1265  return fd.size();
1266 
1267 }
std::map< Fd, FileAttr * > m_descriptors
Definition: FileMgr.h:159
virtual int getFd(std::vector< Fd > &) const
int FileMgr::getFd ( const Io::IoTech tech,
const Io::IoFlags flags,
std::vector< Io::Fd > &  fd 
) const
virtual

Implements IFileMgr.

Definition at line 1274 of file FileMgr.cpp.

1274  {
1275 
1276  fd.clear();
1277  map<Fd,FileAttr*>::const_iterator itr;
1278  for (itr=m_descriptors.begin(); itr != m_descriptors.end(); ++itr) {
1279  if (itr->second->tech() == tech || tech == UNKNOWN) {
1280  if ( itr->second->flags() == flags ) {
1281  fd.push_back(itr->first);
1282  }
1283  }
1284  }
1285 
1286  return fd.size();
1287 
1288 }
std::map< Fd, FileAttr * > m_descriptors
Definition: FileMgr.h:159
int FileMgr::getFileAttr ( const std::string &  fname,
std::vector< const FileAttr * > &  fa 
) const
virtual

Implements IFileMgr.

Definition at line 973 of file FileMgr.cpp.

973  {
974 
975  fa.clear();
976  pair<fileMap::const_iterator,fileMap::const_iterator> fitr =
977  m_files.equal_range(fname);
978 
979  fileMap::const_iterator itr;
980  for (itr=fitr.first; itr != fitr.second; ++itr) {
981  fa.push_back( (itr->second) );
982  }
983 
984  fileList::const_iterator it2;
985  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
986  if ( (*it2)->name() == fname ) {
987  fa.push_back( *it2 );
988  }
989  }
990 
991  return fa.size();
992 
993 
994 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
virtual StatusCode FileMgr::getFileAttr ( const Fd  ,
const FileAttr *&   
) const
virtual
StatusCode FileMgr::getFileAttr ( void *  vp,
const FileAttr *&  fa 
) const
virtual

Implements IFileMgr.

Definition at line 1024 of file FileMgr.cpp.

1024  {
1025 
1026  fileMap::const_iterator itr;
1027  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
1028  if (itr->second->fptr() == vp) {
1029  fa = (itr->second);
1030  return StatusCode::SUCCESS;
1031  }
1032  }
1033 
1034  fileList::const_iterator it2;
1035  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1036  if ( (*it2)->fptr() == vp ) {
1037  fa = *it2;
1038  return StatusCode::SUCCESS;
1039  }
1040  }
1041 
1042  return StatusCode::FAILURE;
1043 
1044 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
int FileMgr::getFiles ( std::vector< std::string > &  files,
bool  onlyOpen = true 
) const
virtual

Implements IFileMgr.

Definition at line 1049 of file FileMgr.cpp.

1049  {
1050 
1051  files.clear();
1052 
1053  map<string,FileAttr*>::const_iterator itr;
1054  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1055  if (find( files.begin(), files.end(), itr->first) == files.end()) {
1056  files.push_back(itr->first);
1057  }
1058  }
1059 
1060  if (!op) {
1061  std::list<FileAttr*>::const_iterator it2;
1062  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1063  if (find(files.begin(), files.end(), (*it2)->name()) == files.end()) {
1064  files.push_back( (*it2)->name());
1065  }
1066  }
1067  }
1068 
1069  return files.size();
1070 
1071 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
int FileMgr::getFiles ( std::vector< const Io::FileAttr * > &  files,
bool  onlyOpen = true 
) const
virtual

Implements IFileMgr.

Definition at line 1076 of file FileMgr.cpp.

1076  {
1077 
1078  files.clear();
1079 
1080  map<string,FileAttr*>::const_iterator itr;
1081  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1082  files.push_back( (itr->second) );
1083  }
1084 
1085  if (!op) {
1086  std::list<FileAttr*>::const_iterator it2;
1087  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1088  files.push_back( *it2 );
1089  }
1090  }
1091 
1092  return files.size();
1093 
1094 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
int FileMgr::getFiles ( const Io::IoTech tech,
std::vector< std::string > &  files,
bool  onlyOpen = true 
) const
virtual

Implements IFileMgr.

Definition at line 1099 of file FileMgr.cpp.

1099  {
1100 
1101  if (tech == UNKNOWN) {
1102  return getFiles(files,op);
1103  }
1104 
1105  files.clear();
1106 
1107  map<string,FileAttr*>::const_iterator itr;
1108  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1109  if (itr->second->tech() == tech &&
1110  find(files.begin(),files.end(),itr->first) == files.end()) {
1111  files.push_back(itr->first);
1112  }
1113  }
1114 
1115  if (!op) {
1116  std::list<FileAttr*>::const_iterator it2;
1117  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1118  if ( (*it2)->tech() == tech &&
1119  find(files.begin(), files.end(), (*it2)->name()) == files.end()) {
1120  files.push_back( (*it2)->name());
1121  }
1122  }
1123  }
1124 
1125  return files.size();
1126 
1127 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
virtual int getFiles(std::vector< std::string > &, bool onlyOpen=true) const
Definition: FileMgr.cpp:1049
int FileMgr::getFiles ( const Io::IoTech tech,
std::vector< const Io::FileAttr * > &  files,
bool  onlyOpen = true 
) const
virtual

Implements IFileMgr.

Definition at line 1132 of file FileMgr.cpp.

1133  {
1134 
1135  if (tech == UNKNOWN) {
1136  return getFiles(files,op);
1137  }
1138 
1139  files.clear();
1140 
1141  map<string,FileAttr*>::const_iterator itr;
1142  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1143  if (itr->second->tech() == tech) {
1144  files.push_back( (itr->second) );
1145  }
1146  }
1147 
1148  if (!op) {
1149  std::list<FileAttr*>::const_iterator it2;
1150  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1151  if ( (*it2)->tech() == tech) {
1152  files.push_back( *it2 );
1153  }
1154  }
1155  }
1156 
1157  return files.size();
1158 
1159 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
virtual int getFiles(std::vector< std::string > &, bool onlyOpen=true) const
Definition: FileMgr.cpp:1049
int FileMgr::getFiles ( const Io::IoTech tech,
const Io::IoFlags flags,
std::vector< std::string > &  files,
bool  onlyOpen = true 
) const
virtual

Implements IFileMgr.

Definition at line 1164 of file FileMgr.cpp.

1165  {
1166 
1167  files.clear();
1168 
1169  map<string,FileAttr*>::const_iterator itr;
1170  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1171  if (itr->second->tech() == tech || tech == UNKNOWN) {
1172  if ( itr->second->flags() == flags ) {
1173  if (find( files.begin(), files.end(), itr->first ) == files.end()) {
1174  files.push_back(itr->first);
1175  }
1176  }
1177  }
1178  }
1179 
1180  if (!op) {
1181  std::list<FileAttr*>::const_iterator it2;
1182  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1183  if ( (*it2)->tech() == tech || tech == UNKNOWN) {
1184  if ( (*it2)->flags() == flags ) {
1185  if (find(files.begin(), files.end(), (*it2)->name()) == files.end()){
1186  files.push_back( (*it2)->name());
1187  }
1188  }
1189  }
1190  }
1191  }
1192 
1193  return files.size();
1194 
1195 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
int FileMgr::getFiles ( const Io::IoTech tech,
const Io::IoFlags flags,
std::vector< const Io::FileAttr * > &  files,
bool  onlyOpen = true 
) const
virtual

Implements IFileMgr.

Definition at line 1199 of file FileMgr.cpp.

1200  {
1201 
1202  files.clear();
1203 
1204  map<string,FileAttr*>::const_iterator itr;
1205  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1206  if (itr->second->tech() == tech || tech == UNKNOWN) {
1207  if ( itr->second->flags() == flags ) {
1208  files.push_back( (itr->second) );
1209  }
1210  }
1211  }
1212 
1213  if (!op) {
1214  std::list<FileAttr*>::const_iterator it2;
1215  for (it2=m_oldFiles.begin(); it2!=m_oldFiles.end(); ++it2) {
1216  if ( (*it2)->tech() == tech || tech == UNKNOWN) {
1217  if ( (*it2)->flags() == flags ) {
1218  files.push_back( *it2);
1219  }
1220  }
1221  }
1222  }
1223 
1224  return files.size();
1225 
1226 }
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
virtual StatusCode FileMgr::getHandler ( const IoTech &  ,
FileHdlr  
) const
virtual
StatusCode FileMgr::getHandler ( const std::string &  fname,
Io::FileHdlr hdlr 
) const
virtual

Implements IFileMgr.

Definition at line 1448 of file FileMgr.cpp.

1448  {
1449 
1450  pair<fileMap::const_iterator,fileMap::const_iterator> fitr =
1451  m_files.equal_range(fname);
1452 
1453  if (fitr.first == fitr.second) {
1454  m_log << MSG::ERROR
1455  << "no file \"" << fname << "\" registered. Cannot determine tech"
1456  << endmsg;
1457  return StatusCode::FAILURE;
1458  }
1459 
1460  fileMap::const_iterator itr = fitr.first;
1461  IoTech tech = itr->second->tech();
1462 
1463  itr++;
1464  while( itr != fitr.second ) {
1465  if ( itr->second->tech() != tech ) {
1466  m_log << MSG::ERROR
1467  << "multiple technologies registered for file \"" << fname
1468  << "\". Cannot determine handler" << endmsg;
1469  return StatusCode::FAILURE;
1470  }
1471  itr++;
1472  }
1473 
1474  return getHandler(tech,hdlr);
1475 
1476 }
IoTech
Definition: IFileMgr.h:170
MsgStream m_log
Definition: FileMgr.h:176
fileMap m_files
Definition: FileMgr.h:157
virtual StatusCode getHandler(const IoTech &, FileHdlr &) const
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int FileMgr::getLastError ( std::string &  err) const
virtual

Implements IFileMgr.

Definition at line 1419 of file FileMgr.cpp.

1419  {
1420 
1421  err = m_lastErrS;
1422 
1423  return m_lastErr;
1424 
1425 }
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
std::string m_lastErrS
Definition: FileMgr.h:171
int m_lastErr
Definition: FileMgr.h:172
void FileMgr::handle ( const Incident )
virtual

Inform that a new incident has occurred.

Implements IIncidentListener.

Definition at line 230 of file FileMgr.cpp.

230  {
231 
232 }
StatusCode FileMgr::hasHandler ( const IoTech ) const
virtual

Definition at line 303 of file FileMgr.cpp.

303  {
304 
305  map<IoTech,FileHdlr>::const_iterator itr = m_handlers.find(tech);
306  if (itr != m_handlers.end()) {
307  return StatusCode::SUCCESS;
308  } else {
309  return StatusCode::FAILURE;
310  }
311 
312 }
std::map< IoTech, FileHdlr > m_handlers
Definition: FileMgr.h:158
StatusCode FileMgr::initialize ( )
virtual

Initialization (from CONFIGURED to INITIALIZED).

Reimplemented from Service.

Definition at line 64 of file FileMgr.cpp.

64  {
65 
66  // Super ugly hack to make sure we have the OutputLevel set first, so we
67  // can see DEBUG printouts in update handlers.
68  IJobOptionsSvc* jos(0);
69  if( serviceLocator()->service( "JobOptionsSvc", jos, true ).isSuccess() ) {
70  const std::vector<const Property*> *props = jos->getProperties( name() );
71 
72  if (props != NULL) {
73  for ( std::vector<const Property*>::const_iterator cur = props->begin();
74  cur != props->end(); cur++) {
75  if ( (*cur)->name() == "OutputLevel" ) {
76  setProperty( **cur ).ignore();
78  break;
79  }
80  }
81  }
82  }
83 
86 
87  if (status.isFailure()) {
88 
89  ON_DEBUG
90  m_log << MSG::DEBUG << "Failed to initialize the base class (Service)"
91  << endmsg;
92  return status;
93  }
94 
96  m_log << MSG::VERBOSE << "Initializing FileMgr" << endmsg;
97 
98  if (m_loadRootHandler.value()) {
99 
100  // setup file handler for ROOT
101 
102  msgSvc()->setOutputLevel( "RootFileHandler", m_outputLevel.value());
104 
105  Io::FileHdlr hdlr(Io::ROOT,
106  boost::bind( &RootFileHandler::openRootFile, m_rfh, _1,_2,_3,_4,_5),
108  (Io::bfcn_reopenP_t) boost::bind( &RootFileHandler::reopenRootFile, m_rfh, _1,_2) );
109 
110  if (regHandler(hdlr).isFailure()) {
111  m_log << MSG::ERROR
112  << "unable to register ROOT file handler with FileMgr"
113  << endmsg;
114  }
115  }
116 
117  if (m_loadPosixHandler.value()) {
118 
119  // setup file handler for POSIX
120 
121  msgSvc()->setOutputLevel( "POSIXFileHandler", m_outputLevel.value());
122  m_pfh = new POSIXFileHandler(msgSvc());
123 
124  Io::FileHdlr hdlp(Io::POSIX,
125  boost::bind( &POSIXFileHandler::openPOSIXFile, m_pfh, _1,_2,_3,_4,_5),
127  (Io::bfcn_reopen_t) boost::bind( &POSIXFileHandler::reopenPOSIXFile, m_pfh, _1,_2) );
128 
129  if (regHandler(hdlp).isFailure()) {
130  m_log << MSG::ERROR
131  << "unable to register ROOT file handler with FileMgr"
132  << endmsg;
133  }
134  }
135 
136 
137 
138  return StatusCode::SUCCESS;
139 
140 }
Io::close_t closePOSIXFile(Io::Fd fd)
IntegerProperty m_outputLevel
Service output level.
Definition: Service.h:243
Io::reopen_t reopenPOSIXFile(Io::Fd fd, const Io::IoFlags &)
boost::function< Io::close_t(void *)> bfcn_closeP_t
Definition: IFileMgr.h:284
virtual StatusCode setProperty(const Property &p)
Set the property by property.
Definition: Service.cpp:342
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
boost::function< Io::close_t(Io::Fd)> bfcn_close_t
Definition: IFileMgr.h:283
MsgStream m_log
Definition: FileMgr.h:176
Io::open_t openRootFile(const std::string &n, const Io::IoFlags &f, const std::string &desc, Io::Fd &fd, void *&ptr)
virtual StatusCode regHandler(FileHdlr)
Definition: FileMgr.cpp:237
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:72
Io::close_t closeRootFile(void *ptr)
Io::reopen_t reopenRootFile(void *, const Io::IoFlags &)
Main interface for the JobOptions service.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
const TYPE & value() const
explicit conversion
Definition: Property.h:355
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
Io::open_t openPOSIXFile(const std::string &n, const Io::IoFlags &f, const std::string &desc, Io::Fd &fd, void *&ptr)
RootFileHandler * m_rfh
Definition: FileMgr.h:174
BooleanProperty m_loadRootHandler
Definition: FileMgr.h:136
POSIXFileHandler * m_pfh
Definition: FileMgr.h:175
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
BooleanProperty m_loadPosixHandler
Definition: FileMgr.h:136
StringProperty m_ssl_cert
Definition: FileMgr.h:137
void setLevel(int level)
Update outputlevel.
Definition: MsgStream.h:106
boost::function< Io::reopen_t(Io::Fd, Io::IoFlags)> bfcn_reopen_t
Definition: IFileMgr.h:285
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:142
#define ON_DEBUG
Definition: FileMgr.cpp:14
void ignore() const
Definition: StatusCode.h:94
StringProperty m_ssl_proxy
Definition: FileMgr.h:137
boost::function< Io::reopen_t(void *, Io::IoFlags)> bfcn_reopenP_t
Definition: IFileMgr.h:286
#define ON_VERBOSE
Definition: FileMgr.cpp:15
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
bool FileMgr::isShareable ( const std::string &  filename,
const Io::IoFlags  
) const
private
void FileMgr::listActions ( ) const
virtual

Definition at line 1541 of file FileMgr.cpp.

1541  {
1542 
1543  m_log << MSG::INFO << "listing registered actions" << endl;
1544 
1545  actionMap::const_iterator itr;
1546 
1547  typedef StatusCode (*ptf)(const Io::FileAttr&, const std::string&);
1548 
1549  map<Io::IoTech, actionMap>::const_iterator iit;
1550  for (iit = m_actions.begin(); iit != m_actions.end(); ++iit) {
1551  Io::IoTech t = iit->first;
1552  const actionMap& m = iit->second;
1553 
1554  if (m.size() != 0) {
1555  m_log << " --- Tech: ";
1556  if (t == Io::UNKNOWN) {
1557  m_log << "ALL ---" << endl;
1558  } else {
1559  m_log << t << " ---" << endl;
1560  }
1561 
1562  actionMap::const_iterator iia;
1563  for (iia = m.begin() ; iia != m.end(); ++iia) {
1564  if (iia->second.size() != 0) {
1565  // for (list<bfcn_action_t>::const_iterator it2 = iia->second.begin();
1566  // it2 != iia->second.end(); ++it2) {
1567  for (list<bfcn_desc_t>::const_iterator it2 = iia->second.begin();
1568  it2 != iia->second.end(); ++it2) {
1569 
1570  m_log << " " << iia->first << " "
1571  << it2->second
1572  << endl;
1573  }
1574  }
1575  }
1576 
1577  }
1578  }
1579 
1580 
1581  m_log << endmsg;
1582 
1583 }
IoTech
Definition: IFileMgr.h:170
MsgStream m_log
Definition: FileMgr.h:176
std::map< Io::Action, std::list< bfcn_desc_t > > actionMap
Definition: FileMgr.h:145
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::map< IoTech, actionMap > m_actions
Definition: FileMgr.h:166
void FileMgr::listFiles ( ) const
virtual

Implements IFileMgr.

Definition at line 1396 of file FileMgr.cpp.

1396  {
1397 
1398  m_log << MSG::INFO << "listing registered files ["
1399  << (m_files.size() + m_oldFiles.size() )
1400  << "]:" << endl;
1401 
1402  fileMap::const_iterator itr;
1403  for (itr=m_files.begin(); itr != m_files.end(); ++itr) {
1404  m_log << *(itr->second) << endl;
1405  }
1406 
1407  for (list<FileAttr*>::const_iterator it2=m_oldFiles.begin();
1408  it2 != m_oldFiles.end(); ++it2) {
1409  m_log << **it2 << endl;
1410  }
1411 
1412  m_log << endmsg;
1413 
1414 }
MsgStream m_log
Definition: FileMgr.h:176
fileMap m_files
Definition: FileMgr.h:157
fileList m_oldFiles
Definition: FileMgr.h:164
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void FileMgr::listHandlers ( ) const
virtual

Implements IFileMgr.

Definition at line 1481 of file FileMgr.cpp.

1481  {
1482 
1483  m_log << MSG::INFO
1484  << "Listing registered handlers:" << endl;
1485 
1486  map<IoTech,FileHdlr>::const_iterator itr;
1487  for (itr=m_handlers.begin(); itr != m_handlers.end(); ++itr) {
1488 
1489  m_log << " " << itr->first << endl;
1490  }
1491  m_log << endmsg;
1492 
1493 }
MsgStream m_log
Definition: FileMgr.h:176
std::map< IoTech, FileHdlr > m_handlers
Definition: FileMgr.h:158
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void FileMgr::listSuppression ( ) const
virtual

Definition at line 1726 of file FileMgr.cpp.

1726  {
1727 
1728  if (m_supMap.size() == 0) return;
1729 
1730  m_log << MSG::INFO << "listing suppressed file actions" << endl;
1731 
1732  supMap::const_iterator it2;
1733  for (it2=m_supMap.begin(); it2 != m_supMap.end(); ++it2) {
1734  m_log << " " << it2->first;
1735  if (get_bit(it2->second, Io::INVALID_ACTION)) {
1736  m_log << " ALL" << endl;
1737  } else {
1738  for (int i=0; i<Io::INVALID_ACTION; ++i) {
1739  if (get_bit(it2->second,i)) { m_log << " " << (Io::Action)i; }
1740  }
1741  m_log << endl;
1742  }
1743  }
1744 
1745  m_log << endmsg;
1746 
1747 }
MsgStream m_log
Definition: FileMgr.h:176
supMap m_supMap
Definition: FileMgr.h:169
Action
Definition: IFileMgr.h:316
bool get_bit(const int &f, const unsigned int &b)
Definition: FileMgr.cpp:31
list i
Definition: ana.py:128
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
open_t FileMgr::open ( const Io::IoTech tech,
const std::string &  caller,
const std::string &  fname,
const Io::IoFlags flags,
Io::Fd fd,
void *&  ptr,
const std::string &  desc = "",
const bool  shared = false 
)
virtual

Implements IFileMgr.

Definition at line 317 of file FileMgr.cpp.

320  {
321 
322  return open(tech, caller, fname, desc, flags, fd, ptr, sh);
323 
324 }
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &fd, void *&ptr, const std::string &desc="", const bool shared=false)
Definition: FileMgr.cpp:317
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
virtual Io::Fd fd(const std::string &) const
Definition: FileMgr.cpp:1327
open_t FileMgr::open ( const Io::IoTech tech,
const std::string &  caller,
const std::string &  fname,
const Io::IoFlags flags,
Io::Fd fd,
const std::string &  desc = "",
const bool  shared = false 
)
virtual

Implements IFileMgr.

Definition at line 328 of file FileMgr.cpp.

331  {
332 
333  void* dummy(0);
334  return open(tech, caller, fname, desc, flags, fd, dummy, sh);
335 
336 }
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &fd, void *&ptr, const std::string &desc="", const bool shared=false)
Definition: FileMgr.cpp:317
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
virtual Io::Fd fd(const std::string &) const
Definition: FileMgr.cpp:1327
open_t FileMgr::open ( const Io::IoTech tech,
const std::string &  caller,
const std::string &  fname,
const Io::IoFlags flags,
void *&  ptr,
const std::string &  desc = "",
const bool  shared = false 
)
virtual

Implements IFileMgr.

Definition at line 340 of file FileMgr.cpp.

343  {
344 
345  Fd dummy(-1);
346  return open(tech, caller, fname, desc, flags, dummy, ptr, sh);
347 
348 }
virtual Io::open_t open(const Io::IoTech &, const std::string &caller, const std::string &fname, const Io::IoFlags &, Io::Fd &fd, void *&ptr, const std::string &desc="", const bool shared=false)
Definition: FileMgr.cpp:317
int Fd
Definition: IFileMgr.h:197
virtual const std::string & fname(const Io::Fd &) const
Definition: FileMgr.cpp:1293
virtual Io::open_t FileMgr::open ( const IoTech &  ,
const std::string &  caller,
const std::string &  fname,
const std::string &  desc,
const IoFlags ,
Fd &  ,
void *&  ,
const bool  shared 
)
privatevirtual
StatusCode FileMgr::regAction ( Io::bfcn_action_t  bf,
const Io::Action a,
const std::string &  desc = "" 
)
virtual

Implements IFileMgr.

Definition at line 1498 of file FileMgr.cpp.

1498  {
1499 
1500  ON_DEBUG
1501  m_log << MSG::DEBUG << "registering " << a << " action "
1502  << System::typeinfoName(bf.target_type()) << endmsg;
1503 
1504  if (d == "") {
1505  m_actions[Io::UNKNOWN][a].push_back
1506  (make_pair(bf,System::typeinfoName(bf.target_type())));
1507  } else {
1508  m_actions[Io::UNKNOWN][a].push_back(make_pair(bf,d));
1509  }
1510 
1511 
1512  return StatusCode::SUCCESS;
1513 
1514 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
MsgStream m_log
Definition: FileMgr.h:176
#define ON_DEBUG
Definition: FileMgr.cpp:14
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::map< IoTech, actionMap > m_actions
Definition: FileMgr.h:166
StatusCode FileMgr::regAction ( Io::bfcn_action_t  bf,
const Io::Action a,
const Io::IoTech t,
const std::string &  desc = "" 
)
virtual

Implements IFileMgr.

Definition at line 1519 of file FileMgr.cpp.

1520  {
1521 
1522  ON_DEBUG
1523  m_log << MSG::DEBUG << "registering " << a << " action "
1524  << System::typeinfoName(bf.target_type())
1525  << " for tech " << t << endmsg;
1526 
1527  if (d == "") {
1528  m_actions[t][a].push_back
1529  (make_pair(bf, System::typeinfoName(bf.target_type())));
1530  } else {
1531  m_actions[t][a].push_back(make_pair(bf,d));
1532  }
1533 
1534  return StatusCode::SUCCESS;
1535 
1536 }
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
MsgStream m_log
Definition: FileMgr.h:176
#define ON_DEBUG
Definition: FileMgr.cpp:14
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
std::map< IoTech, actionMap > m_actions
Definition: FileMgr.h:166
StatusCode FileMgr::regHandler ( FileHdlr  fh)
virtual

Implements IFileMgr.

Definition at line 237 of file FileMgr.cpp.

237  {
238 
239  IoTech tech = fh.tech;
240 
241  if (m_handlers.find(tech) != m_handlers.end()) {
243  << "Handler for IoTech " << tech << " already registered. Ignoring."
244  << endmsg;
245  return StatusCode::SUCCESS;
246  }
247 
248  if (fh.b_open_fcn.empty()) {
249  m_log << MSG::ERROR
250  << "open handler for tech " << tech << " is NULL"
251  << endmsg;
252  return StatusCode::FAILURE;
253  }
254 
255  if (fh.b_close_fcn.empty() && fh.b_closeP_fcn.empty()) {
256  m_log << MSG::ERROR
257  << "no close handler for tech " << tech << " registered"
258  << endmsg;
259  return StatusCode::FAILURE;
260  }
261 
262  if (fh.b_reopen_fcn.empty() && fh.b_reopenP_fcn.empty()) {
263  m_log << MSG::ERROR
264  << "no reopen handler for tech " << tech << " registered"
265  << endmsg;
266  return StatusCode::FAILURE;
267  }
268 
269 
270  ON_DEBUG
271  m_log << MSG::DEBUG
272  << "Successfully registered handler for tech \"" << tech << "\""
273  << endmsg;
274 
275  m_handlers[tech] = fh;
276 
277  return StatusCode::SUCCESS;
278 
279 }
IoTech
Definition: IFileMgr.h:170
bfcn_reopen_t b_reopen_fcn
Definition: IFileMgr.h:295
MsgStream m_log
Definition: FileMgr.h:176
std::map< IoTech, FileHdlr > m_handlers
Definition: FileMgr.h:158
bfcn_close_t b_close_fcn
Definition: IFileMgr.h:293
bfcn_closeP_t b_closeP_fcn
Definition: IFileMgr.h:294
bfcn_reopenP_t b_reopenP_fcn
Definition: IFileMgr.h:296
bfcn_open_t b_open_fcn
Definition: IFileMgr.h:292
#define ON_DEBUG
Definition: FileMgr.cpp:14
IoTech tech
Definition: IFileMgr.h:290
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual Io::reopen_t FileMgr::reopen ( const Fd  ,
const IoFlags ,
const std::string &  caller 
)
virtual
reopen_t FileMgr::reopen ( void *  vp,
const IoFlags flags,
const std::string &  caller 
)
virtual

Implements IFileMgr.

Definition at line 889 of file FileMgr.cpp.

889  {
890  ON_VERBOSE
891  m_log << MSG::VERBOSE << "reopen(" << vp << "," << flags
892  << "," << caller << ")"
893  << endmsg;
894 
895  reopen_t r = -1;
896 
897  fileMap::iterator itr;
898  for (itr = m_files.begin(); itr != m_files.end(); ++itr) {
899  if (itr->second->fptr() == vp) {
900  break;
901  }
902  }
903 
904  if (itr == m_files.end()) {
905  m_log << MSG::ERROR
906  << "unregistered file ptr \"" << vp
907  << "\" when calling reopen()"
908  << endmsg;
909  return r;
910  }
911 
912  FileAttr *fa = itr->second;
913  FileHdlr fh;
914  IoTech tech = fa->tech();
915 
916  if (getHandler(tech,fh).isFailure()) {
917  return r;
918  }
919 
920  if (fh.b_reopenP_fcn.empty()) {
921  m_log << MSG::ERROR << "no reopen(" << tech << ",void*) function registered"
922  << endmsg;
923  return -1;
924  }
925 
926  try {
927  r = fh.b_reopenP_fcn(vp,flags);
928  } catch (const boost::bad_function_call& err) {
929  m_log << MSG::ERROR << "when calling reopen handler for " << tech
930  << " on file " << fa->name() << " with flags "
931  << flags
932  << " caught " << err.what() << endmsg;
933  return -1;
934  } catch (...) {
935  m_log << MSG::ERROR << "when calling reopen handler for " << tech
936  << " on file " << fa->name() << " with flags "
937  << flags
938  << " caught an unknown exception." << endmsg;
939  return -1;
940  }
941 
942  if (r < 0) {
944  << "reopen of file with ptr \"" << vp
945  << "\", name: \"" << fa->name()
946  << "\", tech: \"" << tech
947  << "\", flags: \"" << flags << "\" failed"
948  << endmsg;
949 
950  execAction(fa, caller, Io::REOPEN_ERR ).ignore();
951 
952  return r;
953 
954  }
955 
956  fa->isOpen(true);
957  fa->flags(flags);
958 
959  // exec all callbacks
960  if (execAction(fa, caller, Io::REOPEN).isFailure()) {
962  << "at least one reopen callback action failed"
963  << endmsg;
964  }
965 
966  return r;
967 
968 }
IoTech
Definition: IFileMgr.h:170
int reopen_t
Definition: IFileMgr.h:280
MsgStream m_log
Definition: FileMgr.h:176
fileMap m_files
Definition: FileMgr.h:157
bool isOpen() const
Definition: IFileMgr.h:216
StatusCode execAction(Io::FileAttr *, const std::string &, const Io::Action &) const
Definition: FileMgr.cpp:1588
virtual StatusCode getHandler(const IoTech &, FileHdlr &) const
MsgStream & err() const
shortcut for the method msgStream(MSG::ERROR)
const std::string & name() const
Definition: IFileMgr.h:210
bfcn_reopenP_t b_reopenP_fcn
Definition: IFileMgr.h:296
IoTech tech() const
Definition: IFileMgr.h:212
void ignore() const
Definition: StatusCode.h:94
IoFlags flags() const
Definition: IFileMgr.h:213
#define ON_VERBOSE
Definition: FileMgr.cpp:15
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
void FileMgr::suppressAction ( const std::string &  f)
virtual

Implements IFileMgr.

Definition at line 1701 of file FileMgr.cpp.

1701  {
1702 
1704 
1705 }
virtual void suppressAction(const std::string &)
Definition: FileMgr.cpp:1701
void FileMgr::suppressAction ( const std::string &  f,
const Io::Action a 
)
virtual

Implements IFileMgr.

Definition at line 1710 of file FileMgr.cpp.

1710  {
1711 
1712  supMap::iterator it2 = m_supMap.find(f);
1713  if (it2 == m_supMap.end()) {
1714  int b(0);
1715  set_bit(b,a);
1716  m_supMap[f] = b;
1717  } else {
1718  set_bit(it2->second, a);
1719  }
1720 
1721 }
supMap m_supMap
Definition: FileMgr.h:169
void set_bit(int &f, const unsigned int &b)
Definition: FileMgr.cpp:27

Member Data Documentation

std::map< IoTech, actionMap > FileMgr::m_actions
private

Definition at line 166 of file FileMgr.h.

std::vector<FileAttr*> FileMgr::m_attr
private

Definition at line 161 of file FileMgr.h.

std::map<Fd, FileAttr*> FileMgr::m_descriptors
private

Definition at line 159 of file FileMgr.h.

fileMap FileMgr::m_files
private

Definition at line 157 of file FileMgr.h.

std::map<void*, FileAttr*> FileMgr::m_fptr
private

Definition at line 160 of file FileMgr.h.

std::map<IoTech, FileHdlr> FileMgr::m_handlers
private

Definition at line 158 of file FileMgr.h.

int FileMgr::m_lastErr
private

Definition at line 172 of file FileMgr.h.

std::string FileMgr::m_lastErrS
private

Definition at line 171 of file FileMgr.h.

BooleanProperty FileMgr::m_loadPosixHandler
private

Definition at line 136 of file FileMgr.h.

BooleanProperty FileMgr::m_loadRootHandler
private

Definition at line 136 of file FileMgr.h.

MsgStream FileMgr::m_log
mutableprivate

Definition at line 176 of file FileMgr.h.

StringProperty FileMgr::m_logfile
private

Definition at line 135 of file FileMgr.h.

fileList FileMgr::m_oldFiles
private

Definition at line 164 of file FileMgr.h.

POSIXFileHandler* FileMgr::m_pfh
private

Definition at line 175 of file FileMgr.h.

BooleanProperty FileMgr::m_printSummary
private

Definition at line 136 of file FileMgr.h.

RootFileHandler* FileMgr::m_rfh
private

Definition at line 174 of file FileMgr.h.

StringProperty FileMgr::m_ssl_cert
private

Definition at line 137 of file FileMgr.h.

StringProperty FileMgr::m_ssl_proxy
private

Definition at line 137 of file FileMgr.h.

supMap FileMgr::m_supMap
private

Definition at line 169 of file FileMgr.h.


The documentation for this class was generated from the following files: