HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_Parm.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: UN_Parm.h ( UN Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __UN_Parm_h__
13 #define __UN_Parm_h__
14 
15 #include "UN_API.h"
16 #include "UN_Handle.h"
17 #include <UT/UT_OptionEntry.h>
18 #include <UT/UT_StringHolder.h>
19 
20 class UN_Node;
21 class UN_ParmData;
22 
23 
24 // ============================================================================
25 /// A light-weight handle for a node parameter data.
26 ///
27 /// The actual parameter data (UN_ParmData) is owned and managed by
28 /// UN_GraphData, and UN_Parm serves as a handle for clients to refer to
29 /// that parm data.
30 
31 class UN_API UN_Parm : public UN_Handle
32 {
33 public:
34  /// Convenience constructor for the parameter handle.
35  UN_Parm( UN_GraphData *graph_data, UN_ParmID parm_id );
36 
37  /// @{ Default destructor, constructors and assignment operators.
38  UN_Parm();
39  ~UN_Parm();
40  UN_Parm( const UN_Parm & );
41  UN_Parm( UN_Parm && );
42  UN_Parm & operator=( const UN_Parm & );
43  UN_Parm & operator=( UN_Parm && );
44  /// @}
45 
46  /// @{ Returns true if the parameter exists; false otherwise.
47  bool isValid() const;
48  explicit operator bool() const
49  { return isValid(); }
50  /// @}
51 
52  /// @{ Comparison operators
53  bool operator==( const UN_Parm &other ) const
54  { return UN_Handle::operator==( other ); }
55  bool operator!=( const UN_Parm &other ) const
56  { return UN_Handle::operator!=( other ); }
57  /// @}
58 
59  /// Returns the node this parameter belongs to.
60  UN_Node node() const;
61 
62  /// Returns the name of the parameter.
63  UT_StringHolder name() const;
64 
65  /// Returns the name of the type of the parameter.
66  UT_StringHolder typeName() const;
67 
68  /// @{ Sets the parameter value.
69  void setValue( const UT_OptionEntry &opt ) const;
70  void setValue( UT_OptionEntryPtr &&opt ) const;
71  /// @}
72 
73  /// Returns the value of the parameter.
74  UT_OptionEntryPtr value() const;
75 
76  /// Deletes this parameter.
77  void destroy() const;
78 
79  /// Returns the unique ID of the parm data this handle refers to.
80  UN_ParmID parmID() const
81  { return UN_ParmID( dataID() ); }
82 
83 protected:
84  /// The parm data container for all the ports in the graph.
85  UN_ParmData * parmData() const;
86 };
87 
88 #endif
89 
UN_ParmID parmID() const
Returns the unique ID of the parm data this handle refers to.
Definition: UN_Parm.h:80
GLsizei const GLfloat * value
Definition: glcorearb.h:824
UN_DataID dataID() const
Definition: UN_Handle.h:66
bool operator==(const UN_Parm &other) const
Comparison operators.
Definition: UN_Parm.h:53
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:5750
#define UN_API
Definition: UN_API.h:11
bool operator==(const UN_Handle &other) const
Comparison operators.
Definition: UN_Handle.h:50
bool operator!=(const UN_Handle &other) const
Comparison operators.
Definition: UN_Handle.h:56
UN_Handle & operator=(const UN_Handle &)=default
Default destructor, constructors and assignment operators.
bool operator!=(const UN_Parm &other) const
Comparison operators.
Definition: UN_Parm.h:55
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr