comma::IdentifierInfo Class Reference

Associates information with unique strings in the system. More...

#include <IdentifierInfo.h>

List of all members.

Public Member Functions

 IdentifierInfo ()
const char * getString () const
template<typename T >
T * getMetadata () const
void setMetadata (void *mdata)
bool hasMetadata () const
 Returns true if the metadata has been set to a non-null pointer.
void setAttributeID (attrib::AttributeID ID)
 Sets the attribute ID for this identifier.
attrib::AttributeID getAttributeID () const
 Returns the attribute ID for this identifier.

Detailed Description

Associates information with unique strings in the system.

The IdentifierInfo class is quite fundamental. These objects provide access to unique (memoized) strings, and to associate arbitrary metadata with each distinct string. The metadata facility is used to provide O(1) lookup of information knowing only the name of the object of interest. For example, this facility is used during semantic analysis to implement an efficient symbol table.

IdentifierInfo's are always allocated with respect to a particular IdentifierPool. One never constructs an IdentifierInfo explicitly by hand. Allocations are performed by calling one of the IdentifierPool::getIdentifierInfo methods.

See also:
IdentifierPool

Definition at line 36 of file IdentifierInfo.h.


Constructor & Destructor Documentation

comma::IdentifierInfo::IdentifierInfo (  )  [inline]

Definition at line 39 of file IdentifierInfo.h.


Member Function Documentation

attrib::AttributeID comma::IdentifierInfo::getAttributeID (  )  const [inline]

Returns the attribute ID for this identifier.

Definition at line 68 of file IdentifierInfo.h.

template<typename T >
T* comma::IdentifierInfo::getMetadata (  )  const [inline]

Returns the metadata associated with this identifier cast to the supplied type.

Definition at line 53 of file IdentifierInfo.h.

const char* comma::IdentifierInfo::getString (  )  const [inline]

Obtains the unique null terminated string associated with this identifier.

Definition at line 45 of file IdentifierInfo.h.

bool comma::IdentifierInfo::hasMetadata (  )  const [inline]

Returns true if the metadata has been set to a non-null pointer.

Definition at line 62 of file IdentifierInfo.h.

void comma::IdentifierInfo::setAttributeID ( attrib::AttributeID  ID  )  [inline]

Sets the attribute ID for this identifier.

Definition at line 65 of file IdentifierInfo.h.

void comma::IdentifierInfo::setMetadata ( void *  mdata  )  [inline]

Associates this IdentifierInfo object with the supplied metadata. The ownership of this pointer remains with the caller.

Parameters:
mdata The metadata to associate with this identifier.

Definition at line 59 of file IdentifierInfo.h.


The documentation for this class was generated from the following file:

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1