/*
 * Base Object for all the other (kinda polymorphism)
 *
 * Author(s) : Catalin Dumitrescu (catalind@acm.org)
 *
 * File: object.hh
 * Created: Mon Aug 27 10:15:57 CDT 2001
 *
 */

#ifndef _OBJECT_
#define _OBJECT_

#include <iostream>
using namespace std;

#include "scheme_exc.hh"

#define OBJECT 0

class object {

public:
  virtual object* clone () = 0;
  virtual object* evaluate (bool complete = false, object* obj = NULL) 
    {
      if (complete == true)
	{
	  object* val = NULL;
	  while (val != this)
	    { val = this->evaluate (true, obj); }
	  return val;
	}
      else
        { return this->evaluate (false, obj); }
    }
  virtual void* pvalue () = 0;
  virtual void print (ostream&) = 0;

  virtual int getType () { return OBJECT; }

  virtual void add (object*) { throw schemeException ("not implemented"); }
  virtual object* get (int) { throw schemeException ("not implemented"); }

  friend ostream& operator << (ostream& out, object& o) 
    { o.print (out); return out; }
  friend ostream& operator << (ostream& out, object* o) 
    { o->print (out); return out; }
};

#endif // _OBJECT_

