CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QueueID.h
Go to the documentation of this file.
1 // $Id: QueueID.h,v 1.3.16.1 2011/03/07 11:33:04 mommsen Exp $
3 
4 #ifndef EventFilter_StorageManager_QueueID_h
5 #define EventFilter_StorageManager_QueueID_h
6 
7 #include <cstddef>
8 #include <iostream>
9 #include <vector>
10 
12 
13 namespace stor {
14 
23  class QueueID
24  {
25  public:
26 
28 
33  QueueID();
34 
39  QueueID(PolicyType policy, size_t index);
40 
44  PolicyType policy() const;
45 
49  size_t index() const;
50 
55  bool isValid() const;
56 
61  bool operator< (QueueID const& other) const;
62 
67  bool operator== (QueueID const& other) const;
68 
72  bool operator!= (QueueID const& other) const;
73 
74  private:
75  size_t index_;
77 
78  };
79 
80  typedef std::vector<QueueID> QueueIDs;
81 
82  inline
84  index_(0),
85  policy_(enquing_policy::Max)
86  { }
87 
88  inline
90  index_(index),
91  policy_(policy)
92  { }
93 
94  inline
97  {
98  return policy_;
99  }
100 
101  inline
102  size_t
104  {
105  return index_;
106  }
107 
108  inline
109  bool
111  {
112  return policy_ != enquing_policy::Max;
113  }
114 
115  inline
116  bool
117  QueueID::operator< (QueueID const& other) const
118  {
119  return policy_ == other.policy_
120  ? index_ < other.index_
121  : policy_ < other.policy_;
122  }
123 
124  inline
125  bool
126  QueueID::operator== (QueueID const& other) const
127  {
128  return policy_ == other.policy_ && index_ == other.index_;
129  }
130 
131  inline
132  bool
133  QueueID::operator!= (QueueID const& other) const
134  {
135  return !( operator==(other));
136  }
137 
138  inline
139  std::ostream&
140  operator<< ( std::ostream& os, const QueueID& queueId )
141  {
142  os << "policy: " << queueId.policy() <<
143  " index: " << queueId.index();
144  return os;
145  }
146 
147 } // namespace stor
148 
149 #endif // EventFilter_StorageManager_QueueID_h
150 
151 
bool isValid() const
Definition: QueueID.h:110
std::vector< QueueID > QueueIDs
Definition: QueueID.h:80
bool operator==(QueueID const &other) const
Definition: QueueID.h:126
size_t index() const
Definition: QueueID.h:103
bool operator<(QueueID const &other) const
Definition: QueueID.h:117
PolicyType policy_
Definition: QueueID.h:76
std::ostream & operator<<(std::ostream &os, ConsumerID id)
Definition: ConsumerID.h:69
bool operator!=(QueueID const &other) const
Definition: QueueID.h:133
enquing_policy::PolicyTag PolicyType
Definition: QueueID.h:27
size_t index_
Definition: QueueID.h:75
PolicyType policy() const
Definition: QueueID.h:96