ICommand.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2006 by Basler Vision Technologies
00003 //  Section: Vision Components
00004 //  Project: GenApi
00005 //  Author:  Hartmut Nebelung
00006 //  $Header$
00007 //
00008 //  License: This file is published under the license of the EMVA GenICam  Standard Group.
00009 //  A text file describing the legal terms is included in  your installation as 'GenICam_license.pdf'.
00010 //  If for some reason you are missing  this file please contact the EMVA or visit the website
00011 //  (http://www.genicam.org) for a full copy.
00012 //
00013 //  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
00014 //  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00015 //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016 //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD  GROUP
00017 //  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,
00018 //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED TO,
00019 //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS;
00020 //  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  THEORY OF LIABILITY,
00021 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)
00022 //  ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023 //  POSSIBILITY OF SUCH DAMAGE.
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     // ICommand interface
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     // CCommandRef class
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         // ICommand
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


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 18:42:47