HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual OP_ItemType getItemType() const
28  { return OP_ITEMTYPE_DOT; }
29  virtual fpreal getW() const
30  { return 0.0; }
31  virtual fpreal getH() const
32  { return 0.0; }
33  virtual const UT_String &getItemName() const;
34  virtual bool setItemName(const UT_String &name);
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  virtual OP_NetworkBoxItem *getInputItem() const;
44  virtual int getInputItemOutputIndex() const;
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  virtual int64 getItemUniqueId() const
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  virtual ~OP_Dot();
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
virtual OP_NetworkBoxItem * getInputItem() const =0
OP_ItemType
Definition: OP_ItemId.h:23
long long int64
Definition: SYS_Types.h:100
virtual OP_ItemType getItemType() const
Our children should implement this and return what type of item they are.
Definition: OP_Dot.h:27
virtual fpreal getW() const
Definition: OP_Dot.h:29
GLuint const GLchar * name
Definition: glcorearb.h:785
Definition: OP_Dot.h:24
virtual int getInputItemOutputIndex() const =0
double fpreal
Definition: SYS_Types.h:263
virtual const UT_String & getItemName() const =0
virtual bool setItemName(const UT_String &name)=0
#define OP_API
Definition: OP_API.h:10
virtual fpreal getH() const
Definition: OP_Dot.h:31
virtual int64 getItemUniqueId() const
Functions to get hip-file-unique ids for any item type.
Definition: OP_Dot.h:55
int64 getMemoryUsage(bool inclusive) const
Definition: OP_Dot.h:60