SyFi 0.3
OrderedPtvSet.h
Go to the documentation of this file.
00001 // Copyright (C) 2006-2009 Kent-Andre Mardal and Simula Research Laboratory.
00002 // Licensed under the GNU GPL Version 2, or (at your option) any later version.
00003 
00004 #ifndef SIMPLEX_IS_INCLUDED
00005 #define SIMPLEX_IS_INCLUDED
00006 
00007 #include "Ptv.h"
00008 #include <vector>
00009 #include <iterator>
00010 #include <iostream>
00011 
00012 /*
00013  * Note: at present the OrderedPtvSet class is more general than a OrderedPtvSet.
00014  * It is actually a point set. Still, we will only use it as a OrderedPtvSet.
00015  * It might be that we should use a different name and/or implement
00016  * a sub class or something which is strictly a OrderedPtvSet.
00017  */
00018 
00019 using namespace std;
00020 
00021 namespace SyFi
00022 {
00023 
00024         class OrderedPtvSet
00025         {
00026                 vector<Ptv> Ptvs;
00027 
00028                 public:
00029                         OrderedPtvSet();
00030                         OrderedPtvSet(const Ptv& p0, const Ptv& p1);
00031                         OrderedPtvSet(const Ptv& p0, const Ptv& p1, const Ptv& p2);
00032                         OrderedPtvSet(const Ptv& p0, const Ptv& p1, const Ptv& p2, const Ptv& p3);
00033                         virtual ~OrderedPtvSet();
00034 
00035                         void append(const Ptv& p);
00036                         unsigned int size() const;
00037                         const Ptv& operator [] (unsigned int i) const;
00038                         Ptv& operator [] (unsigned int i);
00039                         OrderedPtvSet& operator = (const OrderedPtvSet& p);
00040                         bool less(const OrderedPtvSet& s) const;
00041         };
00042 
00043         struct OrderedPtvSet_is_less : public std::binary_function<OrderedPtvSet, OrderedPtvSet, bool>
00044         {
00045                 bool operator() (const OrderedPtvSet &lh, const OrderedPtvSet &rh) const { return lh.less(rh);  }
00046         };
00047 
00048         std::ostream & operator<< ( std::ostream& os, const OrderedPtvSet& p);
00049 
00050         // Note that this OrderedPtvSet_i might be implemented as a subclass ?
00051         class OrderedPtvSet_i
00052         {
00053                 pair<OrderedPtvSet,vector<unsigned int> >  si;
00054 
00055                 public:
00056                         OrderedPtvSet_i();
00057                         OrderedPtvSet_i(OrderedPtvSet& s, unsigned int i);
00058                         OrderedPtvSet_i(OrderedPtvSet& s, unsigned int i0, unsigned int i1);
00059                         virtual ~OrderedPtvSet_i();
00060 
00061                         const OrderedPtvSet& get_OrderedPtvSet() const;
00062                         unsigned int get_i(unsigned int n) const;
00063                         unsigned int size() const;
00064                         bool less(const OrderedPtvSet_i& si) const;
00065         };
00066 
00067         struct OrderedPtvSet_i_is_less : public std::binary_function<OrderedPtvSet_i, OrderedPtvSet_i, bool>
00068         {
00069                 bool operator() (const OrderedPtvSet_i &lh, const OrderedPtvSet_i &rh) const { return lh.less(rh);  }
00070         };
00071 
00072         std::ostream & operator<< ( std::ostream& os, const OrderedPtvSet_i& si);
00073 
00074 }                                                                // namespace SyFi
00075 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines