HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GT_RefineCollect.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_RefineCollect.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_RefineCollect__
12 #define __GT_RefineCollect__
13 
14 #include "GT_API.h"
15 #include "GT_Refine.h"
16 #include "GT_Handles.h"
17 #include "GT_PrimCollect.h"
18 #include <UT/UT_Array.h>
19 
20 /// A simple refiner which just collects the refined primitives in a list
22 {
23 public:
24  /// Default constructor
26  /// The primitive handle @b must be a handle to a primitive collection
27  /// If the primitive is not a collection, the refiner will allocate its own
28  /// collection (as the default behaviour)
29  GT_RefineCollect(const GT_PrimitiveHandle &collection);
30  /// D-tor
31  ~GT_RefineCollect() override;
32 
33  /// Clear the collection
34  void clear();
35 
36  /// @{
37  /// Accessor
38  const GT_PrimitiveHandle &getPrim() const
39  { return myList; }
41  { return getList(); }
42  exint entries() const
43  {
44  const GT_PrimCollect *cprim = getList();
45  return cprim ? cprim->entries() : 0;
46  }
48  { return getList()->getPrim(i); }
49  /// @}
50 
51  /// @{
52  /// Implemented from GT_Refine
53  bool allowThreading() const override { return true; }
54  void addPrimitive(const GT_PrimitiveHandle &prim) override;
55  /// @}
56 
57 private:
58  const GT_PrimCollect *getList() const
59  {
60  return UTverify_cast<const GT_PrimCollect *>(myList.get());
61  }
62 
63  GT_PrimitiveHandle myList;
64 };
65 
66 #endif
const GT_PrimitiveHandle & getPrim() const
bool allowThreading() const override
#define GT_API
Definition: GT_API.h:13
int64 exint
Definition: SYS_Types.h:125
virtual void addPrimitive(const GT_PrimitiveHandle &prim)=0
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
Definition: UT_Assert.h:229
const GT_PrimCollect * getPrimCollect() const
A simple refiner which just collects the refined primitives in a list.
GT_PrimitiveHandle getPrim(int i) const
Processes primitives generated by refinement process.
Definition: GT_Refine.h:20
exint entries() const
Return the number of primitives in the collection.
exint entries() const