backup
authorMichael Andres <ma@suse.de>
Mon, 23 Jan 2006 09:48:42 +0000 (09:48 +0000)
committerMichael Andres <ma@suse.de>
Mon, 23 Jan 2006 09:48:42 +0000 (09:48 +0000)
configure.ac
zypp/Makefile.am
zypp/ResPool.cc [new file with mode: 0644]
zypp/ResPool.h [new file with mode: 0644]
zypp/ResStore.h
zypp/pool/.cvsignore [new file with mode: 0644]
zypp/pool/Makefile.am [new file with mode: 0644]
zypp/pool/PoolItem.cc [new file with mode: 0644]
zypp/pool/PoolItem.h [new file with mode: 0644]

index 23a466d..455e6b6 100644 (file)
@@ -218,6 +218,7 @@ AC_OUTPUT(  \
        zypp/parser/yum/Makefile        \
        zypp/parser/yum/schema/Makefile \
        zypp/parser/tagfile/Makefile    \
+       zypp/pool/Makefile              \
        zypp/solver/Makefile            \
        zypp/solver/detail/Makefile     \
        zypp/solver/temporary/Makefile  \
index 0189435..d906fc5 100644 (file)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 ## ##################################################
 
-SUBDIRS = base url media capability detail parser source target solver
+SUBDIRS = base url media capability detail pool parser source target solver
 
 ## ##################################################
 
@@ -32,6 +32,7 @@ pkginclude_HEADERS = NeedAType.h \
        ResStatus.h     \
        ResStore.h      \
        ResFilters.h    \
+       ResPool.h       \
        Package.h       \
        Pathname.h      \
        Selection.h     \
@@ -86,6 +87,7 @@ lib@PACKAGE@_la_SOURCES = \
        ResTraits.cc    \
        ResStatus.cc    \
        ResStore.cc     \
+       ResPool.cc      \
        Package.cc      \
        Pathname.cc     \
        Selection.cc    \
@@ -109,6 +111,7 @@ lib@PACKAGE@_la_LDFLAGS =   @LIBZYPP_VERSION_INFO@
 lib@PACKAGE@_la_LIBADD =        base/lib@PACKAGE@_base.la      \
                                detail/lib@PACKAGE@_detail.la   \
                                capability/lib@PACKAGE@_capability.la   \
+                               pool/lib@PACKAGE@_pool.la       \
                                parser/lib@PACKAGE@_parser.la   \
                                source/lib@PACKAGE@_source.la   \
                                media/lib@PACKAGE@_media.la     \
diff --git a/zypp/ResPool.cc b/zypp/ResPool.cc
new file mode 100644 (file)
index 0000000..0736a67
--- /dev/null
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ResPool.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+
+#include "zypp/ResPool.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : ResPool::Impl
+  //
+  /** ResPool implementation. */
+  struct ResPool::Impl
+  {
+
+  public:
+    /** Offer default Impl. */
+    static shared_ptr<Impl> nullimpl()
+    {
+      static shared_ptr<Impl> _nullimpl( new Impl );
+      return _nullimpl;
+    }
+
+  private:
+    friend Impl * rwcowClone<Impl>( const Impl * rhs );
+    /** clone for RWCOW_pointer */
+    Impl * clone() const
+    { return new Impl( *this ); }
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates ResPool::Impl Stream output */
+  inline std::ostream & operator<<( std::ostream & str, const ResPool::Impl & obj )
+  {
+    return str << "ResPool::Impl";
+  }
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : ResPool
+  //
+  ///////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : ResPool::ResPool
+  //   METHOD TYPE : Ctor
+  //
+  ResPool::ResPool()
+  : _pimpl( Impl::nullimpl() )
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : ResPool::~ResPool
+  //   METHOD TYPE : Dtor
+  //
+  ResPool::~ResPool()
+  {}
+
+  /******************************************************************
+  **
+  **   FUNCTION NAME : operator<<
+  **   FUNCTION TYPE : std::ostream &
+  */
+  std::ostream & operator<<( std::ostream & str, const ResPool & obj )
+  {
+    return str << *obj._pimpl;
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/ResPool.h b/zypp/ResPool.h
new file mode 100644 (file)
index 0000000..c1f5e0b
--- /dev/null
@@ -0,0 +1,56 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/ResPool.h
+ *
+*/
+#ifndef ZYPP_RESPOOL_H
+#define ZYPP_RESPOOL_H
+
+#include <iosfwd>
+
+#include "zypp/base/PtrTypes.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : ResPool
+  //
+  /** */
+  class ResPool
+  {
+    friend std::ostream & operator<<( std::ostream & str, const ResPool & obj );
+
+  public:
+    /** Implementation  */
+    class Impl;
+
+  public:
+    /** Default ctor */
+    ResPool();
+    /** Dtor */
+    ~ResPool();
+
+  public:
+
+  private:
+    /** Pointer to implementation */
+    RWCOW_pointer<Impl> _pimpl;
+  };
+  ///////////////////////////////////////////////////////////////////
+
+  /** \relates ResPool Stream output */
+  std::ostream & operator<<( std::ostream & str, const ResPool & obj );
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RESPOOL_H
index abdf684..0b3b42a 100644 (file)
@@ -16,7 +16,7 @@
 #include <set>
 
 #include "zypp/base/PtrTypes.h"
-#include "zypp/Package.h"
+#include "zypp/ResObject.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
diff --git a/zypp/pool/.cvsignore b/zypp/pool/.cvsignore
new file mode 100644 (file)
index 0000000..5c94a2f
--- /dev/null
@@ -0,0 +1,8 @@
+Makefile.in
+Makefile
+.deps
+.libs
+*.o
+*.lo
+*.a
+*.la
diff --git a/zypp/pool/Makefile.am b/zypp/pool/Makefile.am
new file mode 100644 (file)
index 0000000..aabd96a
--- /dev/null
@@ -0,0 +1,22 @@
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS =
+
+## ##################################################
+
+baseincludedir = $(pkgincludedir)/pool
+
+baseinclude_HEADERS =  \
+       PoolItem.h
+
+noinst_LTLIBRARIES =   lib@PACKAGE@_pool.la
+
+## ##################################################
+
+lib@PACKAGE@_pool_la_SOURCES = \
+       PoolItem.cc
+
+# lib@PACKAGE@_pool_la_LIBADD =
+
+## ##################################################
diff --git a/zypp/pool/PoolItem.cc b/zypp/pool/PoolItem.cc
new file mode 100644 (file)
index 0000000..c347185
--- /dev/null
@@ -0,0 +1,118 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/pool/PoolItem.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+
+#include "zypp/pool/PoolItem.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace pool
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PoolItem::Impl
+    //
+    /** PoolItem implementation. */
+    struct PoolItem::Impl
+    {
+      Impl( ResObject::constPtr res_r,
+            const ResStatus & status_r = ResStatus() )
+      : _status( status_r )
+      , _resolvable( res_r )
+      {}
+
+      ResStatus & status() const
+      { return _status; }
+
+      ResObject::constPtr resolvable() const
+      { return _resolvable; }
+
+    private:
+      mutable ResStatus   _status;
+      ResObject::constPtr _resolvable;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /** \relates PoolItem::Impl Stream output */
+    inline std::ostream & operator<<( std::ostream & str, const PoolItem::Impl & obj )
+    {
+      return str << "PoolItem::Impl";
+    }
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PoolItem
+    //
+    ///////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // METHOD NAME : PoolItem::PoolItem
+    // METHOD TYPE : Ctor
+    //
+    PoolItem::PoolItem()
+    {}
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // METHOD NAME : PoolItem::PoolItem
+    // METHOD TYPE : Ctor
+    //
+    PoolItem::PoolItem( ResObject::constPtr res_r )
+    : _pimpl( new Impl( res_r ) )
+    {}
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // METHOD NAME : PoolItem::PoolItem
+    // METHOD TYPE : Ctor
+    //
+    PoolItem::PoolItem( ResObject::constPtr res_r, const ResStatus & status_r )
+    : _pimpl( new Impl( res_r, status_r ) )
+    {}
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // METHOD NAME : PoolItem::~PoolItem
+    // METHOD TYPE : Dtor
+    //
+    PoolItem::~PoolItem()
+    {}
+
+    ResStatus & PoolItem::status() const
+    { return _pimpl->status(); }
+
+    ResObject::constPtr PoolItem::resolvable() const
+    { return _pimpl->resolvable(); }
+
+    /******************************************************************
+    **
+    ** FUNCTION NAME : operator<<
+    ** FUNCTION TYPE : std::ostream &
+    */
+    std::ostream & operator<<( std::ostream & str, const PoolItem & obj )
+    {
+      return str << *obj._pimpl;
+    }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace pool
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/pool/PoolItem.h b/zypp/pool/PoolItem.h
new file mode 100644 (file)
index 0000000..9453896
--- /dev/null
@@ -0,0 +1,108 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file      zypp/pool/PoolItem.h
+ *
+*/
+#ifndef ZYPP_POOL_POOLITEM_H
+#define ZYPP_POOL_POOLITEM_H
+
+#include <iosfwd>
+#include <functional>
+
+#include "zypp/base/PtrTypes.h"
+#include "zypp/ResObject.h"
+#include "zypp/ResStatus.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace pool
+  { /////////////////////////////////////////////////////////////////
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : PoolItem
+    //
+    /**
+    */
+    class PoolItem
+    {
+      friend std::ostream & operator<<( std::ostream & str, const PoolItem & obj );
+
+    public:
+      /** Implementation  */
+      class Impl;
+
+    public:
+      /** Default ctor for use in std::container. */
+      PoolItem();
+
+      /** Ctor */
+      explicit
+      PoolItem( ResObject::constPtr res_r );
+
+      /** Ctor */
+      PoolItem( ResObject::constPtr res_r, const ResStatus & status_r );
+
+      /** Dtor */
+      ~PoolItem();
+
+    public:
+      /** */
+      ResStatus & status() const;
+
+      /** */
+      ResObject::constPtr resolvable() const;
+
+      /** Implicit conversion into ResObject::constPtr to
+       *  support query filters operating on ResObject.
+      */
+      operator ResObject::constPtr() const
+      { return resolvable(); }
+
+      /** Forward \c -> access to ResObject. */
+      ResObject::constPtr operator->() const
+      { return resolvable(); }
+
+    private:
+      /** Pointer to implementation */
+      RW_pointer<Impl> _pimpl;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /** \relates PoolItem Stream output */
+    std::ostream & operator<<( std::ostream & str, const PoolItem & obj );
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace pool
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace std
+{ /////////////////////////////////////////////////////////////////
+
+  /** \relates zypp::pool::PoolItem Order in std::container follows ResObject::constPtr.*/
+  template<>
+    inline bool less<zypp::pool::PoolItem>::operator()( const zypp::pool::PoolItem & lhs, const zypp::pool::PoolItem & rhs ) const
+    { return lhs.resolvable() < rhs.resolvable(); }
+
+  /** \relates zypp::pool::PoolItem Equal for std::container follows ResObject::constPtr. */
+  template<>
+    inline bool equal_to<zypp::pool::PoolItem>::operator()( const zypp::pool::PoolItem & lhs, const zypp::pool::PoolItem & rhs ) const
+    { return lhs.resolvable() == rhs.resolvable(); }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
+
+#endif // ZYPP_POOL_POOLITEM_H