Show / Hide Table of Contents

Class VisitorState

Use this as a base class for defining your own state for arbitrary Visitors.

Inheritance
System.Object
VisitorState
AABBCalculator.AABBState
OBBCalculator.OBBState
RendererState
ScenePicker.PickerState
SceneRayCaster.RayCasterState
StandardState
Implements
IStateStack
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Fusee.Xene
Assembly: Fusee.Xene.dll
Syntax
public class VisitorState : IStateStack
Remarks

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.

Examples

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()
    {
       RegisterState(_stringState);
       RegisterState(_intState);
    }
}

Constructors

VisitorState()

Initializes a new instance of the VisitorState class.

Declaration
public VisitorState()

Properties

Depth

Retrieves the state's overall depth.

Declaration
public int Depth { get; }
Property Value
Type Description
System.Int32

The current depth of the visitor state.

Methods

Clear()

Clears all registered state stacks. The Depth will be reset to zero.

Declaration
public void Clear()

Pop()

The visitor state's Pop operation. Pops all registered state stacks.

Declaration
public void Pop()

Push()

The visitor state's Push operation. Pushes all registered state stacks.

Declaration
public void Push()

RegisterState(IStateStack)

Registers a state stack. State stacks need to be registered to be notified when the entire state is pushed or popped.

Declaration
protected void RegisterState(IStateStack stack)
Parameters
Type Name Description
IStateStack stack

The state stack to register.

Implements

IStateStack
Generated by DocFX
GitHub Repo
Back to top