//========================================================================= //$Id$ // //File description // //TO-DO: // 1. Operator contains an OperatorType object + a string customization, // while Operator class is just a string, so why not combine these? //========================================================================= #ifndef OPERATOR_H #define OPERATOR_H //--------------------------------------------------------------------- //Header files inclusion //--------------------------------------------------------------------- #include using namespace std; //--------------------------------------------------------------------- //Interface // An interface for DFG operator types. // // Objects of this class do not show up in DFG (Objects of type Operator are // Nodes within the DFG). OperatorType objects represent a class // of "compatible" operations. // // There will be a notion of relationships between operator types // (i.e. some operatortypes are compatible with others). A partial order. // // Example operator types include Addition, mulitplication, etc. //--------------------------------------------------------------------- class OperatorType { public: virtual string getMnemonic(void) = 0; }; //--------------------------------------------------------------------- //Derived class from interface OperatorType //--------------------------------------------------------------------- class BasicOperatorType: public OperatorType{ public: BasicOperatorType(string mnemonic) : _mnemonic(mnemonic) {}; string getMnemonic() {return _mnemonic; } private: string _mnemonic; }; //--------------------------------------------------------------------- //Interface // Represents a specific operator within a DFG. // Objects of this type may appear multiple times within a DFG. // Only operators with "unique" parameters are new objects in DFG. //--------------------------------------------------------------------- class Operator{ public: virtual OperatorType* getOperatorType() = 0 ; }; //--------------------------------------------------------------------- //Derived class from interface Operator //--------------------------------------------------------------------- class BasicOperator : public Operator{ public: BasicOperator() {}; BasicOperator(OperatorType* type) : _type(type) {}; BasicOperator(OperatorType* type, string cust) : _type(type), _cust(cust) {}; OperatorType* getOperatorType() { return _type; } private: OperatorType* _type; string _cust; }; #endif