PolyBoRi
BooleSetSequence.h
Go to the documentation of this file.
00001 // -*- c++ -*-
00002 //*****************************************************************************
00014 //*****************************************************************************
00015 
00016 #ifndef polybori_BooleSetSequence_h_
00017 #define polybori_BooleSetSequence_h_
00018 
00019 // include basic definitions
00020 #include <polybori/pbori_defs.h>
00021 
00022 #include <vector>
00023 #include <algorithm>
00024 
00025 #include <polybori/BooleSet.h>
00026 
00027 BEGIN_NAMESPACE_PBORI
00028 
00033 class BooleSetSequence {
00034 
00035 public:
00036   typedef std::vector<BooleSet> vector_type;
00037   typedef vector_type::const_iterator const_iterator;
00038   typedef vector_type::const_reverse_iterator const_reverse_iterator;
00039 
00041   BooleSetSequence():  m_termsets() { }
00042 
00043 
00045   template <class SetType, class Operator>
00046   BooleSetSequence(const SetType& terms, const Operator& func):
00047     m_termsets(terms.size(), terms.ring()) {
00048     std::transform(terms.begin(), terms.end(), m_termsets.begin(), func);
00049   }
00050   
00052 
00053   const_iterator begin() const { return m_termsets.begin(); }
00054   const_iterator end() const { return m_termsets.end(); }
00055   const_reverse_iterator rbegin() const { return m_termsets.rbegin(); }
00056   const_reverse_iterator rend() const { return m_termsets.rend(); }
00057   bool empty() const { return m_termsets.empty(); }
00059 
00060 private:
00061   vector_type m_termsets;
00062 };
00063 
00064 
00065 END_NAMESPACE_PBORI
00066 
00067 #endif /* polybori_BooleSetSequence_h_ */