- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Planning/Reactive/CCA/rpState.h

    00001 //=============================================================================
    00002 //
    00003 // Copyright (c) 2001           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00009 // Author:                      Seung H. Chung
    00010 // Organization:        Model-based Embedded and Robotic Systems Group
    00011 //                                      Massachusetts Institute of Technology
    00012 //
    00013 // rpState class
    00014 //
    00015 //=============================================================================
    00016 #ifndef __RP_STATE__
    00017 #define __RP_STATE__
    00018
    00019 #ifdef _MSC_VER
    00020 #pragma warning( disable : 4786 )
    00021 #endif
    00022 #include <iostream>
    00023
    00024 #include <Mers/Models/CCA/CCAModel.h>
    00025 #include <Mers/Utils/Lang/String.h>
    00026
    00027 #include "rpTransitionPtrs.h"
    00028
    00029 class rpCCAutomata;
    00030 class rpAutomaton;
    00031 class rpState{
    00032 public:
    00033         //-------------------------------------------------------------------------
    00034         // Type Definitions & Constants
    00035         //-------------------------------------------------------------------------
    00036         typedef unsigned int            indexType;
    00037         enum reachabilityType           {ALWAYS, INITIALLY, NEVER, UNKNOWN};
    00038         //-------------------------------------------------------------------------
    00039         // Constructors, Copy Constructors, & Destructors
    00040         //-------------------------------------------------------------------------
    00041         rpState();
    00042         rpState(const Mers::Models::CCA::CCAState &_state, const unsigned int index);
    00043         rpState(const rpState &other);
    00044         ~rpState();
    00045         //-------------------------------------------------------------------------
    00046         // Public Function Members
    00047         //-------------------------------------------------------------------------
    00048         const Mers::Models::CCA::CCAModel *const                model_p()                                                               const;
    00049         const rpCCAutomata *const       rpCCAutomata_p()                                                const;
    00050         const rpAutomaton *const        rpAutomaton_p()                                                 const;
    00051         //-------------------------------------------------------------------------
    00052         const Mers::Utils::Lang::String                     name()                                                                      const;
    00053         const Mers::Models::CCA::CCAValue       *const          value_p()                                                               const;
    00054         const unsigned int                      index()                                                                 const;
    00055         const Mers::Models::CCA::CCAState::StateType    type()                                                                  const;
    00056         const rpTransitionPtrs *        in_rpTransitionPtrs_p()                                 const;
    00057         const rpTransitionPtrs *        out_rpTransitionPtrs_p()                                const;
    00058         const rpTransition *            in_rpTransitionPtrs(const indexType i)  const;
    00059         const rpTransition *            out_rpTransitionPtrs(const indexType i) const;
    00060         const reachabilityType          reachability()                                                  const;
    00061         const rpState *const            SCC_root_p()                                                    const;
    00062         const rpState *const            predecessor_p()                                                 const;
    00063         const unsigned int                      lowlink_numb()                                                  const;
    00064         const unsigned int                      depth_first_numb()                                              const;
    00065         const bool                                      marked()                                                                const;
    00066         //-------------------------------------------------------------------------
    00067         void                                            set_rpAutomaton_p(
    00068                                                                         const rpAutomaton &_rpAutomaton);
    00069         const bool                                      insert_in_rpTransition(
    00070                                                                         const rpTransition &_rpTransition);
    00071         const bool                                      insert_out_rpTransition(
    00072                                                                         const rpTransition &_rpTransition);
    00073         void                                            clear_in_rpTransitionPtrs();
    00074         void                                            clear_out_rpTransitionPtrs();
    00075         void                                            set_reachability(
    00076                                                                         const reachabilityType &reachability);
    00077         void                                            set_SCC_root(const rpState &_rpState);
    00078         void                                            reset_SCC_root();
    00079         void                                            set_lowlink_numb(const unsigned int numb);
    00080         void                                            set_depth_first_numb(const unsigned int numb);
    00081         void                                            set_predecessor(const rpState &_rpState);
    00082         void                                            reset_predecessor();
    00083         void                                            mark();
    00084         void                                            unmark();
    00085         void                                            clear();
    00086         //-------------------------------------------------------------------------
    00087         // Public Operators
    00088         //-------------------------------------------------------------------------
    00089         const rpState &                         operator =(const rpState &other);
    00090         const bool                                      operator ==(const rpState &other)               const;
    00091         const bool                                      operator !=(const rpState &other)               const;
    00092         const bool                                      operator >(const rpState &other)                const;
    00093         const bool                                      operator <(const rpState &other)                const;
    00094         const bool                                      operator >=(const rpState &other)               const;
    00095         const bool                                      operator <=(const rpState &other)               const;
    00096         friend std::ostream &           operator <<(std::ostream &stream,
    00097                                                                                         const rpState &_rpState);
    00098 private:
    00099         //-------------------------------------------------------------------------
    00100         // Private Object Members
    00101         //-------------------------------------------------------------------------
    00102         const rpAutomaton *                     _rpAutomaton_p;
    00103         const Mers::Models::CCA::CCAState *                             _state_p;
    00104         rpTransitionPtrs                        _in_rpTransitionPtrs;
    00105         rpTransitionPtrs                        _out_rpTransitionPtrs;
    00106         //-------------------------------------------------------------------------
    00107         indexType                                       _index;
    00108         reachabilityType                        _reachability;
    00109         const rpState *                         _SCC_root_p;
    00110         const rpState *                         _predecessor_p;
    00111         unsigned int                            _lowlink_numb;
    00112         unsigned int                            _depth_first_numb;
    00113         bool                                            _marked;
    00114         //-------------------------------------------------------------------------
    00115         // Private Function Members
    00116         //-------------------------------------------------------------------------
    00117         void destroy();
    00118         void copy(const rpState &other);
    00119 };
    00120 #endif