#ifndef VLVALUE_HEADER #define VLVALUE_HEADER 1 /////////////////////////////////////////////////////////////// //! file="amma/Logic/Basic/LValue.hh" //! lib=VLBasic //! userlevel=Normal //! date="03/07/96" //! docentry="Logic.Basic" //! rcsid="$Id: LValue.hh,v 1.20 2000/07/14 14:30:09 ees1cg Exp $" //! author="Charles Galambos" #include "amma/Logic2/LSymb.hh" class VLContext; //: Logical value. class VLValue : public VLSymb { public: inline VLValue() : VLSymb() {} // Default constructor. inline VLValue(const VLValue &/*Oth*/) : VLSymb() {} // Copy constructor. virtual ~VLValue() {} // Destructor. virtual VLSymbC SymbCopy(void) const { return VLSymbC(*new VLValue(*this)); } // Make a copy of this object on the heap. virtual BooleanT IsSimple(void) const { return True; } // Is this a simpe object with no variables, I think so. virtual BooleanT Unify(const VLSymb &Other,VLBindLst &SF) const; // Unify with other values ? }; /////////////////////////////// //: Integer Value class VLValInt : public VLValue { public: inline VLValInt(int Val) { Value = Val; } inline VLValInt(const VLValInt &Oth) : VLValue(Oth), Value(Oth.Value) {} // Copy constructor. virtual ~VLValInt() {} // Destructor. virtual VLSymbC SymbCopy(void) const { return VLSymbC(*new VLValInt(*this)); } // Make a copy of this object on the heap. void SetInt(int Val) { Value = Val; } // Set value. int GetInt(void) const { return Value; } // Get value. virtual BooleanT IsEqual(const VLSymb &Other) const; // Is equal to another ValInt ? virtual StringC GetName(StringC buff = StringC()) const; // Turn this into a string. virtual VLValInt *IsValInt() const { return (VLValInt *) this; } // Dynamic type cast. private: int Value; }; /////////////////////////////// //: Floating point value. class VLValFloat : public VLValue { public: inline VLValFloat(double Val) : Value(Val) {} inline VLValFloat(const VLValFloat &Oth) : VLValue(Oth), Value(Oth.Value) {} // Copy constructor. virtual VLSymbC SymbCopy(void) const { return VLSymbC(*new VLValFloat(*this)); } // Make a copy of this object on the heap. void SetFloat(double Val) { Value = Val; } // Set value. double GetFloat(void) const { return Value; } // Get value. virtual BooleanT IsEqual(const VLSymb &Other) const; // Is equal to another ValFloat ? virtual StringC GetName(StringC Buff = StringC()) const; // Turn this into a string. virtual VLValFloat *IsValFloat() const { return (VLValFloat *) this; } // Type cast. private: double Value; }; /////////////////////////////// //: String. class VLValStr : public VLValue { public: VLValStr(StringC Val); // Constructor. VLValStr(const VLValStr &Oth) : VLValue(Oth), Value(Oth.Value) {} // Copy constructor. virtual ~VLValStr(); // Destructor. virtual VLSymbC SymbCopy(void) const { return VLSymbC(*new VLValStr(*this)); } // Make a copy of this object on the heap. void SetStr(StringC Val) { Value = Val.Copy(); } // Set string. StringC GetStr(void) const { return Value; } // Get value of string. BooleanT IsEqual(const StringC Text) const; // Is this equal to another ? virtual BooleanT IsEqual(const VLSymb &Other) const; // Is this equal to another ? virtual StringC GetName(StringC Buff = StringC()) const; // Turn this into a string. virtual VLValStr *IsValStr() const { return (VLValStr *) this; } private: StringC Value; }; #endif