Author image Barrie Slaymaker

NAME

StateML::Machine - a StateML state machine data structure

DESCRIPTION

Contains all events, arcs and states for a state machine.

METHODS

    new

        my $m = StateML::Machine->new ;

    autogenerated_message

    Sets/gets a suitable warning message that can be placed in a template file.

    Use only [\w :./!,-] in this warning message and no newlines, tabs, or other control codes.

    modes

    Set/get the list of modes that will be used to control what portions of the document get parsed. This is used to conditionally control inclusion of things like optional states or language-specific APIs.

    all_state

    Returns the "#ALL" state.

    states

    Returns a list of all states other than state #ALL.

    raw_states

    Returns a list of all states including #ALL.

    description

    Sets or gets a textual description of the machine

    actions

    Returns a list of all actions.

    classes

    Returns a list of all classes

    events

    Returns a list of all events.

    arcs

    Returns a list of all arcs.

    preamble

    Returns the preamble code.

    postamble

    Returns the postamble code.

    object_by_id

        my $object = $m->object_by_id( $id ) ;
        my $object = $m->object_by_id( $id, $require_type ) ;

    Returns the state, event, or arc labelled $id or undef if one isn't found.

    If present, $required_type is used to make sure that the object requested if of the indicated type.

    action_by_id

    Returns an action given it's id. Dies if $id refers to a non-state.

    class_by_id

    Returns a class given it's id. Dies if $id refers to a non-class.

    In general this is not used because inheritance works across all objects.

    event_by_id

    Returns a event given it's id. Dies if $id refers to a non-event.

    state_by_id

    Returns a state given it's id. Dies if $id refers to a non-state.

    add

        $m->add( $arc ) ;
        $m->add( $class ) ;
        $m->add( $event ) ;
        $m->add( $state ) ;

    extract_output_machine

        my $om = $m->extract_output_machine( \@types ) ;

    Returns an output machine comprised of the events, arcs, and states that match the \@types specified.

    matching_events

       my @events = $m->matching_events( types=>\@types ) ;
       my @events = $m->matching_events( types=>[ "ui", "io" ] ) ;

    Gets all events that have type= attributes that match an entry in @types. If no parameters are passed, all events are returned.

    Events with a type of "#ANY" or "#ALL" (case insensitive) will show up in all filter settings. Passing "all", "any", "#all", or "#any" in the typelist will cause all events to be returned.

    arcs_for_event

        my @arcs = $m->arcs_for_event( $event ) ;

    Returns all arcs in the state machine for event $event.

    A arc is an edge in the state machine diagram.

    Unfolds arcs in state #ALL to be for all states.

    all_state_arcs_for_event

        my @arcs = $m->all_state_arcs_for_event( $event ) ;

    Returns all arcs in the state machine for event $event.

    A arc is an edge in the state machine diagram.

    states_by_id

        my %states_by_id = $m->states_by_id ;

    Returns a HASH ref of all states indexed by their id= attributes.

    states_for_arc

        my @states = $m->states_for_arc( $arc ) ;

    Returns all states that appear as starting or ending points for $arc other than the "#ALL" state. Will only return one state for loopbacks.

    assert_valid

        $m->assert_valid ;

    Dies if there are dangling references. The error message contains all undefined states, events, etc.

LIMITATIONS

Alpha code. Ok test suite, but we may need to change things in non-backward compatible ways.

COPYRIGHT

    Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved

LICENSE

You may use this module under the terms of the BSD, Artistic, or GPL licenses, any version.

AUTHOR

Barrie Slaymaker <barries@slaysys.com>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 13:

You can't have =items (as at line 35) unless the first thing after the =over is an =item