HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BRAY_ProceduralFactory.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: BRAY_ProceduralFactory.h (BRAY Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __BRAY_ProceduralFactory__
12 #define __BRAY_ProceduralFactory__
13 
14 #include "BRAY_API.h"
15 #include <GT/GT_Handles.h>
16 #include <UT/UT_Map.h>
17 #include <UT/UT_NonCopyable.h>
18 #include <UT/UT_StringHolder.h>
19 #include <UT/UT_StringMap.h>
20 #include "BRAY_Procedural.h"
21 
22 /// Provides an interface to bind Hydra USD primitives to Karma primitives.
23 ///
24 /// The constructor/destructor typically look like this: @code
25 /// Subclass::Subclass()
26 /// {
27 /// bind("tokenname");
28 /// }
29 /// Subclass::~Subclass()
30 /// {
31 /// unbind("tokenname");
32 /// }
33 /// @endcode
36 {
37 public:
38  /// When the factory is instantiated, it will be registered with the name
39  /// given.
41  virtual ~BRAY_ProceduralFactory();
42 
43  /// Return the name of the factory
44  const UT_StringHolder &name() const { return myName; }
45 
46  /// Create a procedural
47  virtual BRAY_Procedural *create() const = 0;
48 
49  /// @{
50  /// Get the static of supported parameters by the procedural
51  /// Procedurals are also given an opportunity to construct
52  /// on the fly tables after going through the list of attributes
53  /// defined on points.
54  virtual const BRAY_AttribList *paramList() const = 0;
55  /// @}
56 
57  /// The list of procedurals is stored in a map of {name, ProceduralFactory}
60 
61  /// @{
62  /// Access the list of all the registered procedurals
63  static const MapType &procedurals();
64  static iterator begin() { return procedurals().begin(); }
65  static iterator end() { return procedurals().end(); }
66  /// @}
67 
68  /// @{
69  /// Print list of procedural factory types
70  static void print();
71  static void print(UT_JSONWriter &w);
72  /// @}
73 
74 protected:
75  /// Provide some extra info for this procedural used when printing help
76  virtual const UT_StringHolder &extraHelp() const
77  {
79  }
80 private:
81  UT_StringHolder myName;
82 };
83 
84 extern "C" {
85  /// Register a new procedural. This method should allocate a new
86  /// sub-class of the BRAY_ProceduralFactory.
88 }
89 
90 #endif
GLuint const GLchar * name
Definition: glew.h:1814
#define SYS_VISIBILITY_EXPORT
const UT_StringHolder & name() const
Return the name of the factory.
virtual const UT_StringHolder & extraHelp() const
Provide some extra info for this procedural used when printing help.
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:34
static const UT_StringHolder theEmptyString
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
Parent::const_iterator const_iterator
Definition: UT_StringMap.h:51
MapType::const_iterator iterator
Each BRAY_Object can define a list of attributes that it can evaluate.
#define BRAY_API
Definition: BRAY_API.h:12
SYS_VISIBILITY_EXPORT void BRAYregisterProcedural()
std::enable_if< internal::is_string< S >::value >::type print(std::basic_ostream< FMT_CHAR(S)> &os, const S &format_str, const Args &...args)
Definition: ostream.h:146