#include <casobject.h>
Inheritance diagram for CASObject:

Public Member Functions | |
| virtual CASObject * | Absolute () const =0 |
| Returns the object as absolute value. | |
| virtual void | AbsoluteIP ()=0 |
| Makes the absolute value of the object in place. | |
| virtual CASObject * | Add (const CASObject *addend) const =0 |
| Adds another object to this. | |
| CASObject () | |
| Constructor. | |
| virtual CASObject * | Clone () const =0 |
| Clones the object. | |
| virtual CASObject * | Divide (const CASObject *divisor) const =0 |
| Divides this object by another. | |
| virtual CASObject * | Evaluate () const =0 |
| Evaluates the object. | |
| virtual CASObject * | GCD (const CASObject *o) const =0 |
| Computes the GCD of two objects. | |
| virtual void | Get (char *s, unsigned long size) const =0 |
| Retrieves the string representation of the object as a C string. | |
| virtual void | Get (std::string &s) const =0 |
| Retrieves the string representation of the object as a std::string. | |
| virtual CASType | GetType () const =0 |
| Returns the CAS Type of the object. | |
| virtual CASObject * | Invert () const =0 |
| Returns the inverse value of the object. | |
| virtual void | InvertIP ()=0 |
| Inverts the value of the object in place. | |
| virtual bool | IsEqual (const CASObject *o) const =0 |
| Tests whether two objects are equal. | |
| virtual bool | IsGT (const CASObject *o) const =0 |
| Tests whether one object is greater than another object. | |
| virtual bool | IsLT (const CASObject *o) const =0 |
| Tests whether one object is less than another object. | |
| virtual bool | IsOne () const =0 |
| Indicates whether or not the object is one. | |
| virtual bool | IsPureNumerical () const =0 |
| Indicates whether the object is a pure numerical object. | |
| virtual bool | IsSimilar (const CASObject *o) const =0 |
| Indicates whether or not another object is similar to this. | |
| virtual bool | IsZero () const =0 |
| Indicates whether or not the object is zero. | |
| virtual unsigned long | Length () const =0 |
| Returns the length of the object. | |
| virtual CASObject * | Modulo (const CASObject *divisor) const =0 |
| Computes the modulus. | |
| virtual CASObject * | Multiply (const CASObject *factor) const =0 |
| Multiplies another object with this object. | |
| virtual CASObject * | Power (const CASObject *exponent) const =0 |
| Raises this object to the x-th power. | |
| virtual void | Print () const =0 |
| Prints the object to stdout. | |
| virtual void | Sort ()=0 |
| Provides a sorting interface. | |
| virtual CASObject * | SortWeight () const =0 |
| Determines the sort weight of two identical CASObject types. | |
| virtual CASObject * | Subtract (const CASObject *subtrahend) const =0 |
| Subtracts another object from this object. | |
| virtual | ~CASObject () |
| Destructor. | |
Public Attributes | |
| CASObject * | exponent |
| The exponent of the ECAS object. | |
| CASMetaInfo | meta |
| Object holding meta information regarding the object. | |
Static Public Attributes | |
| static class CASGarbage * | Garbage = new CASGarbage() |
| The object responsible for handling garbage. | |
Friends | |
| class | CASAbsoluteObjectIP |
| class | CASInvertObjectIP |
Those methods provide a common interface to each ECAS class.
Definition at line 146 of file casobject.h.
| CASObject::CASObject | ( | ) | [inline] |
Constructor. Initializes exponent to 0 ('zero').
Definition at line 532 of file casobject.h.
| virtual CASObject::~CASObject | ( | ) | [inline, virtual] |
Destructor. Does nothing.
Definition at line 539 of file casobject.h.
| virtual CASObject* CASObject::Absolute | ( | ) | const [pure virtual] |
Gives the absolute form of the object. The pointer to the CASObject has to be freed by the caller.
CASObject* pointing to the absolute representation of the object. The caller is responsible for freeing the memory occupied by the newly created object. Implemented in Fraction, LongInt, Product, Sum, and Variable.
| virtual void CASObject::AbsoluteIP | ( | ) | [pure virtual] |
| virtual CASObject* CASObject::Clone | ( | ) | const [pure virtual] |
The Clone() function is responsible for cloning the object. This implies, creating a new copy of the object in the memory and returns a CASObject pointer to the newly created object. The caller is responsible for freeing the memory occupied by that object.
CASObject pointer to the newly created object. Implemented in Fraction, LongInt, Product, Sum, and Variable.
| virtual CASObject* CASObject::Evaluate | ( | ) | const [pure virtual] |
Evaluates the object and thus gives him the evaluated form. Evaluating means to bring the object into the simplest possible form.
However, evaluation is not done in-place. The method returns a new CASObject representing the evaluated form, which has to be delete from memory by the caller.
CASObject representing the evaluated form. The evaluated form is not necessarily of the same type as this object. Be aware! Implemented in Fraction, LongInt, Product, Sum, and Variable.
| virtual void CASObject::Get | ( | char * | s, | |
| unsigned long | size | |||
| ) | const [pure virtual] |
| virtual void CASObject::Get | ( | std::string & | s | ) | const [pure virtual] |
| virtual CASType CASObject::GetType | ( | ) | const [pure virtual] |
This method returns the type of the object. It should only be implemented by classes which are not abstract. It is used to determine the type of the object without relying on the RTTI information and thus avoiding unnecessary casts.
See castype.h for a complete list of supported values.
castype.h. Implemented in Fraction, LongInt, Product, Sum, and Variable.
| virtual CASObject* CASObject::Invert | ( | ) | const [pure virtual] |
| virtual void CASObject::InvertIP | ( | ) | [pure virtual] |
Inverts the object in place, e.g. the object is modified.
Implemented in CASNumeric, Fraction, Product, Sum, and Variable.
| virtual bool CASObject::IsEqual | ( | const CASObject * | o | ) | const [pure virtual] |
| virtual bool CASObject::IsGT | ( | const CASObject * | o | ) | const [pure virtual] |
Tests whether this object is greater than o. Both objects have to be in their evaluated form.
| o | Pointer to a CASObject which this is tested against. |
true if this object is greater than o, false if this object is not greater than o. | virtual bool CASObject::IsLT | ( | const CASObject * | o | ) | const [pure virtual] |
| virtual bool CASObject::IsOne | ( | ) | const [pure virtual] |
| virtual bool CASObject::IsPureNumerical | ( | ) | const [pure virtual] |
Indicates whether or not this object is a pure numerical object. An object is called pure numerical, if there is no symbolic component in it, e.g. '(a/2)' is not a pure numerical object, but '(2/3)' is. However, it might depend on the use of the class, what is considered pure numerical. But in most cases the afore mentioned convention is sufficient.
true if this is a pure numerical object, false if it is not. | virtual bool CASObject::IsSimilar | ( | const CASObject * | o | ) | const [pure virtual] |
Indicates whether or not another object is similar to this. This is not a strict mathematical function. For instance, '(a+b)' should be considered similar to '(a+b)^2' in its unevaluated form. This method is mostly used for collecting operands. What is considered similar depends on the usage of this method.
| o | pointer to a CASObject. |
true if this and o are similar, false otherwise. Implemented in Fraction, LongInt, Product, Sum, and Variable.
| virtual bool CASObject::IsZero | ( | ) | const [pure virtual] |
| virtual unsigned long CASObject::Length | ( | ) | const [pure virtual] |
| virtual void CASObject::Print | ( | ) | const [pure virtual] |
| virtual void CASObject::Sort | ( | ) | [pure virtual] |
| virtual CASObject* CASObject::SortWeight | ( | ) | const [pure virtual] |
This method evolved from the circumstance, that if one sorts a list of CASObjects of the same type, it could be difficult to decide which one is greater than one other. Assume the case we have to sort the products '(a*b)' and '(a*c)' in a sum '(a*b)+(a*c)', we cannot decide which one is greater using the IsGT() or IsLT() method, we would have to alter its mathematical meaning. Therefore each descendant of the CASObject class has to define a SortWeight() method, returning an LongInt which is then used to decide how to sort.
Performs an arithmetic subtraction on the object. The new CASObject returned has to be freed by the caller.
| subtrahend | Pointer to a CASObject. |
CASObject holding the difference of this object and subtrahend. Implemented in Fraction, LongInt, Product, Sum, and Variable.
This object holds the exponent of the object. In any case, it is expected to be initialized to an appropriate value or an LongInt object with value 1 (`one').
Definition at line 155 of file casobject.h.
CASGarbage * CASObject::Garbage = new CASGarbage() [static] |
Throughout ECAS, objects are deleted from memory by putting them into the garbage. The garbage trasher thread takes care of removing them from memory.
Definition at line 173 of file casobject.h.
See CASMetaInfo for the possible information stored in that object.
Definition at line 164 of file casobject.h.
1.4.7