00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __VOP_AutoConvert_h__
00029 #define __VOP_AutoConvert_h__
00030
00031 #include "VOP_API.h"
00032 #include "VOP_Node.h"
00033
00034
00035
00036 class VOP_API VOP_AutoConvert : public VOP_Node
00037 {
00038 public:
00039 VOP_AutoConvert(OP_Network *net);
00040 virtual ~VOP_AutoConvert();
00041
00042 static bool canAutoconvert(VOP_Type intype, VOP_Type outtype);
00043
00044
00045
00046 virtual void getPathWithSubnet(UT_String &str) const;
00047 virtual void getOuterCode(UT_String &codestr);
00048 virtual void getCode(UT_String &codestr);
00049
00050 virtual OP_Network *getParentNetwork() const;
00051
00052 virtual OP_Input *getInputReference(unsigned idx, int grow=1);
00053 virtual OP_Input *getInputReferenceConst(unsigned idx) const;
00054
00055 void hookupBetween(VOP_Node* input_node, VOP_Node* output_node, int input_idx, bool tell_nodes);
00056
00057 virtual bool isConnected(int inputidx, bool recursive);
00058 virtual unsigned getNumVisibleInputs() const;
00059 virtual unsigned getNumVisibleOutputs() const;
00060 virtual const char *inputLabel(unsigned idx) const;
00061 virtual const char *outputLabel(unsigned idx) const;
00062
00063 static void initConversions(void);
00064
00065 static const char* getAutoConvertOpName(VOP_Type from_type, VOP_Type to_type);
00066
00067 protected:
00068
00069 virtual void getInputNameSubclass(UT_String &in, int idx) const;
00070 virtual int getInputFromNameSubclass(const UT_String &in) const;
00071 virtual VOP_Type getInputTypeSubclass(int idx);
00072
00073 virtual void getOutputNameSubclass(UT_String &out, int idx) const;
00074 virtual VOP_Type getOutputTypeSubclass(int idx);
00075
00076 static void getConversionBetween(VOP_Type intype, VOP_Type outtype, string& out);
00077
00078 private:
00079
00080
00081
00082
00083
00084
00085 VOP_Node *myInput, *myOutput;
00086 int myInputIdx;
00087
00088
00089 static string theConversionTable[VOP_MAX_TYPES][VOP_MAX_TYPES];
00090 static bool theDidInitConversions;
00091 static string theConversionNodeNameTable[VOP_MAX_TYPES][VOP_MAX_TYPES];
00092
00093 VOP_Type myConvertedOutputType;
00094 };
00095
00096 #endif