Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ReplacingWalker Class Reference

Walk a tree and replace nodes with new ones. More...

#include <suifkernel/group_walker.h>

Inheritance diagram for ReplacingWalker:

GroupWalker SuifWalker Walker List of all members.

Public Methods

 ReplacingWalker (SuifEnv *the_env)
virtual bool is_walkable (Address address,bool is_owned, const MetaClass *_meta)
 Determine if the tree rooted at the address should be walked Default implementation returns true iff is_owned is true. More...

Walker::ApplyStatus operator() (SuifObject *x)
void add_replacement (Object *from,Object *to)
 Add a replacement for an object. More...

Objectget_replacement (Object *x) const
 You can lookup replacement values here.

bool get_makes_changes () const
 This walker makes changes to the tree, so override get_makes_changes.

bool is_changed (Address addr) const
 Has a given node changed? If so, we do not walk it (it may even be deleted.

suif_hash_map<Address,Object *>::iterator get_map_begin ()
 Export of the iterator for the map.

suif_hash_map<Address,Object *>::iterator get_map_end ()
suif_hash_map<Address,Object *>::const_iterator get_map_begin () const
suif_hash_map<Address,Object *>::const_iterator get_map_end () const


Detailed Description

Walk a tree and replace nodes with new ones.

It differs from a GroupWalker in the following ways:

Example usage
ReplacingWalker walk; walk.add_replacement(


Constructor & Destructor Documentation

ReplacingWalker::ReplacingWalker ( SuifEnv * the_env)


Member Function Documentation

void ReplacingWalker::add_replacement ( Object * from,
Object * to)

Add a replacement for an object.

Note that if you enter a value during a walk, it must be for a value that has not been visited yet

bool ReplacingWalker::get_makes_changes () const [virtual]

This walker makes changes to the tree, so override get_makes_changes.

Reimplemented from Walker.

suif_hash_map<Address,Object *>::const_iterator ReplacingWalker::get_map_begin<Address,Object *> () const [inline]

suif_hash_map<Address,Object *>::iterator ReplacingWalker::get_map_begin () [inline]

Export of the iterator for the map.

suif_hash_map<Address,Object *>::const_iterator ReplacingWalker::get_map_end<Address,Object *> () const [inline]

suif_hash_map<Address,Object *>::iterator ReplacingWalker::get_map_end<Address,Object *> () [inline]

Object * ReplacingWalker::get_replacement ( Object * x) const

You can lookup replacement values here.

bool ReplacingWalker::is_changed ( Address addr) const [virtual]

Has a given node changed? If so, we do not walk it (it may even be deleted.

Reimplemented from Walker.

bool ReplacingWalker::is_walkable ( Address address,
bool is_owned,
const MetaClass * _meta) [virtual]

Determine if the tree rooted at the address should be walked Default implementation returns true iff is_owned is true.

You can, for example, return false if you know that a node of interest cannot be contained inside a given node.

Notice the difference to is_visitable. The latter determines if the function operator should be called on a given node. This function controls walking of an entire subtree.

Parameters:
address   (a pointer to) a pointer.
is_owned   true if the pointer pointed to by address is owned by this object.
_meta   the meta class of the pointer in address. This meta class will be a subclass of PointerMetaClass.

Reimplemented from Walker.

Walker::ApplyStatus ReplacingWalker::operator() ( SuifObject * x) [virtual]

Reimplemented from GroupWalker.


The documentation for this class was generated from the following files:
Generated at Mon Jul 31 13:44:25 2000 for NCI SUIF by doxygen 1.1.2 written by Dimitri van Heesch, © 1997-2000