Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00031 #ifndef GENAPI_ICOMMAND_H
00032 #define GENAPI_ICOMMAND_H
00033
00034 #include <GenApi/GenApiDll.h>
00035 #include <GenApi/Types.h>
00036 #include <GenApi/IValue.h>
00037
00038 #pragma warning ( push )
00039 #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
00040
00041 namespace GENAPI_NAMESPACE
00042 {
00043
00044
00045
00046
00049 interface GENAPI_DECL_ABSTRACT ICommand : virtual public IValue
00050 {
00051 public:
00052
00054
00057 virtual void Execute(bool Verify = true) = 0;
00058
00060 virtual void operator()() = 0;
00061
00063
00067 virtual bool IsDone(bool Verify = true) = 0;
00068
00069
00070 };
00071
00072
00073
00074
00075
00076
00077 #ifndef DOXYGEN_IGNORE
00078
00084 template <class T>
00085 class CCommandRefT : public CValueRefT<T>
00086 {
00087 typedef CValueRefT<T> ref;
00088
00089 public:
00090
00091
00092
00093
00095 virtual void Execute(bool Verify = true)
00096 {
00097 if(ref::m_Ptr)
00098 return ref::m_Ptr->Execute(Verify);
00099 else
00100 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00101 }
00102
00104 virtual void operator()()
00105 {
00106 if(ref::m_Ptr)
00107 ref::m_Ptr->operator()();
00108 else
00109 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00110 }
00111
00113 virtual bool IsDone(bool Verify = true)
00114 {
00115 if(ref::m_Ptr)
00116 return ref::m_Ptr->IsDone(Verify);
00117 else
00118 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00119 }
00120
00121
00122 };
00123
00126 typedef CCommandRefT<ICommand> CCommandRef;
00127
00128 #endif
00129
00130 }
00131
00132 #pragma warning ( pop )
00133
00134 #endif // ifndef GENAPI_ICOMMAND_H