NodeSet Class Reference

Provide a mechanism for marking a set of nodes for redrawing. This mechanism is independent of the number of render regions associated with a particular tree, as it stores a list of pointers to nodes, rather than marking the nodes themselves. The NodeSet can be instructed to mark or unmark all nodes in the set. This allows us to selectively render these nodes without interfering with other render regions, because when we start rendering, we mark the nodes, render the marked nodes, unmark the nodes, and then we have stopped rendering. This means we only ever mark nodes while the render region is actively rendering, and as there can only ever be one render region actively rendering at one time (including the possibility of background rendering) then we don't get any interaction between render regions. More...

#include <nodeset.h>

Inheritance diagram for NodeSet:

CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeSet (BOOL Strict=FALSE)
 Create a NodeSet. It may or may not be a strict set - it depends on the "Strict" parameter. If it is strict, then when nodes are added, the class checks that they don't already exist in the set - if they do, it just does nothing and returns success.
BOOL AddNode (Node *)
 Adds the specified node to this node set. If this is a strict set (see the NodeSet constructor), then the set is first scanned to see if it already contains this node. If it does, then the set is unchanged and success is returned.
void MakeEmpty ()
 Remove all nodes from this NodeSet.
void MarkNodes ()
 Set the MARKED flag on all Nodes in this NodeSet. This is usually done before doing a selective rendering pass on the document tree.
void UnmarkNodes ()
 Clear the MARKED flag on all Nodes in this NodeSet. This is usually done after doing a selective rendering pass on the document tree.

Protected Attributes

BOOL m_fStrictSet
std::vector< Node * > m_NodeSet

Detailed Description

Provide a mechanism for marking a set of nodes for redrawing. This mechanism is independent of the number of render regions associated with a particular tree, as it stores a list of pointers to nodes, rather than marking the nodes themselves. The NodeSet can be instructed to mark or unmark all nodes in the set. This allows us to selectively render these nodes without interfering with other render regions, because when we start rendering, we mark the nodes, render the marked nodes, unmark the nodes, and then we have stopped rendering. This means we only ever mark nodes while the render region is actively rendering, and as there can only ever be one render region actively rendering at one time (including the possibility of background rendering) then we don't get any interaction between render regions.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
See also:
DynamicArray; DocView::ForceRedraw

Definition at line 126 of file nodeset.h.


Constructor & Destructor Documentation

NodeSet::NodeSet BOOL  Strict = FALSE  ) 
 

Create a NodeSet. It may or may not be a strict set - it depends on the "Strict" parameter. If it is strict, then when nodes are added, the class checks that they don't already exist in the set - if they do, it just does nothing and returns success.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
Parameters:
Strict - TRUE => Strict set - a node may only be in the set 0 or 1 times. [INPUTS] FALSE => Not strict - a node may be in the set more than once.
See also:
NodeSet

Definition at line 133 of file nodeset.cpp.

00133                             : m_NodeSet( 50 )
00134 {
00135     // Remember what kind of set this is.
00136     m_fStrictSet = Strict;
00137 }


Member Function Documentation

BOOL NodeSet::AddNode Node pNode  ) 
 

Adds the specified node to this node set. If this is a strict set (see the NodeSet constructor), then the set is first scanned to see if it already contains this node. If it does, then the set is unchanged and success is returned.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
Parameters:
pNode - pointer to the Node to add to this NodeSet. [INPUTS]
Returns:
TRUE if the set now contains the specified Node; FALSE if out of memory => ERROR1

Errors: Out of memory => ERROR1

See also:
NodeSet::NodeSet

Definition at line 158 of file nodeset.cpp.

00159 {
00160     ERROR2IF(pNode == NULL, FALSE, "NULL node pointer in NodeSet::AddNode()");
00161 
00162     if( m_fStrictSet )
00163     {
00164         // Check to see if we haven't already got this node in the set
00165         size_t          cNode = m_NodeSet.size();
00166         for( size_t i = 0; i < cNode; i++ )
00167         {
00168             if( m_NodeSet[i] == pNode )
00169                 // Already have this node - return success
00170                 return TRUE;
00171         }
00172     }
00173 
00174     // See if we can add another node to this set.
00175     m_NodeSet.push_back( pNode );
00176 
00177     // Return success to caller
00178     return TRUE;
00179 }

void NodeSet::MakeEmpty  ) 
 

Remove all nodes from this NodeSet.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
See also:
DynamicArray::EmptyArray

Definition at line 192 of file nodeset.cpp.

00193 {
00194     // Delete all the array elements, and create a new set that are all NULL.
00195     m_NodeSet.clear();
00196 }

void NodeSet::MarkNodes  ) 
 

Set the MARKED flag on all Nodes in this NodeSet. This is usually done before doing a selective rendering pass on the document tree.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
See also:
NodeSet::UnmarkNodes

Definition at line 212 of file nodeset.cpp.

00213 {
00214 
00215 }

void NodeSet::UnmarkNodes  ) 
 

Clear the MARKED flag on all Nodes in this NodeSet. This is usually done after doing a selective rendering pass on the document tree.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/10/94
See also:
NodeSet::MarkNodes

Definition at line 230 of file nodeset.cpp.

00231 {
00232 
00233 }


Member Data Documentation

BOOL NodeSet::m_fStrictSet [protected]
 

Definition at line 138 of file nodeset.h.

std::vector<Node*> NodeSet::m_NodeSet [protected]
 

Definition at line 139 of file nodeset.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:57:10 2007 for Camelot by  doxygen 1.4.4