HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_FaceSetMap.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GT_FaceSetMap.h (GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_FaceSetMap__
12 #define __GT_FaceSetMap__
13 
14 #include "GT_API.h"
15 
16 #include <UT/UT_StringMap.h>
17 #include <UT/UT_IntrusivePtr.h>
18 #include <UT/UT_Set.h>
19 #include "GT_FaceSet.h"
20 
21 class UT_JSONWriter;
22 class GT_FaceSetMap;
23 
25 
26 /// Class to store "face sets" on GT mesh primitives
28  : public UT_IntrusiveRefCounter<GT_FaceSetMap>
29  , public UT_NonCopyable
30 {
31 public:
33 
34  GT_FaceSetMap();
35  ~GT_FaceSetMap();
36 
37  /// @{
38  /// Map access. These methods are @b not thread-safe
39  GT_FaceSetPtr find(const UT_StringRef &name) const;
41  const GT_FaceSetPtr &set,
42  bool replace_existing=true);
43  GT_Size entries() const { return myMap.size(); }
44  /// @}
45 
46  /// Save sets to a JSON stream
47  bool save(UT_JSONWriter &w) const;
48  void dump() const;
49 
51  {
52  public:
55  : myIt()
56  , myEnd()
57  {
58  };
59  ~iterator() {}
60 
61  const UT_StringHolder &name() const { return myIt->first; }
62  const GT_FaceSetPtr &faceSet() const { return myIt->second; }
63 
64  iterator &operator++() { ++myIt; return *this; }
66  {
67  myIt = src.myIt;
68  myEnd = src.myEnd;
69  return *this;
70  }
71  bool operator==(const iterator &cmp) const
72  { return myIt == cmp.myIt; }
73  bool operator!=(const iterator &cmp) const
74  { return myIt != cmp.myIt; }
75  bool atEnd() const { return myIt == myEnd; }
76  void advance() { ++myIt; }
77  private:
78  iterator(const MapIterator &it, const MapIterator &end)
79  : myIt(it)
80  , myEnd(end)
81  {
82  }
83  MapIterator myIt;
84  MapIterator myEnd;
85  friend class GT_FaceSetMap;
86  };
87  iterator begin() const { return iterator(myMap.begin(), myMap.end()); }
88  iterator end() const { return iterator(myMap.end(), myMap.end()); }
89 
90  /// Delete polygons from the face set. The second argument is an array
91  /// mapping the old face numbers to the new face numbers. For example,
92  /// deleting polygon 2 from a set of [0,1,2,3] would expect a remapping
93  /// array of [0,1,x,2] (the value of 2 doesn't actually matter)
95  const GT_Int32Array &mapping) const;
96 
97 
98  exint getMemoryUsage() const;
99 
100 private:
101  MapType myMap;
102 };
103 
104 #endif
#define GT_API
Definition: GT_API.h:13
int64 exint
Definition: SYS_Types.h:125
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
A reference counter base class for use with UT_IntrusivePtr.
bool operator!=(const iterator &cmp) const
Definition: GT_FaceSetMap.h:73
iterator begin() const
Definition: GT_FaceSetMap.h:87
exint getMemoryUsage() const
bool operator==(const iterator &cmp) const
Definition: GT_FaceSetMap.h:71
IMATH_HOSTDEVICE constexpr int cmp(T a, T b) IMATH_NOEXCEPT
Definition: ImathFun.h:84
const UT_StringHolder & name() const
Definition: GT_FaceSetMap.h:61
iterator end() const
Definition: GT_FaceSetMap.h:88
GT_Size entries() const
Definition: GT_FaceSetMap.h:43
GLuint GLuint end
Definition: glcorearb.h:475
Class to store "face sets" on GT mesh primitives.
Definition: GT_FaceSetMap.h:27
GLuint const GLchar * name
Definition: glcorearb.h:786
Parent::const_iterator const_iterator
Definition: UT_StringMap.h:51
int64 GT_Size
Definition: GT_Types.h:128
iterator & operator=(const iterator &src)
Definition: GT_FaceSetMap.h:65
const GT_FaceSetPtr & faceSet() const
Definition: GT_FaceSetMap.h:62
GT_FaceSetMapPtr deleteFaces(const UT_Set< int > &faces, const GT_Int32Array &mapping) const
An array of numeric values (int32, int64, fpreal16, fpreal32, fpreal64)
Definition: GT_DANumeric.h:23
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
GT_FaceSetMap::MapType::const_iterator MapIterator
Definition: GT_FaceSetMap.h:53
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
UT_StringMap< GT_FaceSetPtr > MapType
Definition: GT_FaceSetMap.h:32
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
Definition: core.h:2089
GLenum src
Definition: glcorearb.h:1793