libzypp  13.10.6
SolverQueueItem.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* QueueItem.h
3  *
4  * Copyright (C) 2008 SUSE Linux Products GmbH
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18  * 02111-1307, USA.
19  */
20 
21 #ifndef ZYPP_SOLVER_DETAIL_QUEUEITEM_H
22 #define ZYPP_SOLVER_DETAIL_QUEUEITEM_H
23 
24 #include <iosfwd>
25 #include <list>
26 #include <string>
27 
30 #include "zypp/base/NonCopyable.h"
31 #include "zypp/base/PtrTypes.h"
32 #include "zypp/ResPool.h"
33 
34 extern "C" {
35  struct _Queue;
36 }
37 
38 
40 namespace zypp
41 {
42  namespace solver
44  {
45  namespace detail
47  {
48 
49 typedef enum {
57 
58 
59 typedef std::list<SolverQueueItem_Ptr> SolverQueueItemList;
60 
61 #define CMP(a,b) (((a) < (b)) - ((b) < (a)))
62 
64 //
65 // CLASS NAME : SolverQueueItem
66 
68 
69  private:
70 
73 
74  protected:
75 
77 
78  public:
79 
80  virtual ~SolverQueueItem();
81 
82  // ---------------------------------- I/O
83 
84  virtual std::ostream & dumpOn( std::ostream & str ) const;
85 
86  friend std::ostream& operator<<(std::ostream & str, const SolverQueueItem & obj)
87  { return obj.dumpOn (str); }
88  friend std::ostream& operator<<(std::ostream & str, const SolverQueueItemList & itemlist);
89 
90  // ---------------------------------- accessors
91 
92  ResPool pool (void) const { return _pool; }
93 
94  // ---------------------------------- methods
95 
96  void copy (const SolverQueueItem *from);
97 
98  bool isDelete (void) const { return _type == QUEUE_ITEM_TYPE_DELETE; }
99  bool isInstall (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL; }
100  bool isUpdate (void) const { return _type == QUEUE_ITEM_TYPE_UPDATE; }
101  bool isLock (void) const { return _type == QUEUE_ITEM_TYPE_LOCK; }
102  bool isInstallOneOf (void) const { return _type == QUEUE_ITEM_TYPE_INSTALL_ONE_OF; }
103 
104 
105  virtual SolverQueueItem_Ptr copy (void) const = 0;
106  virtual bool addRule (_Queue & q) =0 ;
107  virtual int cmp (SolverQueueItem_constPtr item) const = 0;
108  int compare (SolverQueueItem_constPtr item) const { return CMP(_type, item->_type); }
109 
110 };
111 
113  };// namespace detail
116  };// namespace solver
119 };// namespace zypp
121 
122 #endif // ZYPP_SOLVER_DETAIL_QUEUEITEM_H
virtual int cmp(SolverQueueItem_constPtr item) const =0
SolverQueueItem(SolverQueueItemType type, const ResPool &pool)
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream &amp; operator&lt;&lt;.
std::list< SolverQueueItem_Ptr > SolverQueueItemList
virtual bool addRule(_Queue &q)=0
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Definition: NonCopyable.h:26
virtual SolverQueueItem_Ptr copy(void) const =0
Base class for reference counted objects.
Global ResObject pool.
Definition: ResPool.h:48
#define CMP(a, b)
friend std::ostream & operator<<(std::ostream &str, const SolverQueueItem &obj)
int compare(SolverQueueItem_constPtr item) const