Doesn't compile yet. Working on it.
[lispp.git] / LispFloat.h
blob977723e0a118b51d5d9ed358be055f72642b83fb
1 #if !defined(H_LISPFLOAT)
2 #define H_LISPFLOAT
4 namespace Lisp
5 {
7 class Floatnum : public Obj
9 public:
11 typedef Floatnum* FloatnumPtr;
12 typedef Floatnum& FloatnumRef;
14 Floatnum() : value_(0.0)
15 {};
17 Floatnum(const Floatnum& other)
19 if (this != &other)
20 value_ = other.value_;
23 virtual eObjectType getObjectType() const
25 return eFloatnumObj;
28 virtual Floatnum* create(void) const
30 Floatnum *result = new Floatnum();
31 return result;
34 virtual Floatnum* clone() const
36 Floatnum* result = new Floatnum(*this);
37 return result;
40 void print(std::ostream& out) const
42 out << value_;
45 bool operator==(const Obj* other)
47 bool result = false;
48 if (other->getObjectType() == eFloatnumObj)
49 result = ( value_ == dynamic_cast<const Floatnum *>(other)->value_ );
50 return result;
53 private:
54 FloatnumValue value_;
59 #endif