00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Mark Elendt 00008 * Side Effects Software Inc 00009 * 123 Richmond Street West, Suite 1401 00010 * Toronto, Ontario 00011 * Canada M5J 2M2 00012 * 416-504-9876 00013 * 00014 * NAME: DOP_InOutInfo.h ( DOP Library, C++) 00015 * 00016 * COMMENTS: Input/output connection information for DOPs. 00017 */ 00018 00019 #ifndef __DOP_InOutInfo__ 00020 #define __DOP_InOutInfo__ 00021 00022 #include "DOP_API.h" 00023 00024 #include <UT/UT_Assert.h> 00025 00026 class DOP_Node; 00027 00028 typedef enum { 00029 DOP_INOUT_OBJECTS, 00030 DOP_INOUT_DATA, 00031 DOP_INOUT_RELDATA, 00032 DOP_INOUT_ANY, // Matches any data type. 00033 DOP_INOUT_INVALID 00034 } DOP_InOutDataType; 00035 00036 class DOP_API DOP_InOutInfo 00037 { 00038 public: 00039 DOP_InOutInfo() 00040 : myDataType(DOP_INOUT_INVALID), 00041 myIsRepetitive(false) 00042 { } 00043 DOP_InOutInfo(DOP_InOutDataType datatype, 00044 bool isrepetitive) 00045 : myDataType(datatype), 00046 myIsRepetitive(isrepetitive) 00047 { } 00048 DOP_InOutInfo(const DOP_InOutInfo &src) 00049 { *this = src; } 00050 ~DOP_InOutInfo() 00051 { } 00052 00053 const DOP_InOutInfo &operator=(const DOP_InOutInfo &src) 00054 { 00055 myDataType = src.getDataType(); 00056 myIsRepetitive = src.getIsRepetitive(); 00057 00058 return *this; 00059 } 00060 bool operator==(const DOP_InOutInfo &src) 00061 { 00062 return (myDataType == src.getDataType() && 00063 myIsRepetitive == src.getIsRepetitive()); 00064 } 00065 00066 bool getIsRepetitive() const 00067 { return myIsRepetitive; } 00068 00069 /// Returns the primary type of this connection. One should use 00070 /// matchesDataType to properly handle variadic DOPs. 00071 DOP_InOutDataType getDataType() const 00072 { return myDataType; } 00073 00074 static const char *getLabelText(DOP_InOutDataType type) 00075 { 00076 switch (type) 00077 { 00078 case DOP_INOUT_OBJECTS: 00079 return "Objects to be processed"; 00080 case DOP_INOUT_DATA: 00081 return "Data to be attached"; 00082 case DOP_INOUT_RELDATA: 00083 return "Relationships to create"; 00084 case DOP_INOUT_ANY: 00085 return "Any node type"; 00086 case DOP_INOUT_INVALID: 00087 return "Invalid node type"; 00088 break; 00089 } 00090 UT_ASSERT(0); 00091 return "Invalid node type"; 00092 } 00093 00094 const char *getLabelText() const 00095 { 00096 return getLabelText(getDataType()); 00097 } 00098 00099 /// Returns true if this connection can match the given type. 00100 bool matchesDataType(DOP_InOutDataType type) const 00101 { 00102 // Trivially false cases. 00103 if (type == DOP_INOUT_INVALID) 00104 return false; 00105 if (getDataType() == DOP_INOUT_INVALID) 00106 return false; 00107 // Trivially true cases. 00108 if (type == DOP_INOUT_ANY) 00109 return true; 00110 if (getDataType() == DOP_INOUT_ANY) 00111 return true; 00112 // Final possibillity 00113 return (type == getDataType()); 00114 } 00115 00116 private: 00117 DOP_InOutDataType myDataType; 00118 bool myIsRepetitive; 00119 }; 00120 00121 #endif
1.5.9