events.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 #ifndef EVENTS_H
00020 #define EVENTS_H
00021 
00022 #endif // EVENTS_H
00023 
00024 
00025 #include "QEvent"
00026 #include "QAbstractTransition"
00027 
00028 #include "packml_sm/common.h"
00029 #include "packml_sm/state.h"
00030 
00031 namespace packml_sm
00032 {
00033 
00034 
00035 static int PACKML_CMD_EVENT_TYPE = QEvent::User+1;
00036 static int PACKML_STATE_COMPLETE_EVENT_TYPE = QEvent::User+2;
00037 static int PACKML_ERROR_EVENT_TYPE = QEvent::User+3;
00038 
00039 struct CmdEvent : public QEvent
00040 {
00041   static CmdEvent* clear()
00042   {
00043     return new CmdEvent(CmdEnum::CLEAR);
00044   }
00045   static CmdEvent* start()
00046   {
00047     return new CmdEvent(CmdEnum::START);
00048   }
00049   static CmdEvent* stop()
00050   {
00051     return new CmdEvent(CmdEnum::STOP);
00052   }
00053   static CmdEvent* hold()
00054   {
00055     return new CmdEvent(CmdEnum::HOLD);
00056   }
00057   static CmdEvent* abort()
00058   {
00059     return new CmdEvent(CmdEnum::ABORT);
00060   }
00061   static CmdEvent* reset()
00062   {
00063     return new CmdEvent(CmdEnum::RESET);
00064   }
00065   static CmdEvent* estop()
00066   {
00067     return new CmdEvent(CmdEnum::ESTOP);
00068   }
00069   static CmdEvent* suspend()
00070   {
00071     return new CmdEvent(CmdEnum::SUSPEND);
00072   }
00073   static CmdEvent* unsuspend()
00074   {
00075     return new CmdEvent(CmdEnum::UNSUSPEND);
00076   }
00077   static CmdEvent* unhold()
00078   {
00079     return new CmdEvent(CmdEnum::UNHOLD);
00080   }
00081 
00082   CmdEvent(const CmdEnum &cmd_value)
00083     : QEvent(QEvent::Type(PACKML_CMD_EVENT_TYPE)),
00084       cmd(cmd_value) {}
00085 
00086   CmdEnum cmd;
00087 };
00088 
00089 
00090 struct StateCompleteEvent : public QEvent
00091 {
00092   StateCompleteEvent()
00093     : QEvent(QEvent::Type(PACKML_STATE_COMPLETE_EVENT_TYPE)) {}
00094 };
00095 
00096 
00097 struct ErrorEvent : public QEvent
00098 {
00099 
00100   ErrorEvent(const int &code_value)
00101     : QEvent(QEvent::Type(PACKML_ERROR_EVENT_TYPE)),
00102       code(code_value),
00103       name(),
00104       description() {}
00105 
00106   ErrorEvent(const int &code_value, const QString &name_value,
00107              const QString &description_value)
00108     : QEvent(QEvent::Type(PACKML_ERROR_EVENT_TYPE)),
00109       code(code_value),
00110       name(name_value),
00111       description(description_value) {}
00112 
00113   int code;
00114   QString name;
00115   QString description;
00116 };
00117 
00118 
00119 } //packml_sm


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