Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

VM::NamespaceInfo Class Reference

Represents the information inside a namespace. More...

#include <nspcinfo.h>

Inheritance diagram for VM::NamespaceInfo:

Inheritance graph
[legend]
Collaboration diagram for VM::NamespaceInfo:

Collaboration graph
[legend]
List of all members.

Public Types

enum  NSType { NSNamespace, NSClass }
 Different types of namespace info. More...


Public Member Functions

 NamespaceInfo (const TLString &name, NamespaceInfo *parent=NULL, NSType nstype=NSNamespace)
 Construct namespace node.

virtual ~NamespaceInfo ()
 Destroy namespace node recursively deleting all child nodes.

void SortNamespaceTree ()
 Recursively sort the namespace tree.

void AddChild (NamespaceInfo *child)
 Explicitly add a child.

virtual TLString CompleteName () const
 Return complete name.

virtual void DumpTree (StringTreeDump &dump, bool IDs_resolved, bool recurse=1) const
 Emit a dump of the tree.


Static Public Member Functions

const char * NSType2String (NSType t)
 Translate NSType to string representation.


Protected Types

typedef TLLinearQueue< SymbolEntryE,
TLDefaultOperators_CDT< SymbolEntryE > > 
SymbolList

Protected Member Functions

void _AddChild (NamespaceInfo *child)
 Used by child to add itself as child node.

void _DelChild (NamespaceInfo *child)
 Used by child to delete itself as child node.


Protected Attributes

NamespaceInfoparent
 Pointer to parent in tree.

LinkedList< NamespaceInfodown
 List of child nodes.

TLString name
 Name of the namespace or class.

NSType nstype
 Which type of namespace info.

SCLocation asm_loc
 Location in assembler source. No set in the master tree.

NamespaceInfolinked
uint16 link_info_set: 1
uint16 recursion_flag: 1
 Used by checks for recursive loops of namespaces.

SymbolList symbol
TLBTree< NamespaceInfo *,
PtrListOperators< NamespaceInfo > > 
map_name2child
 Map of child names to child nodes.

TLBTree< SymbolEntryE *, PtrListOperators<
SymbolEntryE > > 
map_name2symbol
 Map of symbol names to symbol entries (non-internal symbols only).


Private Member Functions

 NamespaceInfo (const NamespaceInfo &)
 Do not use.

void operator= (const NamespaceInfo &)
 Do not use.


Friends

class AssemblerFile
class AssemblerFile_Plaintext
class VMLinker

Detailed Description

Represents the information inside a namespace.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Since an object is a namspace as well, the object class is derived from this one.

This class is used to build a tree-like structure of the class/namespace information blocks; it is NOT C++-safe; the base list is held by the higher-level NamespaceInfo.

AssemblerFile (and derived classes) are friends for parsing.
VMLinker is a friend for linking.
Both these friendships are due to the fact that the NamespaceInfo is actually more a information container and tree node than a full-featured class of itself.

Definition at line 61 of file nspcinfo.h.


Member Typedef Documentation

typedef TLLinearQueue<SymbolEntryE,TLDefaultOperators_CDT<SymbolEntryE> > VM::NamespaceInfo::SymbolList [protected]
 

Definition at line 217 of file nspcinfo.h.


Member Enumeration Documentation

enum VM::NamespaceInfo::NSType
 

Different types of namespace info.

Enumeration values:
NSNamespace 
NSClass 

Definition at line 105 of file nspcinfo.h.


Constructor & Destructor Documentation

VM::NamespaceInfo::NamespaceInfo const NamespaceInfo  )  [private]
 

Do not use.

VM::NamespaceInfo::NamespaceInfo const TLString name,
NamespaceInfo parent = NULL,
NSType  nstype = NSNamespace
 

Construct namespace node.

Parameters:
name: Name of the node.
parent: If non-NULL, parent node; will register as child at the parent.
nstype: Set type of derived class; only to be used by derived class.

Definition at line 289 of file nspcinfo.cc.

References _AddChild(), link_info_set, parent, and recursion_flag.

VM::NamespaceInfo::~NamespaceInfo  )  [virtual]
 

Destroy namespace node recursively deleting all child nodes.

Definition at line 309 of file nspcinfo.cc.

References _DelChild(), down, LinkedList< NamespaceInfo >::IsEmpty(), linked, parent, and LinkedList< NamespaceInfo >::PopFirst().


Member Function Documentation

void VM::NamespaceInfo::_AddChild NamespaceInfo child  )  [protected]
 

Used by child to add itself as child node.

For internal use only.

Definition at line 248 of file nspcinfo.cc.

References _unused_, LinkedList< NamespaceInfo >::append(), Assert, down, LinkedList< NamespaceInfo >::last(), map_name2child, name, LinkedListBase< NamespaceInfo >::next, and TLBTree< NamespaceInfo *, PtrListOperators< NamespaceInfo > >::store().

