Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

ClassEncoder::ConstantPool Class Reference

Object representing the object pool. More...

#include <constantpool.hpp>

List of all members.

Public Member Functions

 ConstantPool ()
 Default constructor.

 ~ConstantPool ()
 Destructor.

unsigned int count () const
 get the number of items in the constant pool

unsigned int add (cp_info *entry)
 Add an entry to the constant pool.

void write (std::ofstream &stream) const
 Write constant pool entries to stream.


Private Attributes

std::vector< cp_info * > Entries
unsigned int ConstantPoolCount


Detailed Description

Object representing the object pool.

This class represents a constant pool of a class file. You can add entries to it and make it write itself to a class stream.

Todo:
Currently generating classes needing entries in the constant pool create them and enters them via the add function. This means that redundant multiple entries in the constant pool are unavoidable. A nice addition to this class would be to add createXXX_info functions that check if the needed entry is already in the pool before creating it.

Definition at line 30 of file constantpool.hpp.


Constructor & Destructor Documentation

ClassEncoder::ConstantPool::ConstantPool  ) 
 

Default constructor.

Initialises the pool count and the pool stack.

Definition at line 20 of file constantpool.cpp.

ClassEncoder::ConstantPool::~ConstantPool  ) 
 

Destructor.

Deletes all the objects in the constant pool.

Definition at line 32 of file constantpool.cpp.


Member Function Documentation

unsigned int ClassEncoder::ConstantPool::add cp_info entry  ) 
 

Add an entry to the constant pool.

Parameters:
entry Pointer to the object to add to the pool.
Returns:
The position in the constant pool of the added object.

Definition at line 50 of file constantpool.cpp.

Referenced by ClassEncoder::ByteCode::emit_getstatic(), ClassEncoder::ByteCode::emit_invokeinterface(), ClassEncoder::ByteCode::emit_invokespecial(), ClassEncoder::ByteCode::emit_invokestatic(), ClassEncoder::ByteCode::emit_invokevirtual(), ClassEncoder::ByteCode::emit_multianewarray(), ClassEncoder::ByteCode::emit_new(), ClassEncoder::method_info::finish(), and ClassEncoder::Class::write().

void ClassEncoder::ConstantPool::write std::ofstream &  stream  )  const
 

Write constant pool entries to stream.

Parameters:
stream Stream to write to.

Definition at line 60 of file constantpool.cpp.

Referenced by ClassEncoder::Class::write().


The documentation for this class was generated from the following files:
Generated on Mon Dec 1 14:26:30 2003 for Ck by doxygen 1.3.3