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

_InternalSourceFileNode Class Reference

Internally used source file node class. More...

#include <sourcefile.h>

Inheritance diagram for _InternalSourceFileNode:

Inheritance graph
[legend]
Collaboration diagram for _InternalSourceFileNode:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~_InternalSourceFileNode ()
SourcePositionArchivearchive () const
 Get associated source position archive (or NULL):.

TLString path () const
 Get file path:.

TLString IncludeHierarchyStr () const
 Get include hierarchy string.


Static Public Member Functions

SourceFileNode CreateSingleNode (const TLString &path)

Private Member Functions

void _DestroyPosCache ()
 Destroy cache: (also done by _DetachArchive()).

void _DetachArchive ()
void _AddChild (_InternalSourceFileNode *isf)
void _DelChild (_InternalSourceFileNode *isf)
bool test_equal (const _InternalSourceFileNode &b) const
 Test if two source file nodes are equal; used by operator== and !=.

 _InternalSourceFileNode (const _InternalSourceFileNode &)
 NOT "C++-safe"; do not call these.

void operator= (const _InternalSourceFileNode &)
 _InternalSourceFileNode (const TLString &path, _InternalSourceFileNode *parent, SourcePositionArchive *pos_archive)

Private Attributes

TLString _path
 Path to the file.

SourcePositionArchivepos_archive
_InternalSourceFileNodeup
 Tree structure: parent pointer.

LinkedList< _InternalSourceFileNodedown
 Tree structure: Child nodes.

int parent_include_line
 Start position of the include statement in the parent node:.

int parent_include_lpos
filepos_t include_stmt_pos
 Offset position & size of the include statement in the file:.

size_t include_stmt_len
SourcePositionCachepos_cache

Friends

class SourcePositionArchive
class LinkedList< _InternalSourceFileNode >
class RefNode< _InternalSourceFileNode >
bool operator== (const SourceFileNode &a, const SourceFileNode &b)
 operator==() returns true for the same file with the same position in the include tree.


Detailed Description

Internally used source file node class.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Use the ref-counting SourceFileNode class instead of directly this.

The SourceFileNode class lets you access the public methods of this one via the operator->().

This class represents a read-in file; tree structure for include hierarchy.

Note:
The source file node code is semi thread-safe, i.e. it is assumed that there is only one thread per SourcePositionArchive (i.e. only one thread does scanning and parsing). The created SourceFileNode objects may then be used (in a read-only manner) by several threads.

Definition at line 66 of file sourcefile.h.


Constructor & Destructor Documentation

_InternalSourceFileNode::_InternalSourceFileNode const _InternalSourceFileNode  )  [private]
 

NOT "C++-safe"; do not call these.

Referenced by CreateSingleNode().

_InternalSourceFileNode::_InternalSourceFileNode const TLString path,
_InternalSourceFileNode parent,
SourcePositionArchive pos_archive
[private]
 

Create an _InternalSourceFileNode.
Enqueues itself at the parent (if non-NULL).
DO NOT FORGET to set the include position if needed.

Definition at line 69 of file sourcefile.cc.

References _AddChild(), include_stmt_len, include_stmt_pos, parent_include_line, parent_include_lpos, pos_archive, pos_cache, and up.

_InternalSourceFileNode::~_InternalSourceFileNode  ) 
 

Destroy InternalSourceFileNode.
No refs and no child nodes may be present.
Will dequeue the node at parent (if any).

Definition at line 94 of file sourcefile.cc.

References _DelChild(), CritAssert, DELETE(), SourcePositionArchive::DestroyingISF(), down, LinkedList< _InternalSourceFileNode >::IsEmpty(), pos_archive, pos_cache, and up.


Member Function Documentation

void _InternalSourceFileNode::_AddChild _InternalSourceFileNode isf  )  [inline, private]
 

Use these to add/delete children. Never directly access child list (down). Update ref count since we are "used" (referenced) by child.

Definition at line 124 of file sourcefile.h.

References InternalRefNodeBase_ThreadSave::_InternalRefNodeBase_aqref(), LinkedList< _InternalSourceFileNode >::append(), and down.

Referenced by _InternalSourceFileNode().

void _InternalSourceFileNode::_DelChild _InternalSourceFileNode isf  )  [inline, private]
 

Definition at line 126 of file sourcefile.h.

References InternalRefNodeBase_ThreadSave::_InternalRefNodeBase_deref(), LinkedList< _InternalSourceFileNode >::dequeue(), and down.

Referenced by ~_InternalSourceFileNode().

void _InternalSourceFileNode::_DestroyPosCache  )  [private]
 

Destroy cache: (also done by _DetachArchive()).

Definition at line 59 of file sourcefile.cc.

References DELETE(), and pos_cache.

Referenced by _DetachArchive().

void _InternalSourceFileNode::_DetachArchive  )  [inline, private]
 

This is called by SourcePositionArchive upon its destruction. Will set our pointer to it (pos_archive) to NULL and destroy us if we're no longer needed.