Referenced by AddChild(), and NamespaceInfo().

void VM::NamespaceInfo::_DelChild NamespaceInfo child  )  [protected]
 

Used by child to delete itself as child node.

For internal use only.

Definition at line 264 of file nspcinfo.cc.

References _unused_, Assert, LinkedList< NamespaceInfo >::dequeue(), down, LinkedList< NamespaceInfo >::last(), map_name2child, name, LinkedListBase< NamespaceInfo >::next, and TLBTree< NamespaceInfo *, PtrListOperators< NamespaceInfo > >::remove().

Referenced by ~NamespaceInfo().

void VM::NamespaceInfo::AddChild NamespaceInfo child  ) 
 

Explicitly add a child.

Can be used only if the child was created with parent=NULL.
Will modify parent pointer of passed child.

Definition at line 278 of file nspcinfo.cc.

References _AddChild(), Assert, and parent.

Referenced by VM::VMLinker::_MergeNamespaceInfo_Recursive().

TLString VM::NamespaceInfo::CompleteName  )  const [virtual]
 

Return complete name.

The complete name is the name of the class/namespace and all the names up the hierarchy, separated by "::".

Reimplemented in VM::ClassInfo.

Definition at line 191 of file nspcinfo.cc.

References name, parent, and TLString::prepend().

Referenced by VM::VMLinker::_CheckBaseRecursion_Recursive(), VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), and VM::NamespaceInfo::SymbolEntryB::CompleteName().

void VM::NamespaceInfo::DumpTree StringTreeDump dump,
bool  IDs_resolved,
bool  recurse = 1
const [virtual]
 

Emit a dump of the tree.

IDs_resolved specified whether the IDs (TypeIDs, SymRefs, VTableIDs) in the namespace tree were already resolved or not. This is needed to make access to the correct members of the unions.

The complete dump is stored in the passed StringTreeDump class. This is a debugging function.

Reimplemented in VM::ClassInfo.

Definition at line 207 of file nspcinfo.cc.

References StringTreeDump::AddIndent(), Assert, LinkedList< NamespaceInfo >::count(), TLString::deref(), down, VM::NamespaceInfo::SymbolEntryE::extid, LinkedList< NamespaceInfo >::first(), VM::NamespaceInfo::SymbolEntryE::ftype, LinkedList< NamespaceInfo >::IsEmpty(), link_info_set, linked, VM::NamespaceInfo::SymbolEntryE::name, name, LinkedListBase< NamespaceInfo >::next, VM::NamespaceInfo::SymbolEntryE::nspc, nstype, NSType2String(), parent, TLString::sprintf(), TLString::str(), StringTreeDump::SubIndent(), symbol, VM::NamespaceInfo::SymbolEntryB::symref, VM::VarType::TypeString(), VM::FuncType::TypeString(), uint, uint32, and VM::NamespaceInfo::SymbolEntryE::vtype.

Referenced by VM::ClassInfo::DumpTree(), and VM::VMLinker::LinkAll().

const char * VM::NamespaceInfo::NSType2String NSType  t  )  [static]
 

Translate NSType to string representation.

Definition at line 25 of file nspcinfo.cc.

References NSClass, and NSNamespace.

Referenced by DumpTree().

void VM::NamespaceInfo::operator= const NamespaceInfo  )  [private]
 

Do not use.

void VM::NamespaceInfo::SortNamespaceTree  ) 
 

Recursively sort the namespace tree.

This uses mergesort on linked lists and uses O(n*log(n)) time without any additional memory.

Definition at line 163 of file nspcinfo.cc.

References down, LinkedList< NamespaceInfo >::first(), LinkedList< NamespaceInfo >::IsEmpty(), LinkedList< NamespaceInfo >::last(), LinkedList< NamespaceInfo >::MergeSort(), and LinkedListBase< NamespaceInfo >::next.


Friends And Related Function Documentation

friend class AssemblerFile [friend]
 

Reimplemented in VM::ClassInfo.

Definition at line 64 of file nspcinfo.h.

friend class AssemblerFile_Plaintext [friend]
 

Reimplemented in VM::ClassInfo.

Definition at line 65 of file nspcinfo.h.

friend class VMLinker [friend]
 

Reimplemented in VM::ClassInfo.

Definition at line 67 of file nspcinfo.h.


Member Data Documentation

SCLocation VM::NamespaceInfo::asm_loc [protected]
 

Location in assembler source. No set in the master tree.

Definition at line 204 of file nspcinfo.h.

