#ifndef REFERENCE_H
#define REFERENCE_H
// joycub V2 - an interpeter for the programming language Joy
// (c) 2004-2006 Sergey Zubkov 
//static char RCSID[] ="$Id: reference.h,v 1.10 2006/02/27 18:44:01 cubbi Exp $";

// used by print_banner() and J2_dataobj::debug_print()
#include <iostream>
#include <vector>
#include <string>
#include "globals.h"
#include "object.h"
#include "pool.h"
#include "list.h"
#include "file.h"

// global object counters (for memory debugging)
extern int ref_type_count;

class JC_list;
class JC_objref {
private: 
	obj_type content_type; // type of object referenced
	Pool::iterator it;     // index into POOL[content_type]

	JC_list* agg;			// aggregate objects are stored explicitly
public:
	JC_objref(JC_object* a);
	~JC_objref();
	JC_objref(const JC_objref&);

	bool is_agg() const;
	std::string to_string() const;
	std::string to_output_string() const;
	std::string key();
	JC_list& to_agg() const;
	int to_int() const;
	double to_double() const;
	bool to_bool() const;
	FILE* to_file() const;
	const obj_type get_type() const;
	int get_opnum() const;
	inline char to_char() const { return (char)to_int(); };
	JC_objref* dup() const;
};
#endif
