Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:47:59

0001 /*
0002   Copyright 2008 Intel Corporation
0003 
0004   Use, modification and distribution are subject to the Boost Software License,
0005   Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006   http://www.boost.org/LICENSE_1_0.txt).
0007 */
0008 #ifndef BOOST_POLYGON_POLYGON_45_DATA_HPP
0009 #define BOOST_POLYGON_POLYGON_45_DATA_HPP
0010 #include "isotropy.hpp"
0011 namespace boost { namespace polygon{
0012 struct polygon_45_concept;
0013 template <typename T> class polygon_data;
0014 template <typename T>
0015 class polygon_45_data {
0016 public:
0017   typedef polygon_45_concept geometry_type;
0018   typedef T coordinate_type;
0019   typedef typename std::vector<point_data<coordinate_type> >::const_iterator iterator_type;
0020   typedef typename coordinate_traits<T>::coordinate_distance area_type;
0021   typedef point_data<T> point_type;
0022 
0023   inline polygon_45_data() : coords_() {} //do nothing default constructor
0024 
0025   template<class iT>
0026   inline polygon_45_data(iT input_begin, iT input_end) : coords_(input_begin, input_end) {}
0027 
0028   template<class iT>
0029   inline polygon_45_data& set(iT input_begin, iT input_end) {
0030     coords_.clear();  //just in case there was some old data there
0031     coords_.insert(coords_.end(), input_begin, input_end);
0032     return *this;
0033   }
0034 
0035   // copy constructor (since we have dynamic memory)
0036   inline polygon_45_data(const polygon_45_data& that) : coords_(that.coords_) {}
0037 
0038   // assignment operator (since we have dynamic memory do a deep copy)
0039   inline polygon_45_data& operator=(const polygon_45_data& that) {
0040     coords_ = that.coords_;
0041     return *this;
0042   }
0043 
0044   template <typename T2>
0045   inline polygon_45_data& operator=(const T2& rvalue);
0046 
0047   inline bool operator==(const polygon_45_data& that) const {
0048     if(coords_.size() != that.coords_.size()) return false;
0049     for(std::size_t i = 0; i < coords_.size(); ++i) {
0050       if(coords_[i] != that.coords_[i]) return false;
0051     }
0052     return true;
0053   }
0054 
0055   inline bool operator!=(const polygon_45_data& that) const { return !((*this) == that); }
0056 
0057   // get begin iterator, returns a pointer to a const Unit
0058   inline iterator_type begin() const { return coords_.begin(); }
0059 
0060   // get end iterator, returns a pointer to a const Unit
0061   inline iterator_type end() const { return coords_.end(); }
0062 
0063   inline std::size_t size() const { return coords_.size(); }
0064 
0065 public:
0066   std::vector<point_data<coordinate_type> > coords_;
0067 };
0068 
0069 
0070 }
0071 }
0072 #endif