// Class Name: operand // // Purpose: // // An operand is an element that flows to an operation as one of its inputs. #ifndef OPERAND_CLASS #define OPERAND_CLASS #include "strings.h" //#include "basics.h" //#include "chunk.h" class operand // : public chunk { public: operand(); ~operand(); // the type_name is the name of the element type for the operand. string type_name() const; void type_name(const string &name); string name() const; void name(const string &name); enum modification_types { UNSET, DOES_NOT_MODIFY, DOES_MODIFY }; // modifies: returns how the operand can be modified by its operation. modification_types modifies() const; void modifies(modification_types modifies); // well_formed: returns TRUE if the operand is well formed, meaning that: // 1) the type name for the operand is specified, // 2) the operand name is not necessarily specified, // 3) the modification ability on this operand is specified (not UNSET). int well_formed() const; // pack: returns a packed form of this operand that can be stored to disk. // virtual byte *pack(int &size) const; // unpack_operand: retrieves an operand from its packed form. // friend operand *unpack_operand(byte *packed_operand); // print: prints out the operand info. virtual void print() const; private: string my_name; string my_type_name; modification_types am_i_modified; }; #endif