00001 /***************************************************************************** 00002 * Copyright (C) 2011 by Benjamin Hadorn (b_hadorn@bluewin.ch) 00003 ***************************************************************************** 00004 * Project : Zeus Base Library 00005 * Module : SimpleCommand 00006 * Package : Zeus.ZeusBase.MOM 00007 * Author : Benjamin Hadorn 00008 * Date : 27.12.2011 00009 * System : Zeus-Framework 00010 ***************************************************************************** 00011 * Licence: * 00012 * This library is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU Lesser General Public License as * 00014 * published by the Free Software Foundation; either version * 00015 * 2.1 of the License, or (at your option) any later version. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU Lesser General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Lesser General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA * 00025 *****************************************************************************/ 00026 00027 /***************************************************************************** 00028 * Changes: 00029 * 27.12.2011 bha: created zeus 2.0 00030 *****************************************************************************/ 00031 00032 #ifndef SimpleCommandH 00033 #define SimpleCommandH 00034 00035 #include <zeusbase/System/Interfaces/ISimpleCommand.hpp> 00036 #include <zeusbase/System/XObject.h> 00037 #include <zeusbase/System/XObjectFactory.h> 00038 00039 BEGIN_NAMESPACE_Zeus 00040 00041 /******************************************************************************/ 00044 /******************************************************************************/ 00045 zeusbase_class TSimpleCommand : public TXObject, public ISimpleCommand 00046 { 00047 public: 00048 TSimpleCommand(IXMLNode& rNode); 00049 TSimpleCommand(); 00050 00051 void executeExt(Uint uiMode, ISimpleCommand& rCommand); 00052 Retval getListener(IXObject*& rpObject); 00053 00054 //Methods of ISimpleCommand 00055 virtual void MQUALIFIER getTargetObjectName(IString& rName)const; 00056 virtual void MQUALIFIER getMainData(IString& rData)const; 00057 virtual void MQUALIFIER getAddData(IString& rData)const; 00058 virtual void MQUALIFIER getStream(IString& rData) const; 00059 virtual Uint MQUALIFIER getMode() const; 00060 virtual Uint MQUALIFIER getSecurity() const; 00061 virtual void MQUALIFIER setTargetObjectName(const IString& rName); 00062 virtual void MQUALIFIER setMainData(const IString& rData); 00063 virtual void MQUALIFIER setAddData(const IString& rData); 00064 virtual void MQUALIFIER setStream(const IString& rData); 00065 virtual void MQUALIFIER setMode(Uint uiMode); 00066 virtual void MQUALIFIER setSecurity(Uint uiValue); 00067 virtual void MQUALIFIER execute(Uint uiMode); 00068 virtual void MQUALIFIER enableExecuteMode(bool bEnable, Uint uiMode); 00069 virtual Retval MQUALIFIER setListener(IXObject* pListener); 00070 00071 //Methods of IXObject 00072 virtual bool MQUALIFIER freeze(); 00073 00074 //Methods of IZUnknown 00075 MEMORY_MANAGER_DECL 00076 00077 protected: 00078 virtual ~TSimpleCommand(); 00079 00080 REG_SUB_BEGIN(TSimpleCommand) 00081 REG_SUB_ADD(TSimpleCommand, L"TSimpleCommand"); 00082 REG_SUB_END 00083 00084 private: 00086 TString m_strTargetObject; 00088 TString m_strMainData; 00090 TString m_strAddData; 00092 TString m_strStream; 00094 Uint m_uiMode; 00096 Uint m_uiSecurity; 00098 Uint m_uiEnabledModes; 00100 IXObject* m_pListener; 00101 00102 void releaseListener(); 00103 }; 00104 00105 00106 00107 /******************************************************************************/ 00110 /******************************************************************************/ 00111 inline void MQUALIFIER TSimpleCommand::getTargetObjectName(IString& rName) const 00112 { 00113 rName.assignStr(m_strTargetObject); 00114 } 00115 00116 /******************************************************************************/ 00119 /******************************************************************************/ 00120 inline void MQUALIFIER TSimpleCommand::getMainData(IString& rData) const 00121 { 00122 rData.assignStr(m_strMainData); 00123 } 00124 00125 /******************************************************************************/ 00128 /******************************************************************************/ 00129 inline void MQUALIFIER TSimpleCommand::getAddData(IString& rData) const 00130 { 00131 rData.assignStr(m_strAddData); 00132 } 00133 00134 /******************************************************************************/ 00137 /******************************************************************************/ 00138 inline void MQUALIFIER TSimpleCommand::getStream(IString& rData) const 00139 { 00140 rData.assignStr(m_strStream); 00141 } 00142 00143 /******************************************************************************/ 00146 /******************************************************************************/ 00147 inline Uint MQUALIFIER TSimpleCommand::getMode() const 00148 { 00149 return m_uiMode; 00150 } 00151 00152 /******************************************************************************/ 00155 /******************************************************************************/ 00156 inline Uint MQUALIFIER TSimpleCommand::getSecurity() const 00157 { 00158 return m_uiSecurity; 00159 } 00160 00161 /******************************************************************************/ 00164 /******************************************************************************/ 00165 inline void MQUALIFIER TSimpleCommand::setTargetObjectName(const IString& rName) 00166 { 00167 m_strTargetObject = rName; 00168 } 00169 00170 /******************************************************************************/ 00173 /******************************************************************************/ 00174 inline void MQUALIFIER TSimpleCommand::setMainData(const IString& rData) 00175 { 00176 m_strMainData = rData; 00177 } 00178 00179 /******************************************************************************/ 00182 /******************************************************************************/ 00183 inline void MQUALIFIER TSimpleCommand::setAddData(const IString& rData) 00184 { 00185 m_strAddData = rData; 00186 } 00187 00188 /******************************************************************************/ 00191 /******************************************************************************/ 00192 inline void MQUALIFIER TSimpleCommand::setStream(const IString& rData) 00193 { 00194 m_strStream = rData; 00195 } 00196 00197 /******************************************************************************/ 00200 /******************************************************************************/ 00201 inline void MQUALIFIER TSimpleCommand::setMode(Uint uiMode) 00202 { 00203 m_uiMode = uiMode; 00204 } 00205 00206 /******************************************************************************/ 00209 /******************************************************************************/ 00210 inline void MQUALIFIER TSimpleCommand::setSecurity(Uint uiValue) 00211 { 00212 m_uiSecurity = uiValue; 00213 } 00214 00215 /******************************************************************************/ 00218 /******************************************************************************/ 00219 inline void MQUALIFIER TSimpleCommand::execute(Uint uiMode) 00220 { 00221 executeExt(uiMode, *this); 00222 } 00223 00224 00225 00226 END_NAMESPACE_Zeus 00227 00228 00229 #endif