- Replaced ZYppFactory ctor by 'static ZYppFactory ZYppFactory::instance()'
[platform/upstream/libzypp.git] / zypp / ZYppFactory.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/ZYppFactory.h
10  *
11 */
12 #ifndef ZYPP_ZYPPFACTORY_H
13 #define ZYPP_ZYPPFACTORY_H
14
15 #include <iosfwd>
16
17 #include "zypp/ZYpp.h"
18
19 ///////////////////////////////////////////////////////////////////
20 namespace zypp
21 { /////////////////////////////////////////////////////////////////
22
23   ///////////////////////////////////////////////////////////////////
24   //
25   //    CLASS NAME : ZYppFactory
26   //
27   /** ZYpp factory class (Singleton)
28   */
29   class ZYppFactory
30   {
31     friend std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
32
33   public:
34     /** Singleton ctor */
35     static ZYppFactory instance();
36     /** Dtor */
37     ~ZYppFactory();
38
39   public:
40     /** \return Pointer to the ZYpp instance. */
41     ZYpp::Ptr getZYpp() const;
42
43   private:
44     /** Default ctor. */
45     ZYppFactory();
46   };
47   ///////////////////////////////////////////////////////////////////
48
49   /** \relates ZYppFactory Stream output */
50   std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
51
52   /** \relates ZYppFactory Convenience to get the Pointer
53    * to the ZYpp instance.
54   */
55   inline ZYpp::Ptr getZYpp()
56   { return ZYppFactory::instance().getZYpp(); }
57
58   /////////////////////////////////////////////////////////////////
59 } // namespace zypp
60 ///////////////////////////////////////////////////////////////////
61 #endif // ZYPP_ZYPPFACTORY_H