zypp/target/rpm/Makefile \
zypp/target/store/Makefile \
zypp/target/hal/Makefile \
+ zypp/zypp_detail/Makefile \
zmd/Makefile \
zmd/backend/Makefile
#include <zypp/ResFilters.h>
#include <zypp/ResStatus.h>
-#include <zypp/Bit.h>
+#include <zypp/ResPool.h>
+
+#include <zypp/ZYppFactory.h>
using namespace std;
using namespace zypp;
///////////////////////////////////////////////////////////////////
-struct SelItem
-{
- SelItem( ResObject::Ptr ptr_r )
- : _status( 0 )
- , _ptr( ptr_r )
- {}
-
- unsigned _status;
- ResObject::Ptr _ptr;
-
- operator ResObject::Ptr()
- { return _ptr; }
-
- operator ResObject::constPtr() const
- { return _ptr; }
-
- ResObject::Ptr operator->()
- { return _ptr; }
-
- ResObject::constPtr operator->() const
- { return _ptr; }
-
- bool operator<( const SelItem & rhs ) const
- { return _ptr < rhs._ptr; }
-};
-
-
struct FakeConv : public std::unary_function<Resolvable::Ptr, void>
{
+ typedef pool::PoolItem ValueT;
+ typedef std::set<ValueT> ContainerT;
+
void operator()( Resolvable::Ptr ptr )
{
if ( ptr->name()[0] == 's' )
{
ptr = fakeResKind<detail::PatchImpl>( ptr );
}
- _store.insert( SelItem(asKind<ResObject>(ptr)) );
+ _store.insert( ValueT(asKind<ResObject>(ptr)) );
}
-
- typedef SelItem ValueT;
- typedef std::set<ValueT> ContainerT;
-
ContainerT _store;
typedef ContainerT::iterator IteratorT;
///////////////////////////////////////////////////////////////////
+
+
/******************************************************************
**
** FUNCTION NAME : main
Source src( SourceFactory().createFrom( new source::susetags::SuseTagsImpl(infile) ) );
MIL << src.resolvables().size() << endl;
+ ResPool pool;
+ pool.insert( src.resolvables().begin(), src.resolvables().end() );
+ MIL << pool << endl;
+
+#if 0
FakeConv fakeconv;
- for_each( src.resolvables().begin(), src.resolvables().end(), functorRef(fakeconv) );
+
+ std::copy( src.resolvables().begin(), src.resolvables().end(),
+ make_function_output_iterator( functorRef(fakeconv) ) );
+
+ //for_each( src.resolvables().begin(), src.resolvables().end(),
+ // functorRef(fakeconv) );
Rstats rstats = Rstats();
for_each( fakeconv.begin( byKind<Package>() ),
fakeconv.end( byKind<Package>() ),
functorRef(rstats) );
+
MIL << rstats << endl;
- SelItem it( *fakeconv.begin() );
+ FakeConv::ValueT it( *fakeconv.begin() );
SEC << it->kind() << it->name() << endl;
+ SEC << it.status() << endl;
+#endif
+
+ ZYpp::Ptr appl( ZYppFactory().letsTest() );
+ MIL << *appl;
INT << "===[END]============================================" << endl;
~ma/bin/sy2l.tcl $LPIPE &
fi
-if ps axl | grep -q '[/]usr/sbin/iceczc'; then
+if ps axl | grep -q '[/]usr/sbin/iceccd'; then
MAKE="make -j 15"
else
MAKE=make
## Process this file with automake to produce Makefile.in
## ##################################################
-SUBDIRS = base url media capability detail pool parser source target solver
+SUBDIRS = base url media capability detail pool parser \
+ source target solver zypp_detail
## ##################################################
CheckSum.h \
BaseVersion.h \
PatchRpm.h \
- DeltaRpm.h
+ DeltaRpm.h \
+ ZYpp.h \
+ ZYppFactory.h
## ##################################################
Digest.cc \
Url.cc \
TmpPath.cc \
- DiskUsage.cc
+ DiskUsage.cc \
+ ZYpp.cc \
+ ZYppFactory.cc
lib@PACKAGE@_la_LDFLAGS = @LIBZYPP_VERSION_INFO@
url/lib@PACKAGE@_url.la \
target/lib@PACKAGE@_target.la \
solver/lib@PACKAGE@_solver.la \
+ zypp_detail/lib@PACKAGE@_zypp_detail.la \
\
-lutil
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
-
+#if 0
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ResPool::Impl
{
return str << "ResPool::Impl";
}
-
+#endif
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : ResPool
// METHOD TYPE : Ctor
//
ResPool::ResPool()
- : _pimpl( Impl::nullimpl() )
+ : _inserter( _store )
+ , _deleter( _store )
{}
///////////////////////////////////////////////////////////////////
*/
std::ostream & operator<<( std::ostream & str, const ResPool & obj )
{
- return str << *obj._pimpl;
+ return str << "ResPool";
}
/////////////////////////////////////////////////////////////////
#ifndef ZYPP_RESPOOL_H
#define ZYPP_RESPOOL_H
+#include <iostream>
+#include "zypp/base/Logger.h"
+
#include <iosfwd>
+#include <set>
-#include "zypp/base/PtrTypes.h"
+#include "zypp/base/Iterator.h"
+#include "zypp/pool/PoolItem.h"
///////////////////////////////////////////////////////////////////
namespace zypp
friend std::ostream & operator<<( std::ostream & str, const ResPool & obj );
public:
- /** Implementation */
- class Impl;
+ /** */
+ typedef pool::PoolItem Item;
+
+ private:
+ /** */
+ typedef std::set<Item> ContainerT;
+
+ public:
+
+ typedef ContainerT::size_type size_type;
+ typedef ContainerT::iterator iterator;
+ typedef ContainerT::const_iterator const_iterator;
public:
/** Default ctor */
/** Dtor */
~ResPool();
- public:
+ public: // qeries based on Item.
+ /** */
+ bool empty() const
+ { return store().empty(); }
+ /** */
+ size_type size() const
+ { return store().size(); }
+
+ /** */
+ const_iterator begin() const
+ { return store().begin(); }
+ /** */
+ const_iterator end() const
+ { return store().end(); }
+
+ /** */
+ template<class _Filter>
+ filter_iterator<_Filter, const_iterator> begin() const
+ { return make_filter_iterator( _Filter(), begin(), end() ); }
+ /** */
+ template<class _Filter>
+ filter_iterator<_Filter, const_iterator> begin( _Filter f ) const
+ { return make_filter_iterator( f, begin(), end() ); }
+
+ /** */
+ template<class _Filter>
+ filter_iterator<_Filter, const_iterator> end() const
+ { return make_filter_iterator( _Filter(), end(), end() ); }
+ /** */
+ template<class _Filter>
+ filter_iterator<_Filter, const_iterator> end( _Filter f ) const
+ { return make_filter_iterator( f, end(), end() ); }
+
+ public: // insert/erase based on ResObject::constPtr.
+ /** */
+ void insert( ResObject::constPtr ptr_r )
+ { _inserter( ptr_r ); }
+
+ /** */
+ template <class _InputIterator>
+ void insert( _InputIterator first_r, _InputIterator last_r )
+ { std::for_each( first_r, last_r, _inserter ); }
+
+ /** */
+ void erase( ResObject::constPtr ptr_r )
+ { _deleter( ptr_r ); }
+
+ /** */
+ void erase( iterator first_r, iterator last_r )
+ { std::for_each( first_r, last_r, _deleter ); }
+
+ /** */
+ void clear()
+ { store().clear(); }
+
+ private:
+ struct Inserter
+ {
+ void operator()( ResObject::constPtr ptr_r )
+ { INT << "+++ " << *ptr_r << std::endl; }
+
+ Inserter( ContainerT & store_r )
+ : _store( store_r )
+ {}
+ ContainerT & _store;
+ };
+
+ struct Deleter
+ {
+ void operator()( ResObject::constPtr ptr_r )
+ { SEC << "--- " << *ptr_r << std::endl; }
+
+ Deleter( ContainerT & store_r )
+ : _store( store_r )
+ {}
+ ContainerT & _store;
+ };
+
+ /** */
+ ContainerT & store()
+ { return _store; }
+ /** */
+ const ContainerT & store() const
+ { return _store; }
private:
- /** Pointer to implementation */
- RWCOW_pointer<Impl> _pimpl;
+ /** */
+ ContainerT _store;
+ /** */
+ Inserter _inserter;
+ /** */
+ Deleter _deleter;
};
///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ZYpp.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+
+#include "zypp/ZYpp.h"
+#include "zypp/zypp_detail/ZYppImpl.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYpp::ZYpp
+ // METHOD TYPE : Ctor
+ //
+ ZYpp::ZYpp( const Impl_Ptr & impl_r )
+ : _pimpl( impl_r )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYpp::~ZYpp
+ // METHOD TYPE : Dtor
+ //
+ ZYpp::~ZYpp()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYpp::dumpOn
+ // METHOD TYPE : std::ostream &
+ //
+ std::ostream & ZYpp::dumpOn( std::ostream & str ) const
+ {
+ return str << *_pimpl;
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // Forward to Impl:
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ const ResPool & ZYpp::pool() const
+ { return _pimpl->pool(); }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ZYpp.h
+ *
+*/
+#ifndef ZYPP_ZYPP_H
+#define ZYPP_ZYPP_H
+
+#include <iosfwd>
+
+#include "zypp/base/ReferenceCounted.h"
+#include "zypp/base/NonCopyable.h"
+#include "zypp/base/PtrTypes.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ namespace zypp_detail
+ {
+ class ZYppImpl;
+ }
+
+ class ZYppFactory;
+ class ResPool;
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ZYpp
+ //
+ /** */
+ class ZYpp : public base::ReferenceCounted, private base::NonCopyable
+ {
+ public:
+
+ typedef intrusive_ptr<ZYpp> Ptr;
+ typedef intrusive_ptr<const ZYpp> constPtr;
+
+ public:
+ /** */
+ const ResPool & pool() const;
+
+ protected:
+ /** Dtor */
+ virtual ~ZYpp();
+ /** Stream output */
+ virtual std::ostream & dumpOn( std::ostream & str ) const;
+ private:
+ /** Factory */
+ friend class ZYppFactory;
+ /** */
+ typedef zypp_detail::ZYppImpl Impl;
+ typedef shared_ptr<Impl> Impl_Ptr;
+ /** Factory ctor */
+ explicit
+ ZYpp( const Impl_Ptr & impl_r );
+ private:
+ /** Pointer to implementation */
+ RW_pointer<Impl> _pimpl;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_ZYPP_H
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ZYppFactory.cc
+ *
+*/
+#include <iostream>
+#include "zypp/base/Logger.h"
+
+#include "zypp/ZYppFactory.h"
+#include "zypp/zypp_detail/ZYppImpl.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ZYppFactory
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYppFactory::ZYppFactory
+ // METHOD TYPE : Ctor
+ //
+ ZYppFactory::ZYppFactory()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYppFactory::~ZYppFactory
+ // METHOD TYPE : Dtor
+ //
+ ZYppFactory::~ZYppFactory()
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ ZYpp::Ptr ZYppFactory::letsTest() const
+ {
+ static ZYpp::Ptr _instance( new ZYpp( ZYpp::Impl_Ptr(new ZYpp::Impl) ) );
+ return _instance;
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj )
+ {
+ return str << "ZYppFactory";
+ }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ZYppFactory.h
+ *
+*/
+#ifndef ZYPP_ZYPPFACTORY_H
+#define ZYPP_ZYPPFACTORY_H
+
+#include <iosfwd>
+
+#include "zypp/ZYpp.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ZYppFactory
+ //
+ /** ZYpp factory class (Singleton)
+ */
+ class ZYppFactory
+ {
+ friend std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
+
+ public:
+ /** Default ctor */
+ ZYppFactory();
+ /** Dtor */
+ ~ZYppFactory();
+
+ public:
+ /** Dummy */
+ ZYpp::Ptr letsTest() const;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates ZYppFactory Stream output */
+ std::ostream & operator<<( std::ostream & str, const ZYppFactory & obj );
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_ZYPPFACTORY_H
#include <boost/iterator/filter_iterator.hpp>
#include <boost/iterator/transform_iterator.hpp>
+#include <boost/function_output_iterator.hpp>
///////////////////////////////////////////////////////////////////
namespace zypp
* make_transform_iterator(Iterator it);
* \endcode
*/
- using boost::transform_iterator;
+ using boost::function_output_iterator;
using boost::make_transform_iterator;
+ /** \class function_output_iterator
+ * An output iterator wrapping a unary function object; each time an
+ * element is written into the dereferenced iterator, it is passed as
+ * a parameter to the function object.
+ *
+ * Provides boost::function_output_iterator and boost::make_function_output_iterator
+ * convenience function.
+ * \see http://www.boost.org/libs/iterator/doc/function_output_iterator.html
+ * \code
+ * template <class UnaryFunction>
+ * function_output_iterator<UnaryFunction>
+ * make_function_output_iterator(const UnaryFunction& f = UnaryFunction());
+ * \endcode
+ */
+ using boost::function_output_iterator;
+ using boost::make_function_output_iterator;
+
//@}
/////////////////////////////////////////////////////////////////
} // namespace zypp
PoolItem::~PoolItem()
{}
+ ///////////////////////////////////////////////////////////////////
+ //
+ // Forward to Impl:
+ //
+ ///////////////////////////////////////////////////////////////////
+
ResStatus & PoolItem::status() const
{ return _pimpl->status(); }
//
// CLASS NAME : PoolItem
//
- /**
+ /** Connects ResObject and ResStatus.
*/
class PoolItem
{
--- /dev/null
+Makefile.in
+Makefile
+.deps
+.libs
+*.o
+*.lo
+*.a
+*.la
--- /dev/null
+## Process this file with automake to produce Makefile.in
+## ##################################################
+
+SUBDIRS =
+
+## ##################################################
+
+baseincludedir = $(pkgincludedir)/zypp_detail
+
+baseinclude_HEADERS = \
+ ZYppImpl.h
+
+noinst_LTLIBRARIES = lib@PACKAGE@_zypp_detail.la
+
+## ##################################################
+
+lib@PACKAGE@_zypp_detail_la_SOURCES = \
+ ZYppImpl.cc
+
+# lib@PACKAGE@_zypp_detail_la_LIBADD =
+
+## ##################################################
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/zypp_detail/ZYppImpl.cc
+ *
+*/
+#include <iostream>
+//#include "zypp/base/Logger.h"
+
+#include "zypp/zypp_detail/ZYppImpl.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace zypp_detail
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYppImpl::ZYppImpl
+ // METHOD TYPE : Constructor
+ //
+ ZYppImpl::ZYppImpl()
+ {
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // METHOD NAME : ZYppImpl::~ZYppImpl
+ // METHOD TYPE : Destructor
+ //
+ ZYppImpl::~ZYppImpl()
+ {
+ }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj )
+ {
+ return str << "ZYppImpl";
+ }
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace zypp_detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
--- /dev/null
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/zypp_detail/ZYppImpl.h
+ *
+*/
+#ifndef ZYPP_ZYPP_DETAIL_ZYPPIMPL_H
+#define ZYPP_ZYPP_DETAIL_ZYPPIMPL_H
+
+#include <iosfwd>
+
+#include "zypp/ResPool.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
+ namespace zypp_detail
+ { /////////////////////////////////////////////////////////////////
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ZYppImpl
+ //
+ /** */
+ class ZYppImpl
+ {
+ friend std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj );
+
+ public:
+ /** Default ctor */
+ ZYppImpl();
+ /** Dtor */
+ ~ZYppImpl();
+
+ public:
+ /** */
+ const ResPool & pool() const
+ { return _pool; }
+
+ private:
+ /** */
+ ResPool _pool;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates ZYppImpl Stream output */
+ std::ostream & operator<<( std::ostream & str, const ZYppImpl & obj );
+
+ /////////////////////////////////////////////////////////////////
+ } // namespace zypp_detail
+ ///////////////////////////////////////////////////////////////////
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_ZYPP_DETAIL_ZYPPIMPL_H