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

# /Users/fpy/titan-1-5-MBARI/Mers/Models/CCA/CCAState.h

    00001
    00002 //
    00003 // Copyright (c) 2004           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 // Organization:        Model-based Embedded and Robotic Systems Group
    00010 //                                      Massachusetts Institute of Technology
    00011 //
    00013
    00014 #ifndef __CCASTATE__
    00015 #define __CCASTATE__
    00016
    00017 #ifdef _MSC_VER
    00018 #pragma warning( disable : 4786 )
    00019 #endif
    00020
    00021 //#include <cstdlib>
    00022
    00023 #include <Mers/Utils/Lang/BaseModelObject.h>
    00024
    00025 #include "CCASentence.h"
    00026 #include "CCATransitions.h"
    00027 #include "CCAValue.h"
    00028 #include "CCATransition.h"
    00029
    00030 namespace Mers {
    00031         namespace Models {
    00032                 namespace CCA {
    00033
    00034                         class CCAModel;
    00035                         class CCAAutomata;
    00036                         class CCAAutomaton;
    00037
    00043                         class CCAState : public Mers::Utils::Lang::BaseModelObject
    00044                         {
    00045                         public:
    00047                                 // Type Definitions & Constants
    00049
    00053                                 enum StateType                  {NOMINAL, FAILURE, UNKNOWN};
    00055                                 // Constructors, Copy Constructors, & Destructors
    00057                                 CCAState();
    00058                                 CCAState(const CCAAutomaton &_automaton, const CCAValue &_value);
    00059                                 CCAState(const CCAState &other);
    00060                                 ~CCAState();
    00061
    00063                                 // Public Function Members
    00065
    00073                                 static char const * stateTypeToString(StateType type);
    00085                                 static int stringToStateType(char const * str, StateType &type);
    00086
    00087                                 bool                                    set_automaton_p(const CCAAutomaton &_automaton);
    00088                                 const CCAAutomaton *    automaton_p()                                                           const;
    00089                                 const CCAAutomata *             ccAutomata_p()                                                          const;
    00090                                 const CCAModel *                model_p()                                                                       const;
    00091                                 char const *            name()                                                                          const;
    00092                                 char const *            getName()                                   const;
    00093                                 const CCAValue  *               value_p()                                                                       const;
    00094                                 const CCAValue *        getValue()                                  const;
    00095                                 bool                                    set_type(const StateType new_type);
    00096                                 StateType                               type()                                                                          const;
    00097                                 StateType                               getStateType()                              const;
    00098                                 bool                                    set_constraint(const CCASentence &new_constraint);
    00099                                 const CCASentence *             constraint_p()                                                          const;
    00100                                 CCASentence *                   constraint_p();
    00101
    00108                                 void setUID(unsigned int newUID);
    00109
    00113                                 unsigned int getUID() const;
    00114
    00115                                 CCATransitions::const_iterator
    00116                                 insert_in_transition(CCATransition * _transition);
    00117
    00118                                 bool                                    clear_in_transitionPtrs();
    00119
    00120                                 const CCATransitions *  in_transitionPtrs_p()                                           const;
    00121
    00122                                 CCATransitions::const_iterator
    00123                                 insert_out_transition(CCATransition * _transition);
    00124
    00125                                 bool                                    clear_out_transitionPtrs();
    00126
    00127                                 const CCATransitions *  out_transitionPtrs_p()                                          const;
    00128
    00129 #ifndef EMBEDDED
    00130
    00135                                 void print(std::ostream &out) const;
    00136 #endif
    00137
    00139                                 // Public Operators
    00141                                 const CCAState  &               operator =(const CCAState &other);
    00142                                 bool                                    operator ==(const CCAState &other)                              const;
    00143                                 bool                                    operator !=(const CCAState &other)                              const;
    00144
    00145                         private:
    00147                                 // Private Object Members
    00149                                 const CCAAutomaton *            parentAutomaton;
    00150                                 const CCAValue  *                       _value_p;
    00151                                 StateType                               _type;
    00152                                 CCASentence                             _constraint;
    00153                                 CCATransitions                  _in_transitionPtrs;
    00154                                 CCATransitions                  _out_transitionPtrs;
    00155                                 unsigned int  uid;
    00157                                 // Private Function Members
    00159                                 void destroy();
    00160                                 void copy(const CCAState &other);
    00161                         };
    00162                 }
    00163         }
    00164 }
    00165
    00166 #endif