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 
22 
23 // ============================================================================
24 /// A light-weight handle for a node parameter data.
25 ///
26 /// The actual parameter data (UN_ParmData) is owned and managed by
27 /// UN_GraphData, and UN_Parm serves as a handle for clients to refer to
28 /// that parm data.
29 
30 class UN_API UN_Parm : public UN_Handle
31 {
32 public:
33  /// Convenience constructor for the wire handle.
34  UN_Parm( UN_GraphData *graph_data,
35  UN_ParmIndex parm_index,
36  UN_ParmID parm_id );
37 
38  /// @{ Default destructor, constructors and assignment operators.
39  UN_Parm();
40  ~UN_Parm();
41  UN_Parm( const UN_Parm & );
42  UN_Parm( UN_Parm && );
43  UN_Parm & operator=( const UN_Parm & );
44  UN_Parm & operator=( UN_Parm && );
45  /// @}
46 
47  /// @{ Returns true if the parameter exists; false otherwise.
48  bool isValid() const;
49  explicit operator bool() const
50  { return isValid(); }
51  /// @}
52 
53  /// @{ Comparison operators
54  bool operator==( const UN_Parm &other ) const
55  { return UN_Handle::operator==( other ); }
56  bool operator!=( const UN_Parm &other ) const
57  { return UN_Handle::operator!=( other ); }
58  /// @}
59 
60  /// Returns the node this parameter belongs to.
61  UN_Node node() const;
62 
63  /// Returns the name of the parameter.
64  UT_StringHolder name() const;
65 
66  /// Returns the name of the type of the parameter.
67  UT_StringHolder typeName() const;
68 
69  /// @{ Sets the parameter value.
70  void setValue( const UT_OptionEntry &opt ) const;
71  void setValue( UT_OptionEntryPtr &&opt ) const;
72  /// @}
73 
74  /// Returns the value of the parameter.
75  UT_OptionEntryPtr value() const;
76 
77  /// Deletes this parameter.
78  void destroy() const;
79 
80  /// Returns the parm data index this handle refers to.
82  { return UN_ParmIndex( dataIndex() ); }
83 
84  /// Returns the unique ID of the parm data this handle refers to.
85  UN_ParmID parmID() const
86  { return UN_ParmID( dataID() ); }
87 };
88 
89 #endif
90 
UN_ParmID parmID() const
Returns the unique ID of the parm data this handle refers to.
Definition: UN_Parm.h:85
GLsizei const GLfloat * value
Definition: glcorearb.h:824
UN_DataID dataID() const
The unique ID of a data object during the lifespan of the owner graph.
Definition: UN_Handle.h:74
bool operator==(const UN_Parm &other) const
Comparison operators.
Definition: UN_Parm.h:54
#define UN_API
Definition: UN_API.h:11
bool operator==(const UN_Handle &other) const
Comparison operators.
Definition: UN_Handle.h:53
A parameter ID.
Definition: UN_Types.h:309
UN_DataIndex dataIndex() const
Definition: UN_Handle.h:70
UN_ParmIndex parmIndex() const
Returns the parm data index this handle refers to.
Definition: UN_Parm.h:81
bool operator!=(const UN_Handle &other) const
Comparison operators.
Definition: UN_Handle.h:60
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:56
UT_UniquePtr< UT_OptionEntry > UT_OptionEntryPtr