HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DOP_InOutInfo.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: DOP_InOutInfo.h ( DOP Library, C++)
7  *
8  * COMMENTS: Input/output connection information for DOPs.
9  */
10 
11 #ifndef __DOP_InOutInfo__
12 #define __DOP_InOutInfo__
13 
14 #include "DOP_API.h"
15 
16 #include <UT/UT_Assert.h>
17 
18 class DOP_Node;
19 
20 typedef enum {
25  DOP_INOUT_ANY, // Matches any data type.
28 
30 {
31 public:
33  : myDataType(DOP_INOUT_INVALID),
34  myIsRepetitive(false)
35  { }
37  bool isrepetitive)
38  : myDataType(datatype),
39  myIsRepetitive(isrepetitive)
40  { }
42  { *this = src; }
44  { }
45 
47  {
48  myDataType = src.getDataType();
49  myIsRepetitive = src.getIsRepetitive();
50 
51  return *this;
52  }
54  {
55  return (myDataType == src.getDataType() &&
56  myIsRepetitive == src.getIsRepetitive());
57  }
58 
59  bool getIsRepetitive() const
60  { return myIsRepetitive; }
61 
62  /// Returns the primary type of this connection. One should use
63  /// matchesDataType to properly handle variadic DOPs.
65  { return myDataType; }
66 
67  static const char *getLabelText(DOP_InOutDataType type)
68  {
69  switch (type)
70  {
71  case DOP_INOUT_OBJECTS:
72  return "Objects to be processed";
73  case DOP_INOUT_DATA:
74  return "Data to be attached";
75  case DOP_INOUT_SOLVER:
76  return "Solvers to be attached";
77  case DOP_INOUT_RELDATA:
78  return "Relationships to create";
79  case DOP_INOUT_ANY:
80  return "Any node type";
81  case DOP_INOUT_INVALID:
82  return "Invalid node type";
83  break;
84  }
85  UT_ASSERT(0);
86  return "Invalid node type";
87  }
88 
89  const char *getLabelText() const
90  {
91  return getLabelText(getDataType());
92  }
93 
94  /// Returns true if this connection can match the given type.
96  {
97  // Trivially false cases.
98  if (type == DOP_INOUT_INVALID)
99  return false;
100  if (getDataType() == DOP_INOUT_INVALID)
101  return false;
102  // Trivially true cases.
103  if (type == DOP_INOUT_ANY)
104  return true;
105  if (getDataType() == DOP_INOUT_ANY)
106  return true;
107  // SOLVER and DATA are cross-compatible
108  if (getDataType() == DOP_INOUT_SOLVER &&
109  type == DOP_INOUT_DATA)
110  return true;
111  if (getDataType() == DOP_INOUT_DATA &&
112  type == DOP_INOUT_SOLVER)
113  return true;
114  // Final possibillity
115  return (type == getDataType());
116  }
117 
118 private:
119  DOP_InOutDataType myDataType;
120  bool myIsRepetitive;
121 };
122 
123 #endif
bool matchesDataType(DOP_InOutDataType type) const
Returns true if this connection can match the given type.
Definition: DOP_InOutInfo.h:95
#define DOP_API
Definition: DOP_API.h:10
DOP_InOutInfo(const DOP_InOutInfo &src)
Definition: DOP_InOutInfo.h:41
bool operator==(const DOP_InOutInfo &src)
Definition: DOP_InOutInfo.h:53
static const char * getLabelText(DOP_InOutDataType type)
Definition: DOP_InOutInfo.h:67
DOP_InOutDataType
Definition: DOP_InOutInfo.h:20
DOP_InOutDataType getDataType() const
Definition: DOP_InOutInfo.h:64
const char * getLabelText() const
Definition: DOP_InOutInfo.h:89
DOP_InOutInfo(DOP_InOutDataType datatype, bool isrepetitive)
Definition: DOP_InOutInfo.h:36
This is the base class for all DOP nodes.
Definition: DOP_Node.h:77
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:156
const DOP_InOutInfo & operator=(const DOP_InOutInfo &src)
Definition: DOP_InOutInfo.h:46
type
Definition: core.h:1059
bool getIsRepetitive() const
Definition: DOP_InOutInfo.h:59
GLenum src
Definition: glcorearb.h:1793