HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_GBPointRedirectArray.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: GA_GBPointRedirectArray.h ( GA Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GA_GBPointRedirectArray__
12 #define __GA_GBPointRedirectArray__
13 
14 #include "GA_API.h"
15 #include "GA_Types.h"
16 
17 #include <UT/UT_Assert.h>
18 #include <SYS/SYS_Types.h>
19 
20 #include <map>
21 
23 
24 /// @brief Class used to create a map of source points during merging
25 ///
26 /// This class is used only by mirror and should not be used in future code
27 /// The class stores a map of the points from the source geometry merged to
28 /// their newly created destination points. In the map's pair:
29 /// - first := destination point index
30 /// - second := source point index
31 /// Since the map is indexed based on the newly created points (destination
32 /// points), we use a map (rather than an array).
34 {
35 public:
36  SYS_DEPRECATED_HDK(13.0)
37  GA_GBPointRedirectArray(GA_Size size);
38  SYS_DEPRECATED_HDK(13.0)
39  ~GA_GBPointRedirectArray();
40 
41  /// Entries in the array
42  SYS_DEPRECATED_HDK(13.0)
43  GA_Size entries() const { return myMap.size(); }
44 
45  typedef std::map<GA_Index,GA_Index>::const_iterator const_iterator;
46 
47  /// Given the index of a point for the newly created merged point (after
48  /// the merge), get the original point's number from the source detail.
49  SYS_DEPRECATED_HDK(13.0)
50  GA_Index getSrc(GA_Index created) const
51  {
52  const_iterator it;
53  it = myMap.find(GA_Index(created));
54  UT_ASSERT(it != myMap.end());
55  return it->second;
56  }
57 
58  /// Clear the array and reserve memory for the map
59  SYS_DEPRECATED_HDK(13.0)
60  void clear() { clearAndResize(); }
61  SYS_DEPRECATED_HDK(13.0)
62  void clearAndResize(GA_Size newsize = 0)
63  {
64  myMap = std::map<GA_Index, GA_Index>();
65  }
66 
67  /// @{
68  /// Iterator over all the points in the map
69  /// - const_iterator->first == Point number in the merged result (dest)
70  /// - const_iterator->second == Point number in the merge source
71  SYS_DEPRECATED_HDK(13.0)
72  const_iterator begin() { return myMap.begin(); }
73  SYS_DEPRECATED_HDK(13.0)
74  const_iterator end() { return myMap.end(); }
75  /// @}
76 
77 private:
78  /// Set the map from the source to the created point
79  void setSrc(GA_Index src, GA_Index created) { myMap[created] = src; }
80 
81  std::map<GA_Index, GA_Index> myMap;
82 
83  // It's only when we merge that we build the map
84  friend class GA_MergeMap;
85 };
86 
88 
89 #endif
std::map< GA_Index, GA_Index >::const_iterator const_iterator
#define SYS_DEPRECATED_PUSH_DISABLE()
#define SYS_DEPRECATED_POP_DISABLE()
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
The merge map keeps track of information when merging details.
Definition: GA_MergeMap.h:53
#define GA_API
Definition: GA_API.h:12
exint GA_Size
Defines the bit width for index and offset types in GA.
Definition: GA_Types.h:211
GLsizeiptr size
Definition: glcorearb.h:663
Class used to create a map of source points during merging.
GLuint GLuint end
Definition: glcorearb.h:474
#define SYS_DEPRECATED_HDK(__V__)
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
png_infop png_sPLT_tpp entries
Definition: png.h:2481
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:126
GLenum src
Definition: glcorearb.h:1792