transitions.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (Apache License)
00003  *
00004  * Copyright (c) 2016 Shaun Edwards
00005  *
00006  * Licensed under the Apache License, Version 2.0 (the "License");
00007  * you may not use this file except in compliance with the License.
00008  * You may obtain a copy of the License at
00009  *
00010  * http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  */
00018 
00019 
00020 #ifndef TRANSITIONS_H
00021 #define TRANSITIONS_H
00022 
00023 
00024 #include <QtGui>
00025 #include "QEvent"
00026 #include "QAbstractTransition"
00027 
00028 #include "packml_sm/common.h"
00029 #include "packml_sm/state.h"
00030 
00031 #include "ros/console.h"
00032 
00033 namespace packml_sm
00034 {
00035 
00036 
00037 
00038 
00039 class CmdTransition : public QAbstractTransition
00040 {
00041 public:
00042 
00043 
00044   static CmdTransition* clear(PackmlState & from, PackmlState & to)
00045   {
00046     return new CmdTransition(CmdEnum::CLEAR, "clear", from, to);
00047   }
00048   static CmdTransition* start(PackmlState & from, PackmlState & to)
00049   {
00050     return new CmdTransition(CmdEnum::START, "start", from, to);
00051   }
00052   static CmdTransition* stop(PackmlState & from, PackmlState & to)
00053   {
00054     return new CmdTransition(CmdEnum::STOP, "stop", from, to);
00055   }
00056   static CmdTransition* hold(PackmlState & from, PackmlState & to)
00057   {
00058     return new CmdTransition(CmdEnum::HOLD, "hold", from, to);
00059   }
00060   static CmdTransition* abort(PackmlState & from, PackmlState & to)
00061   {
00062     return new CmdTransition(CmdEnum::ABORT, "abort", from, to);
00063   }
00064   static CmdTransition* reset(PackmlState & from, PackmlState & to)
00065   {
00066     return new CmdTransition(CmdEnum::RESET, "reset", from, to);
00067   }
00068   static CmdTransition* estop(PackmlState & from, PackmlState & to)
00069   {
00070     return new CmdTransition(CmdEnum::ESTOP, "estop", from, to);
00071   }
00072   static CmdTransition* suspend(PackmlState & from, PackmlState & to)
00073   {
00074     return new CmdTransition(CmdEnum::SUSPEND, "abort", from, to);
00075   }
00076   static CmdTransition* unsuspend(PackmlState & from, PackmlState & to)
00077   {
00078     return new CmdTransition(CmdEnum::UNSUSPEND, "unsuspend", from, to);
00079   }
00080   static CmdTransition* unhold(PackmlState & from, PackmlState & to)
00081   {
00082     return new CmdTransition(CmdEnum::UNHOLD, "unhold", from, to);
00083   }
00084 
00085   CmdTransition(const CmdEnum &cmd_value, const QString &name_value) :
00086     cmd(cmd_value),
00087     name(name_value) {}
00088 
00089 
00090   CmdTransition(const CmdEnum &cmd_value, const QString &name_value,
00091                 PackmlState & from, PackmlState & to);
00092 
00093 protected:
00094 
00095 
00096   virtual bool eventTest(QEvent *e);
00097   virtual void onTransition(QEvent *e) {}
00098 
00099   CmdEnum cmd;
00100   QString name;
00101 };
00102 
00103 
00104 
00105 
00106 class StateCompleteTransition : public QAbstractTransition
00107 {
00108 public:
00109   StateCompleteTransition() {}
00110 
00111   StateCompleteTransition(PackmlState & from, PackmlState & to);
00112 
00113   ~StateCompleteTransition() {}
00114 
00115 protected:
00116   virtual bool eventTest(QEvent *e);
00117   virtual void onTransition(QEvent *e) {}
00118 
00119 private:
00120 };
00121 
00122 
00123 class ErrorTransition : public QAbstractTransition
00124 {
00125 public:
00126 
00127   ErrorTransition() {}
00128 
00129   ErrorTransition(PackmlState & from, PackmlState & to);
00130 
00131   ~ErrorTransition() {}
00132 
00133 protected:
00134   virtual bool eventTest(QEvent *e);
00135   virtual void onTransition(QEvent *e) {}
00136 
00137 
00138 private:
00139 };
00140 
00141 
00142 
00143 
00144 
00145 }
00146 #endif // TRANSITIONS_H


packml_sm
Author(s): Shaun Edwards
autogenerated on Sat Jun 8 2019 20:13:34