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 #ifdef _MSC_VER
00039 # pragma warning ( push )
00040 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
00041 #endif
00042
00043 namespace GENAPI_NAMESPACE
00044 {
00045
00046
00047
00048
00051 interface GENAPI_DECL_ABSTRACT ICommand : virtual public IValue
00052 {
00053 public:
00054
00056
00059 virtual void Execute(bool Verify = true) = 0;
00060
00062 virtual void operator()() = 0;
00063
00065
00069 virtual bool IsDone(bool Verify = true) = 0;
00070
00071
00072 };
00073
00074
00075
00076
00077
00078
00079 #ifndef DOXYGEN_IGNORE
00080
00086 template <class T>
00087 class CCommandRefT : public CValueRefT<T>
00088 {
00089 typedef CValueRefT<T> ref;
00090
00091 public:
00092
00093
00094
00095
00097 virtual void Execute(bool Verify = true)
00098 {
00099 if(ref::m_Ptr)
00100 return ref::m_Ptr->Execute(Verify);
00101 else
00102 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00103 }
00104
00106 virtual void operator()()
00107 {
00108 if(ref::m_Ptr)
00109 ref::m_Ptr->operator()();
00110 else
00111 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00112 }
00113
00115 virtual bool IsDone(bool Verify = true)
00116 {
00117 if(ref::m_Ptr)
00118 return ref::m_Ptr->IsDone(Verify);
00119 else
00120 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00121 }
00122
00123
00124 };
00125
00128 typedef CCommandRefT<ICommand> CCommandRef;
00129
00130 #endif
00131
00132 }
00133
00134 #ifdef _MSC_VER
00135 # pragma warning ( pop )
00136 #endif
00137
00138 #endif // ifndef GENAPI_ICOMMAND_H