Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExternalReference.h
Go to the documentation of this file.
1 /*
2  * This file belongs to the Galois project, a C++ library for exploiting
3  * parallelism. The code is being released under the terms of the 3-Clause BSD
4  * License (a copy is located in LICENSE.txt at the top-level directory).
5  *
6  * Copyright (C) 2018, The University of Texas at Austin. All rights reserved.
7  * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
8  * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY,
9  * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF
10  * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF
11  * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH
12  * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances
13  * shall University be liable for incidental, special, indirect, direct or
14  * consequential damages or loss of profits, interruption of business, or
15  * related expenses which may arise from use of Software or Documentation,
16  * including but not limited to those resulting from defects in Software and/or
17  * Documentation, or loss or inaccuracy of data of any kind.
18  */
19 
20 #ifndef GALOIS_WORKLIST_EXTERNALREFERENCE_H
21 #define GALOIS_WORKLIST_EXTERNALREFERENCE_H
22 
23 #include "galois/config.h"
24 
25 namespace galois {
26 namespace worklists {
27 
28 template <typename Container, bool IgnorePushInitial = false>
30  Container& wl;
31 
32 public:
34  template <typename _T>
36 
39 
40  ExternalReference(Container& _wl) : wl(_wl) {}
41 
43  void push(const value_type& val) { wl.push(val); }
44 
46  template <typename Iter>
47  void push(Iter b, Iter e) {
48  wl.push(b, e);
49  }
50 
53  template <typename RangeTy>
54  void push_initial(const RangeTy& r) {
55  if (!IgnorePushInitial)
56  wl.push_initial(r);
57  }
58 
60  galois::optional<value_type> pop() { return wl.pop(); }
61 };
62 
63 } // namespace worklists
64 } // namespace galois
65 #endif
galois::optional< value_type > pop()
pop a value from the queue.
Definition: ExternalReference.h:60
void push(const value_type &val)
push a value onto the queue
Definition: ExternalReference.h:43
void push_initial(const RangeTy &r)
push initial range onto the queue called with the same b and e on each thread
Definition: ExternalReference.h:54
ExternalReference(Container &_wl)
Definition: ExternalReference.h:40
Container::value_type value_type
T is the value type of the WL.
Definition: ExternalReference.h:38
Galois version of boost::optional.
Definition: optional.h:34
void push(Iter b, Iter e)
push a range onto the queue
Definition: ExternalReference.h:47
T value_type
Definition: Executor_ParaMeter.h:111
Definition: ExternalReference.h:29