Referenced by VM::VMLinker::_CheckBaseRecursion_Recursive(), VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::VMLinker::_GenerateSymbolProvideMap(), VM::VMLinker::_GenerateSymbolProvideMap_AddGlobal(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_ParseSymbols_Class(), VM::AssemblerFile_Plaintext::_ParseSymbols_Namespace(), VM::AssemblerFile_Plaintext::_ParseSymbolSection(), VM::AssemblerFile::_ResolveIDsNamespaceLocal_Recursive(), and VM::VMLinker::LinkAll().

LinkedList<NamespaceInfo> VM::NamespaceInfo::down [protected]
 

List of child nodes.

Definition at line 199 of file nspcinfo.h.

Referenced by _AddChild(), VM::VMLinker::_CheckBaseRecursion_Recursive(), VM::VMLinker::_CheckNamespaceInfo_Recursive(), _DelChild(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_MustDumpNamespace(), VM::VMLinker::_PropagateUseFlags_Recursive(), VM::AssemblerFile::_ResolveIDsNamespaceLocal_Recursive(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), DumpTree(), SortNamespaceTree(), and ~NamespaceInfo().

uint16 VM::NamespaceInfo::link_info_set [protected]
 

Flag indicating whether this NamespaceInfo is already filled with info from the first occurance in souce or not. Used by linker; only used in master tree.

Definition at line 212 of file nspcinfo.h.

Referenced by VM::VMLinker::_CheckNamespaceInfo_Recursive(), DumpTree(), and NamespaceInfo().

NamespaceInfo* VM::NamespaceInfo::linked [protected]
 

Pointer to corresponding merged/linked master namespace info. Used by linker; not used in master tree.

Definition at line 208 of file nspcinfo.h.

Referenced by VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::VMLinker::_LinkerNeedClassConstruct(), VM::VMLinker::_LinkFunction(), VM::VMLinker::_LinkGlobalStorage(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), DumpTree(), VM::VMLinker::LinkAll(), VM::VMLinker::SPM_ORD(), VM::NamespaceInfo::SymbolEntryE::SymbolEntryE(), and ~NamespaceInfo().

TLBTree<NamespaceInfo*,PtrListOperators<NamespaceInfo> > VM::NamespaceInfo::map_name2child [protected]
 

Map of child names to child nodes.

Definition at line 227 of file nspcinfo.h.

Referenced by _AddChild(), VM::AssemblerFile_Plaintext::_CheckNspcNameKnown(), and _DelChild().

TLBTree< SymbolEntryE*,PtrListOperators<SymbolEntryE> > VM::NamespaceInfo::map_name2symbol [protected]
 

Map of symbol names to symbol entries (non-internal symbols only).

Definition at line 230 of file nspcinfo.h.

Referenced by VM::VMLinker::_LinkGlobalStorage(), VM::AssemblerFile_Plaintext::_ParseProgram_Label(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), and VM::VMLinker::LinkAll().

TLString VM::NamespaceInfo::name [protected]
 

Name of the namespace or class.

Definition at line 200 of file nspcinfo.h.

Referenced by _AddChild(), _DelChild(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_ParseProgram_Label(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), CompleteName(), DumpTree(), VM::NamespaceInfo::_Operators::le(), and VM::NamespaceInfo::SymbolEntryE::SymbolEntryE().

NSType VM::NamespaceInfo::nstype [protected]
 

Which type of namespace info.

Definition at line 201 of file nspcinfo.h.

Referenced by VM::VMLinker::_CheckBaseRecursion(), VM::VMLinker::_CheckBaseRecursion_Recursive(), VM::VMLinker::_CheckNamespaceInfo_Recursive(), VM::VMLinker::_LinkFunction(), VM::VMLinker::_MergeNamespaceInfo_Recursive(), VM::AssemblerFile_Plaintext::_MustDumpNamespace(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), VM::VMLinker::_PropagateUseFlags_Recursive(), VM::AssemblerFile::_ResolveIDsNamespaceLocal_Recursive(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), and DumpTree().

NamespaceInfo* VM::NamespaceInfo::parent [protected]
 

Pointer to parent in tree.

Definition at line 198 of file nspcinfo.h.

Referenced by VM::VMLinker::_GetDefinitionFile(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), AddChild(), CompleteName(), VM::NamespaceInfo::SymbolEntryB::CompleteName(), DumpTree(), NamespaceInfo(), and ~NamespaceInfo().

uint16 VM::NamespaceInfo::recursion_flag [protected]
 

Used by checks for recursive loops of namespaces.

Definition at line 214 of file nspcinfo.h.

Referenced by VM::VMLinker::_CheckBaseRecursion(), and NamespaceInfo().

SymbolList VM::NamespaceInfo::symbol [protected]
 

Queue of symbol entries. Actually, we could use an array for parsing but for linking, a queue is better (resize operation).
This only holds the non-internal symbols.
NOTE: TLLinearQueue can be relied on to never move data which is important as the rest of the code relies on the SymbolEntry pointers. Hence, we cannot use TLBtree.

Definition at line 224 of file nspcinfo.h.

Referenced by VM::VMLinker::_LinkGlobalStorage(), VM::AssemblerFile_Plaintext::_ParseSymbols_Symbols(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), DumpTree(), and VM::VMLinker::LinkAll().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:36:15 2005 for Ray by doxygen 1.3.5