PolyBoRi
PBoRiOutIter.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //*****************************************************************************
00013 //*****************************************************************************
00014 
00015 #ifndef polybori_iterators_PBoRiOutIter_h_
00016 #define polybori_iterators_PBoRiOutIter_h_
00017 
00018 // include basic definitions
00019 #include <polybori/pbori_defs.h>
00020 
00021 BEGIN_NAMESPACE_PBORI
00022 
00030 template <class DataType, class RhsType, class BinOp>
00031 class PBoRiOutIter {
00032 public:
00033 
00035   typedef DataType data_type;
00036 
00038   typedef RhsType rhs_type;
00039 
00041   typedef BinOp op_type;
00042 
00044   typedef PBoRiOutIter<data_type, rhs_type, op_type> self;
00045 
00047 
00048   typedef std::output_iterator_tag iterator_category;
00049   typedef void difference_type;
00050   typedef void pointer;
00051   typedef void reference;
00052   typedef void value_type;
00054 
00056   PBoRiOutIter(data_type& data_, op_type op_ = op_type()):
00057     data(data_), op(op_) {}
00058 
00060   PBoRiOutIter(const self& rhs): 
00061     data(rhs.data), op(rhs.op) {}
00062 
00064   ~PBoRiOutIter() {}
00065 
00068   self& operator*() { return *this; }
00069 
00071   self& operator=(const self& rhs) {
00072     data = rhs.data; 
00073     op = rhs.op;
00074     return *this;
00075   }
00076 
00078   self& operator=(rhs_type rhs){ 
00079     op(data, rhs); 
00080     return *this;
00081   }
00082 
00084   self& operator++() { return *this; }
00085 
00087   self operator++(int) { return *this; }
00088 
00089 protected:
00090   data_type& data;
00091   op_type op;
00092 };
00093 
00094 
00095 END_NAMESPACE_PBORI
00096 
00097 #endif