Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUICommand.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef GUICOMMAND__H_
11#define GUICOMMAND__H_
12
13#include "eC_Types.h"
14#include "GUIStreamableObject.h"
15#include "eC_TList_doubleLinked.h"
16#include "RefCounted.h"
17#include "SharedPtr.h"
18
19class CGUICommand;
22
24bool operator==(const CGUICommandPtr& a, const CGUICommandPtr& b);
25bool operator>(const CGUICommandPtr& a, const CGUICommandPtr& b);
26
29
31
127{
128 friend class CGUICommandHandler;
129public:
137 void AddAdditionalCmd(CGUICommandPtr pkCmd, eC_Bool bOneTime = false);
138
142
145
148 inline eC_Bool IsFinished() const { return m_bIsFinished;}
149
152 inline eC_UInt GetTimeUntilNextExecution() const { return m_uiTimeUntilNextExecution; };
153
161 void SetTimeUntilNextExecution(eC_UInt uiTime);
162
165 void SetPriority(eC_UInt uiPriority);
166
170 inline eC_UInt GetPriority() const {return m_uiPriority;}
171
175 eC_UInt GetNumberOfAdditionalCmds() const {return m_kAdditionalCmds.GetQuantity();}
176
182 CGUICommandPtr GetAdditionalCmd(const eC_UInt& uiIndex) const;
183
184
185#if defined GUILIANI_WRITE_GUI
186 virtual void WriteToStream(const eC_Bool bWriteClassID=false);
187#endif
188
189#if defined GUILIANI_STREAM_GUI
190 virtual void ReadFromStream();
191#endif
192
193#if defined(GUILIANI_STREAM_GUI) || defined(GUILIANI_WRITE_GUI)
195 static const eC_Char XMLTAG_COMMANDCLASSID[];
196
198 static const eC_Char XMLTAG_ADDITIONALCMDCOUNT[];
199
201 static const eC_Char XMLTAG_REMOVE_AFTER_EXECUTION[];
202#endif
203
204protected:
214 inline void SetToBeFinished(eC_Bool bIsFinished){m_bIsFinished = bIsFinished;}
215
227 CGUICommand(const eC_UInt uiPriority = 0, const eC_UInt uiTimeUntilFirstExecution = 0, const eC_Bool bFinished = true);
228
231 virtual void Do() = 0;
232
234 virtual ~CGUICommand() {}
235private:
238 void ExecuteAdditionalCmds();
239
243 eC_Bool m_bIsFinished;
244
246 eC_UInt m_uiTimeUntilNextExecution;
247
250 eC_UInt m_uiPriority;
251
252 struct AdditionalCmd_t
253 {
254 AdditionalCmd_t()
255 : m_pkCmd(NULL), m_bExecOneTime(false) {}
256 AdditionalCmd_t(CGUICommandPtr pkCmd, eC_Bool bExecOneTime)
257 : m_pkCmd(pkCmd), m_bExecOneTime(bExecOneTime) {}
258 CGUICommandPtr m_pkCmd;
259 eC_Bool m_bExecOneTime;
260 };
261
262 typedef eC_TListDoubleLinked<AdditionalCmd_t> AdditionalCmdList;
263 AdditionalCmdList m_kAdditionalCmds;
264};
265#endif
Manages and executes instances of CGUICommand.
Definition: GUICommandHandler.h:109
Command object base class.
Definition: GUICommand.h:127
void SetTimeUntilNextExecution(eC_UInt uiTime)
eC_UInt GetTimeUntilNextExecution() const
Definition: GUICommand.h:152
virtual void WriteToStream(const eC_Bool bWriteClassID=false)
void AddAdditionalCmd(CGUICommandPtr pkCmd, eC_Bool bOneTime=false)
static const eC_Char XMLTAG_COMMANDCLASSID[]
XML tag to be used when writing the command class ID into a stream.
Definition: GUICommand.h:195
void RemoveAllAdditionalCmds()
Removes all additional commands from this command's list.
eC_UInt GetNumberOfAdditionalCmds() const
Definition: GUICommand.h:175
virtual void ReadFromStream()
CGUICommandPtr GetAdditionalCmd(const eC_UInt &uiIndex) const
void RemoveAdditionalCmd(CGUICommandPtr pkCmd)
virtual ~CGUICommand()
Destructor.
Definition: GUICommand.h:234
static const eC_Char XMLTAG_ADDITIONALCMDCOUNT[]
XML tag to be used when writing the additional command count into a stream.
Definition: GUICommand.h:198
CGUICommand(const eC_UInt uiPriority=0, const eC_UInt uiTimeUntilFirstExecution=0, const eC_Bool bFinished=true)
eC_Bool IsFinished() const
Definition: GUICommand.h:148
void SetPriority(eC_UInt uiPriority)
virtual void Do()=0
void SetToBeFinished(eC_Bool bIsFinished)
Definition: GUICommand.h:214
static const eC_Char XMLTAG_REMOVE_AFTER_EXECUTION[]
XML tag to be used when writing the remove after execution flag.
Definition: GUICommand.h:201
eC_UInt GetPriority() const
Definition: GUICommand.h:170
Base class for streamable objects.
Definition: GUIStreamableObject.h:45
The reference counted pointer class used with SharedPtr.
Definition: RefCounted.h:32
eC_UInt GetQuantity() const
Definition: eC_TList_doubleLinked.h:587
bool operator==(const NSmartPtr::SharedPtr< C1 > &a, const NSmartPtr::SharedPtr< C2 > &b)
Definition: SharedPtr.h:240