1
/****************************************************************************
3
** Copyright (c) 2008-2012 C.B. Barber. All rights reserved.
4
** $Id: //main/2011/qhull/src/libqhullcpp/QhullFacetSet.h#5 $$Change: 1464 $
5
** $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
7
****************************************************************************/
9
#ifndef QHULLFACETSET_H
10
#define QHULLFACETSET_H
22
//! QhullFacetSet -- a set of Qhull facets, as a C++ class. See QhullFacetList.h
24
typedef QhullSetIterator<QhullFacet>
25
QhullFacetSetIterator;
27
class QhullFacetSet : public QhullSet<QhullFacet> {
31
bool select_all; //! True if include bad facets. Default is false.
35
//Conversion from setT* is not type-safe. Implicit conversion for void* to T
36
explicit QhullFacetSet(setT *s) : QhullSet<QhullFacet>(s), select_all(false) {}
37
//Copy constructor copies pointer but not contents. Needed for return by value and parameter passing.
38
QhullFacetSet(const QhullFacetSet &o) : QhullSet<QhullFacet>(o), select_all(o.select_all) {}
41
//!Disable default constructor and copy assignment. See QhullSetBase
43
QhullFacetSet &operator=(const QhullFacetSet &);
48
std::vector<QhullFacet> toStdVector() const;
51
QList<QhullFacet> toQList() const;
52
#endif //QHULL_USES_QT
55
bool isSelectAll() const { return select_all; }
56
void selectAll() { select_all= true; }
57
void selectGood() { select_all= false; }
60
//! Filtered by facet.isGood(). May be 0 when !isEmpty().
62
bool contains(const QhullFacet &f) const;
63
int count(const QhullFacet &f) const;
64
//! operator==() does not depend on isGood()
67
// Not same as QhullFacetList#IO. A QhullFacetSet is a component of a QhullFacetList.
70
const QhullFacetSet *facet_set;
71
const char *print_message;
73
PrintFacetSet(int qhRunId, const char *message, const QhullFacetSet *s) : facet_set(s), print_message(message), run_id(qhRunId) {}
75
const PrintFacetSet print(int qhRunId, const char *message) const { return PrintFacetSet(qhRunId, message, this); }
77
struct PrintIdentifiers{
78
const QhullFacetSet *facet_set;
79
const char *print_message;
80
PrintIdentifiers(const char *message, const QhullFacetSet *s) : facet_set(s), print_message(message) {}
82
PrintIdentifiers printIdentifiers(const char *message) const { return PrintIdentifiers(message, this); }
84
};//class QhullFacetSet
88
#//== Global namespace =========================================
90
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet &fs);
91
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintFacetSet &pr);
92
std::ostream &operator<<(std::ostream &os, const orgQhull::QhullFacetSet::PrintIdentifiers &p);
94
#endif // QHULLFACETSET_H