00001 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 #ifndef __JVMCOMPONENT_H 00003 #define __JVMCOMPONENT_H 00004 00005 /* 00006 * $Id: jvm_component.h,v 1.2 2000/07/24 00:33:24 brm Exp $ 00007 */ 00008 00009 00010 /* 00011 * This class defines an abstract base class for components of a .class file. 00012 * Components are jvm_Constant, jvm_Attribute, jvm_Field, jvm_Method and 00013 * jvm_interface. 00014 * A jvm_Component knows its subtype by asking component_kind(). 00015 */ 00016 class jvm_Component 00017 #ifdef BDW_GC 00018 : public gc 00019 #endif 00020 { 00021 protected: 00022 jvm_Classfile *_cf; 00023 00024 public: 00025 enum component_kinds { 00026 Constant = 1, 00027 Attribute, 00028 Field, 00029 Interface, 00030 Method, 00031 ExceptionTable 00032 }; 00033 00034 jvm_Component(jvm_Classfile* cf) : _cf(cf) {} 00035 virtual ~jvm_Component(); 00036 00037 // methods 00038 virtual component_kinds component_kind() = 0; 00039 virtual void print(void) = 0; // prints internal fields 00040 virtual void write(void) = 0; // write to stream 00041 }; 00042 00043 #endif /* __JVMCOMPONENT_H */