libzypp  10.5.0
ZYppFactory.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_ZYPPFACTORY_H
00013 #define ZYPP_ZYPPFACTORY_H
00014 
00015 #include <iosfwd>
00016 
00017 #include "zypp/base/Exception.h"
00018 #include "zypp/ZYpp.h"
00019 
00021 namespace zypp
00022 { 
00023 
00024   class ZYppFactoryException : public Exception
00025   {
00026   public:
00027     ZYppFactoryException( const std::string & msg_r, pid_t lockerPid_r, const std::string & lockerName_r );
00028     virtual ~ZYppFactoryException() throw ();
00029   public:
00030     pid_t lockerPid() const { return _lockerPid; }
00031     const std::string & lockerName() const { return _lockerName; }
00033     ZYPP_DEPRECATED pid_t locker_pid() const { return lockerPid(); }
00034   private:
00035     pid_t _lockerPid;
00036     std::string _lockerName;
00037   };
00038 
00040   //
00041   //    CLASS NAME : ZYppFactory
00042   //
00045   class ZYppFactory
00046   {
00047     friend std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
00048 
00049   public:
00051     static ZYppFactory instance();
00053     ~ZYppFactory();
00054 
00055   public:
00059     ZYpp::Ptr getZYpp() const;
00060 
00062     bool haveZYpp() const;
00063 
00064   private:
00066     ZYppFactory();
00067   };
00069 
00071   std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
00072 
00077   inline ZYpp::Ptr getZYpp()
00078   { return ZYppFactory::instance().getZYpp(); }
00079 
00081 } // namespace zypp
00083 #endif // ZYPP_ZYPPFACTORY_H