PolyBoRi
PBoRiOutIter.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
13 //*****************************************************************************
14 
15 #ifndef polybori_iterators_PBoRiOutIter_h_
16 #define polybori_iterators_PBoRiOutIter_h_
17 
18 // include basic definitions
19 #include <polybori/pbori_defs.h>
20 
22 
30 template <class DataType, class RhsType, class BinOp>
31 class PBoRiOutIter {
32 public:
33 
35  typedef DataType data_type;
36 
38  typedef RhsType rhs_type;
39 
41  typedef BinOp op_type;
42 
45 
47 
48  typedef std::output_iterator_tag iterator_category;
49  typedef void difference_type;
50  typedef void pointer;
51  typedef void reference;
52  typedef void value_type;
54 
56  PBoRiOutIter(data_type& data_, op_type op_ = op_type()):
57  data(data_), op(op_) {}
58 
60  PBoRiOutIter(const self& rhs):
61  data(rhs.data), op(rhs.op) {}
62 
65 
68  self& operator*() { return *this; }
69 
71  self& operator=(const self& rhs) {
72  data = rhs.data;
73  op = rhs.op;
74  return *this;
75  }
76 
78  self& operator=(rhs_type rhs){
79  op(data, rhs);
80  return *this;
81  }
82 
84  self& operator++() { return *this; }
85 
87  self operator++(int) { return *this; }
88 
89 protected:
90  data_type& data;
91  op_type op;
92 };
93 
94 
96 
97 #endif
data_type & data
Definition: PBoRiOutIter.h:90
PBoRiOutIter(data_type &data_, op_type op_=op_type())
Constructor.
Definition: PBoRiOutIter.h:56
BinOp op_type
Type of binary operation used to transform data and rhs.
Definition: PBoRiOutIter.h:41
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
self & operator*()
Definition: PBoRiOutIter.h:68
void difference_type
Definition: PBoRiOutIter.h:49
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
DataType data_type
Data type.
Definition: PBoRiOutIter.h:35
RhsType rhs_type
Type of right-hand side.
Definition: PBoRiOutIter.h:38
self & operator=(rhs_type rhs)
Assignment of index calls for change of that index in the monomial.
Definition: PBoRiOutIter.h:78
self & operator++()
Prefix increment operator.
Definition: PBoRiOutIter.h:84
op_type op
Definition: PBoRiOutIter.h:91
~PBoRiOutIter()
Destructor.
Definition: PBoRiOutIter.h:64
self & operator=(const self &rhs)
Assignment.
Definition: PBoRiOutIter.h:71
void reference
Definition: PBoRiOutIter.h:51
std::output_iterator_tag iterator_category
Definition: PBoRiOutIter.h:48
void value_type
Definition: PBoRiOutIter.h:52
PBoRiOutIter(const self &rhs)
Copy constructor.
Definition: PBoRiOutIter.h:60
self operator++(int)
Postfix increment operator.
Definition: PBoRiOutIter.h:87
void pointer
Definition: PBoRiOutIter.h:50
This template class defines an output iterator which interprets assignments of indices as a change of...
Definition: PBoRiOutIter.h:31