1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/ZYppFactory.h
12 #ifndef ZYPP_ZYPPFACTORY_H
13 #define ZYPP_ZYPPFACTORY_H
17 #include "zypp/base/Exception.h"
18 #include "zypp/ZYpp.h"
20 ///////////////////////////////////////////////////////////////////
22 { /////////////////////////////////////////////////////////////////
24 class ZYppFactoryException : public Exception
27 ZYppFactoryException( const std::string & msg_r, pid_t locker_pid );
28 pid_t locker_pid() const { return _locker_pid; }
33 ///////////////////////////////////////////////////////////////////
35 // CLASS NAME : ZYppFactory
37 /** ZYpp factory class (Singleton)
41 friend std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
45 static ZYppFactory instance();
50 /** \return Pointer to the ZYpp instance.
51 * \throw EXCEPTION In case we can't acquire a lock.
53 ZYpp::Ptr getZYpp() const;
59 ///////////////////////////////////////////////////////////////////
61 /** \relates ZYppFactory Stream output */
62 std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
64 /** \relates ZYppFactory Convenience to get the Pointer
65 * to the ZYpp instance.
66 * \see ZYppFactory::getZYpp
68 inline ZYpp::Ptr getZYpp()
69 { return ZYppFactory::instance().getZYpp(); }
71 /////////////////////////////////////////////////////////////////
73 ///////////////////////////////////////////////////////////////////
74 #endif // ZYPP_ZYPPFACTORY_H