Note:
It is vital that we delete the position cache here.
  • Firstly, it is no longer used.
  • Secondly, if we do not, WE hold refs to our files preventing cleanup!

Definition at line 118 of file sourcefile.h.

References _DestroyPosCache(), and pos_archive.

Referenced by SourcePositionArchive::_RecursiveDetachArchive().

SourcePositionArchive* _InternalSourceFileNode::archive  )  const [inline]
 

Get associated source position archive (or NULL):.

Definition at line 150 of file sourcefile.h.

References pos_archive.

SourceFileNode _InternalSourceFileNode::CreateSingleNode const TLString path  )  [static]
 

Can be used to create a single SourceFileNode with no hierarchy and include position. Only useful if you want to create a _single_ one of these to store a file name.
DO NOT USE IF YOU HAVE MORE LOCATIONS or an include hierarchy. Otherwise, you waste memory.

Definition at line 52 of file sourcefile.cc.

References _InternalSourceFileNode(), and SourceFileNode.

Referenced by SCLocation::SCLocation().

TLString _InternalSourceFileNode::IncludeHierarchyStr  )  const
 

Get include hierarchy string.

Each include statement gets written into a line of its own; (the character is a newline unless hierarchy is empty).

Definition at line 23 of file sourcefile.cc.

References _path, parent_include_line, parent_include_lpos, TLString::sprintf(), and up.

void _InternalSourceFileNode::operator= const _InternalSourceFileNode  )  [private]
 

TLString _InternalSourceFileNode::path  )  const [inline]
 

Get file path:.

Definition at line 154 of file sourcefile.h.

References _path.

bool _InternalSourceFileNode::test_equal const _InternalSourceFileNode b  )  const [inline, private]
 

Test if two source file nodes are equal; used by operator== and !=.

Definition at line 130 of file sourcefile.h.


Friends And Related Function Documentation

friend class LinkedList< _InternalSourceFileNode > [friend]
 

Definition at line 71 of file sourcefile.h.

bool operator== const SourceFileNode a,
const SourceFileNode b
[friend]
 

operator==() returns true for the same file with the same position in the include tree.

+ This means that same file read several times will yield to false if a and b were read at different "times".

Definition at line 173 of file sourcefile.h.

friend class RefNode< _InternalSourceFileNode > [friend]
 

Definition at line 72 of file sourcefile.h.

friend class SourcePositionArchive [friend]
 

Definition at line 70 of file sourcefile.h.


Member Data Documentation

TLString _InternalSourceFileNode::_path [private]
 

Path to the file.

Definition at line 82 of file sourcefile.h.

Referenced by IncludeHierarchyStr(), and path().

LinkedList<_InternalSourceFileNode> _InternalSourceFileNode::down [private]
 

Tree structure: Child nodes.

Definition at line 91 of file sourcefile.h.

Referenced by _AddChild(), _DelChild(), SourcePositionArchive::_RecursiveDetachArchive(), and ~_InternalSourceFileNode().

size_t _InternalSourceFileNode::include_stmt_len [private]
 

Definition at line 99 of file sourcefile.h.

Referenced by _InternalSourceFileNode(), and SourcePositionArchive::IncludeFile().

filepos_t _InternalSourceFileNode::include_stmt_pos [private]
 

Offset position & size of the include statement in the file:.

Definition at line 98 of file sourcefile.h.

Referenced by _InternalSourceFileNode(), and SourcePositionArchive::IncludeFile().

int _InternalSourceFileNode::parent_include_line [private]
 

Start position of the include statement in the parent node:.

Definition at line 94 of file sourcefile.h.

Referenced by _InternalSourceFileNode(), SourcePositionArchive::IncludeFile(), and IncludeHierarchyStr().

int _InternalSourceFileNode::parent_include_lpos [private]
 

Definition at line 95 of file sourcefile.h.

Referenced by _InternalSourceFileNode(), SourcePositionArchive::IncludeFile(), and IncludeHierarchyStr().

SourcePositionArchive* _InternalSourceFileNode::pos_archive [private]
 

Pointer to associated SourcePositionArchive: Must be set as long as archive exists.

Definition at line 86 of file sourcefile.h.

Referenced by _DetachArchive(), _InternalSourceFileNode(), archive(), and ~_InternalSourceFileNode().

SourcePositionCache* _InternalSourceFileNode::pos_cache [private]
 

This is a SourcePosition cache caching the last few source positions in this file so that positions can be re-used when the same position is requested more than once. (Saves memory, especially when not using lpos.) (Gets deleted when no longer needed.)

Definition at line 106 of file sourcefile.h.

Referenced by _DestroyPosCache(), _InternalSourceFileNode(), and ~_InternalSourceFileNode().

_InternalSourceFileNode* _InternalSourceFileNode::up [private]
 

Tree structure: parent pointer.

Definition at line 89 of file sourcefile.h.

Referenced by _InternalSourceFileNode(), IncludeHierarchyStr(), and ~_InternalSourceFileNode().


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