HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Dot.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: OP_Dot.h (OP Library, C++)
7  *
8  * COMMENTS: A "dot" in a network that can have one input and many outputs.
9  * It is simply a placeholder for an incomplete (or completed
10  * connection between two nodes.
11  */
12 
13 #ifndef __OP_Dot__
14 #define __OP_Dot__
15 
16 #include "OP_API.h"
17 #include "OP_Input.h"
18 #include "OP_IndirectInput.h"
19 #include <UT/UT_String.h>
20 #include <UT/UT_Array.h>
21 
22 class OP_DotList;
23 
25 {
26 public:
27  OP_ItemType getItemType() const override
28  { return OP_ITEMTYPE_DOT; }
29  fpreal getW() const override
30  { return 0.0; }
31  fpreal getH() const override
32  { return 0.0; }
33  const UT_String &getItemName() const override;
34  bool setItemName(const UT_String &name) override;
35 
36  // Establishes a connection to our input. May come from a node, a subnet
37  // indirect input, or another dot.
38  void setInput(OP_NetworkBoxItem *item,
39  int outputidx,
40  bool for_delete_old_input = false);
41  OP_Input *getInputReference();
42  const OP_Input *getInputReferenceConst() const;
43  OP_NetworkBoxItem *getInputItem() const override;
44  int getInputItemOutputIndex() const override;
45 
46  // Accessors for the "pinned" state of this dot. Pinned dots are treated
47  // differently by the UI, but otherwise are the same as unpinned dots.
48  // setPinned returns true if the value was changed.
49  bool isPinned() const;
50  bool setPinned(bool pinned);
51 
52  /// Functions to get hip-file-unique ids for any item type.
53  static OP_Dot *lookupDot(int id);
54  int getUniqueId() const;
55  int64 getItemUniqueId() const override
56  { return getUniqueId(); }
57 
58  /// Returns the amount of memory owned by this OP_Dot
59  /// (JUST this class; not subclasses)
60  int64 getMemoryUsage(bool inclusive) const
61  {
62  int64 mem = inclusive ? sizeof(*this) : 0;
64  return mem;
65  }
66 
67 private:
68  OP_Dot(OP_Network &parent,
69  OP_DotList &dotlist,
70  const char *name);
71  ~OP_Dot() override;
72 
73  void setUniqueId(int id);
74 
75  OP_DotList &myDotList;
76  OP_Input *myInput;
77  UT_String myName;
78  int myUniqueId;
79  bool myPinned;
80 
81  // The OP_DotList and OP_Input classes are responsible for managing the
82  // connection references and the lifetime of dot objects.
83  friend class OP_DotList;
84 };
85 
86 #endif
87 
int64 getMemoryUsage(bool inclusive) const
OP_ItemType getItemType() const override
Our children should implement this and return what type of item they are.
Definition: OP_Dot.h:27
virtual OP_NetworkBoxItem * getInputItem() const =0
int64 getItemUniqueId() const override
Functions to get hip-file-unique ids for any item type.
Definition: OP_Dot.h:55
OP_ItemType
Definition: OP_ItemId.h:28
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: OP_Dot.h:24
virtual int getInputItemOutputIndex() const =0
fpreal getW() const override
Definition: OP_Dot.h:29
virtual const UT_String & getItemName() const =0
virtual bool setItemName(const UT_String &name)=0
fpreal64 fpreal
Definition: SYS_Types.h:277
#define OP_API
Definition: OP_API.h:10
fpreal getH() const override
Definition: OP_Dot.h:31
int64 getMemoryUsage(bool inclusive) const
Definition: OP_Dot.h:60