Click or drag to resize

VisitorState Class

Use this as a base class for defining your own state for arbitrary SceneVisitors.
Inheritance Hierarchy

Namespace:  Fusee.Xene
Assembly:  Fusee.Xene (in Fusee.Xene.dll) Version: (
public class VisitorState : IStateStack

The VisitorState type exposes the following members.

Public methodVisitorState
Initializes a new instance of the VisitorState class.
Public propertyDepth
Retrieves the state's overall depth.
Public methodClear
Clears all registered state stacks. The Depth will be reset to zero.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodPop
The visitor state's Pop operation. Pops all registered state stacks.
Public methodPush
The visitor state's Push operation. Pushes all registered state stacks.
Protected methodRegisterState
Registers a state stack. State stacks need to be registered to be notified when the entire state is pushed or popped.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
A state is always a list of individual values that can be altered during traversal. To restore state along hierarchy levels the values are kept in IStateStackobjects - one stack per tracked value. The VisitorState itself represents an IStateStack. It delegates all interface methods to the individual value stacks registered.
Here's an example of a VisitorState containing an integer and a string value:
class TestState : VisitorState
    private CollapsingStateStack<string> _stringState = new CollapsingStateStack<string>();
    private CollapsingStateStack<int> _intState = new CollapsingStateStack<int>();

    public string StringState
         get { return _stringState.Tos; }
         set { _stringState.Tos = value; }

    public string IntState
         get { return _intState.Tos; }
         set { _intState.Tos = value; }

    TestState() : base()
See Also