00001 /* 00002 FALCON - The Falcon Programming Language. 00003 FILE: cclass.h 00004 00005 Core Class definition 00006 ------------------------------------------------------------------- 00007 Author: Giancarlo Niccolai 00008 Begin: Thu Jan 20 2005 00009 00010 ------------------------------------------------------------------- 00011 (C) Copyright 2004: the FALCON developers (see list in AUTHORS file) 00012 00013 See LICENSE file for licensing details. 00014 */ 00015 00020 #ifndef FLC_CCLASS_H 00021 #define FLC_CCLASS_H 00022 00023 #include <falcon/setup.h> 00024 #include <falcon/symbol.h> 00025 #include <falcon/proptable.h> 00026 #include <falcon/mempool.h> 00027 #include <stdlib.h> 00028 00029 namespace Falcon { 00030 00031 class VMachine; 00032 00049 class FALCON_DYN_CLASS CoreClass: public Garbageable 00050 { 00051 00052 private: 00053 LiveModule *m_lmod; 00054 const Symbol *m_sym; 00055 Item m_constructor; 00056 PropertyTable *m_properties; 00057 00059 ObjectFactory m_factory; 00060 00073 void configInstance( CoreObject *co ); 00074 00075 public: 00076 00083 CoreClass( const Symbol *sym, LiveModule *lmod, PropertyTable *pt ); 00084 ~CoreClass(); 00085 00086 LiveModule *liveModule() const { return m_lmod; } 00087 const Symbol *symbol() const { return m_sym; } 00088 00089 PropertyTable &properties() { return *m_properties; } 00090 const PropertyTable &properties() const { return *m_properties; } 00091 00092 ObjectFactory factory() const { return m_factory; } 00093 void factory( ObjectFactory f ) { m_factory = f; } 00094 00112 CoreObject *createInstance( void *user_data=0, bool bDeserialize = false ) const; 00113 00114 const Item &constructor() const { return m_constructor; } 00115 Item &constructor() { return m_constructor; } 00116 00124 bool derivedFrom( const String &className ) const; 00125 00130 void gcMark( uint32 mark ); 00131 00132 00133 }; 00134 00135 } 00136 00137 #endif 00138 00139 /* end of flc_cclass.h */