1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (c) 2009-2012 C.B. Barber. All rights reserved.
|
---|
4 | ** $Id: //main/2011/qhull/src/libqhullcpp/QhullVertexSet.h#5 $$Change: 1464 $
|
---|
5 | ** $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
|
---|
6 | **
|
---|
7 | ****************************************************************************/
|
---|
8 |
|
---|
9 | #ifndef QHULLVERTEXSET_H
|
---|
10 | #define QHULLVERTEXSET_H
|
---|
11 |
|
---|
12 | #include "QhullSet.h"
|
---|
13 |
|
---|
14 | #include <ostream>
|
---|
15 |
|
---|
16 | namespace orgQhull {
|
---|
17 |
|
---|
18 | #//ClassRef
|
---|
19 | class QhullVertex;
|
---|
20 |
|
---|
21 | #//Types
|
---|
22 | //! QhullVertexSet -- a set of Qhull Vertices, as a C++ class.
|
---|
23 | //! See Qhull
|
---|
24 | class QhullVertexSet;
|
---|
25 | typedef QhullSetIterator<QhullVertex>
|
---|
26 | QhullVertexSetIterator;
|
---|
27 |
|
---|
28 | class QhullVertexSet : public QhullSet<QhullVertex> {
|
---|
29 |
|
---|
30 | private:
|
---|
31 | #//Fields
|
---|
32 | Qhull *qhsettemp_qhull; //! For sets allocated with qh_settemp()
|
---|
33 | bool qhsettemp_defined; //! Set was allocated with q_memalloc()
|
---|
34 |
|
---|
35 | public:
|
---|
36 | #//Constructor
|
---|
37 | //Conversion from setT* is not type-safe. Implicit conversion for void* to T
|
---|
38 | explicit QhullVertexSet(setT *s) : QhullSet<QhullVertex>(s), qhsettemp_qhull(0), qhsettemp_defined(false) {}
|
---|
39 | QhullVertexSet(int qhRunId, facetT *facetlist, setT *facetset, bool allfacets);
|
---|
40 | //Copy constructor copies pointer but not contents. Needed for return by value.
|
---|
41 | QhullVertexSet(const QhullVertexSet &o) : QhullSet<QhullVertex>(o), qhsettemp_qhull(o.qhsettemp_qhull), qhsettemp_defined(o.qhsettemp_defined) {}
|
---|
42 | ~QhullVertexSet();
|
---|
43 |
|
---|
44 | private:
|
---|
45 | //!Disable default constructor and copy assignment. See QhullSetBase
|
---|
46 | QhullVertexSet();
|
---|
47 | QhullVertexSet &operator=(const QhullVertexSet &);
|
---|
48 | public:
|
---|
49 |
|
---|
50 | #//Constructor, destructor
|
---|
51 | void freeQhSetTemp();
|
---|
52 |
|
---|
53 | #//IO
|
---|
54 | struct PrintVertexSet{
|
---|
55 | const QhullVertexSet *Vertex_set;
|
---|
56 | const char *print_message;
|
---|
57 | int run_id;
|
---|
58 | PrintVertexSet(int qhRunId, const char *message, const QhullVertexSet *s) : Vertex_set(s), print_message(message), run_id(qhRunId) {}
|
---|
59 | };//PrintVertexSet
|
---|
60 | const PrintVertexSet print(int qhRunId, const char *message) const { return PrintVertexSet(qhRunId, message, this); }
|
---|
61 |
|
---|
62 | struct PrintIdentifiers{
|
---|
63 | const QhullVertexSet *Vertex_set;
|
---|
64 | const char *print_message;
|
---|
65 | PrintIdentifiers(const char *message, const QhullVertexSet *s) : Vertex_set(s), print_message(message) {}
|
---|
66 | };//PrintIdentifiers
|
---|
67 | PrintIdentifiers printIdentifiers(const char *message) const { return PrintIdentifiers(message, this); }
|
---|
68 |
|
---|
69 | };//class QhullVertexSet
|
---|
70 |
|
---|
71 | }//namespace orgQhull
|
---|
72 |
|
---|
73 | #//== Global namespace =========================================
|
---|
74 |
|
---|
75 | std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertexSet::PrintVertexSet &pr);
|
---|
76 | std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertexSet::PrintIdentifiers &p);
|
---|
77 | inline std::ostream &operator<<(std::ostream &os, const orgQhull::QhullVertexSet &vs) { os << vs.print(orgQhull::UsingLibQhull::NOqhRunId, ""); return os; }
|
---|
78 |
|
---|
79 | #endif // QHULLVERTEXSET_H
|
---|