00001 #ifndef IOKERNEL__POINTER_META_CLASS_H 00002 #define IOKERNEL__POINTER_META_CLASS_H 00003 00004 #include "meta_class.h" 00005 #include "iokernel_forwarders.h" 00006 00007 00008 class PointerMetaClass : public MetaClass { 00009 friend class ObjectFactory; 00010 public: 00011 virtual void write( const ObjectWrapper &obj, 00012 OutputStream* outputStream ) const; 00013 00014 virtual void read( const ObjectWrapper &obj, 00015 InputStream* inputStream ) const; 00016 00017 virtual Iterator* get_iterator( ConstAddress instance, Iterator::Contents contents = Iterator::All ) const; 00018 00019 virtual bool is_elementary() const; 00020 00021 virtual bool is_owning_pointer() const; 00022 00023 virtual bool needs_cloning() const; 00024 00025 virtual MetaClass* get_base_type() const; 00026 00027 virtual void initialize( const ObjectWrapper &obj, 00028 InputStream* inputStream ) const; 00029 00030 virtual MetaClass* get_link_meta_class() const; 00031 00032 virtual void adjust_field_offsets(); 00033 00034 virtual VirtualNode* get_virtual_node( const LString &name, const String &what ) const; 00035 00036 virtual void destruct( const ObjectWrapper &obj, 00037 bool called_from_destructor ) const; 00038 00039 Walker::ApplyStatus walk(const Address address,Walker &walk) const; 00040 00041 static const LString &get_class_name(); 00042 00043 virtual void walk_referenced_meta_classes(MetaClassApplier *x); 00044 00045 protected: 00046 PointerMetaClass( LString name = emptyLString, 00047 MetaClass* baseType = 0, 00048 bool pointerOwnsObject = false, 00049 bool is_static = false, 00050 bool needs_cloning = false); 00051 00052 static void constructor_function( void* place ); 00053 00054 private: 00055 MetaClass* _base_type; 00056 MetaClass* _ptr_to_base_type; // non persistent cache 00057 bool _pointer_owns_object; 00058 00059 // a pointer that has the static attribute has the following properties: 00060 // 1.) PointerMetaClass::_pointer_owns_object must be true 00061 // 2.) the pointer either points to NULL or to an object of exactly _base_type 00062 // (that's why it is called static) 00063 // 3.) The object may either be created by the constructor of the surrounding 00064 // object or if the field is NULL and it is needed by the PointerMetaClass 00065 // during a read in operation 00066 // 4.) The address of the object to which it points must not be taken and stored 00067 // by another instance variable (the object is not addressable) 00068 // It is semantically equivalent to an instance of the surrounding object. 00069 bool _is_static; 00070 bool _needs_cloning; 00071 00072 private: 00073 PointerMetaClass(const PointerMetaClass &); 00074 PointerMetaClass &operator=(const PointerMetaClass &); 00075 }; 00076 00077 00078 #endif