Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:56

0001 /****************************************************************************
0002 **
0003 ** Copyright (c) 2009-2020 C.B. Barber. All rights reserved.
0004 ** $Id: //main/2019/qhull/src/libqhullcpp/QhullVertexSet.h#4 $$Change: 3001 $
0005 ** $DateTime: 2020/07/24 20:43:28 $$Author: bbarber $
0006 **
0007 ****************************************************************************/
0008 
0009 #ifndef QHULLVERTEXSET_H
0010 #define QHULLVERTEXSET_H
0011 
0012 #include "libqhullcpp/QhullFacetList.h"
0013 #include "libqhullcpp/QhullSet.h"
0014 #include "libqhullcpp/QhullVertex.h"
0015 
0016 #include <ostream>
0017 
0018 namespace orgQhull {
0019 
0020 #//!\name Used here
0021 
0022 #//!\name Defined here
0023     //! QhullVertexSet -- a set of QhullVertex, as a C++ class.
0024     //! See Qhull
0025     class QhullVertexSet;
0026 
0027     //! QhullVertexSetIterator is a Java-style iterator for QhullVertex in a QhullVertexSet
0028     //! QhullVertexSetIterator may be used on temporary results.  It copies the pointers in QhullVertexSet
0029     typedef QhullSetIterator<QhullVertex> QhullVertexSetIterator;
0030 
0031 class QhullVertexSet : public QhullSet<QhullVertex> {
0032 
0033 private:
0034 #//!\name Fields
0035     bool                qhsettemp_defined;  //! Set was allocated with qh_settemp()
0036 
0037 public:
0038 #//!\name Constructor
0039                         QhullVertexSet(const Qhull &q, setT *s) : QhullSet<QhullVertex>(q, s), qhsettemp_defined(false) {}
0040                         QhullVertexSet(const Qhull &q, facetT *facetlist, setT *facetset, bool allfacets);
0041                         //Conversion from setT* is not type-safe.  Implicit conversion for void* to T
0042                         QhullVertexSet(QhullQh *qqh, setT *s) : QhullSet<QhullVertex>(qqh, s), qhsettemp_defined(false) {}
0043                         QhullVertexSet(QhullQh *qqh, facetT *facetlist, setT *facetset, bool allfacets);
0044                         //Copy constructor and assignment copies pointer but not contents.  Throws error if qhsettemp_defined.  Needed for return by value.
0045                         QhullVertexSet(const QhullVertexSet &other);
0046     QhullVertexSet &    operator=(const QhullVertexSet &other);
0047                         ~QhullVertexSet();
0048 
0049 private:                //!Default constructor disabled.  Will implement allocation later
0050                         QhullVertexSet();
0051 public:
0052 
0053 #//!\name Destructor
0054     void                freeQhSetTemp();
0055 
0056 #//!\name Conversion
0057 #ifndef QHULL_NO_STL
0058     std::vector<QhullVertex> toStdVector() const;
0059 #endif //QHULL_NO_STL
0060 #ifdef QHULL_USES_QT
0061     QList<QhullVertex>   toQList() const;
0062 #endif //QHULL_USES_QT
0063 
0064 #//!\name Methods
0065 
0066 #//!\name IO
0067     struct PrintVertexSet{
0068         const QhullVertexSet *vertex_set;
0069         const char *    print_message;     //!< non-null message
0070                         
0071                         PrintVertexSet(const char *message, const QhullVertexSet *s) : vertex_set(s), print_message(message) {}
0072     };//PrintVertexSet
0073     const PrintVertexSet print(const char *message) const { return PrintVertexSet(message, this); }
0074 
0075     struct PrintIdentifiers{
0076         const QhullVertexSet *vertex_set;
0077         const char *    print_message;    //!< non-null message
0078                         PrintIdentifiers(const char *message, const QhullVertexSet *s) : vertex_set(s), print_message(message) {}
0079     };//PrintIdentifiers
0080     PrintIdentifiers    printIdentifiers(const char *message) const { return PrintIdentifiers(message, this); }
0081 
0082 };//class QhullVertexSet
0083 
0084 }//namespace orgQhull
0085 
0086 #//!\name Global
0087 
0088 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertexSet::PrintVertexSet &pr);
0089 std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertexSet::PrintIdentifiers &p);
0090 inline std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertexSet &vs) { os << vs.print(""); return os; }
0091 
0092 #endif // QHULLVERTEXSET_H