Urbi SDK Remote for C++  2.7.5
uevent.hh
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010-2011, Gostai S.A.S.
00003  *
00004  * This software is provided "as is" without warranty of any kind,
00005  * either expressed or implied, including but not limited to the
00006  * implied warranties of fitness for a particular purpose.
00007  *
00008  * See the LICENSE file for more information.
00009  */
00010 
00011 // \file urbi/uevent.hh
00012 #ifndef URBI_UEVENT_HH
00013 # define URBI_UEVENT_HH
00014 
00015 # include <iosfwd>
00016 # include <string>
00017 
00018 # include <urbi/ucontext.hh>
00019 
00020 namespace urbi
00021 {
00027   class URBI_SDK_API UEvent: public UContext
00028   {
00029   public:
00031     UEvent();
00032     UEvent(const std::string& varname, urbi::impl::UContextImpl* impl = 0);
00033     UEvent(const std::string& objname, const std::string& varname,
00034            urbi::impl::UContextImpl* impl = 0);
00035     UEvent(urbi::UObject& obj, const std::string& varname,
00036            urbi::impl::UContextImpl* impl = 0);
00037     UEvent(const UEvent& e);
00038 
00039     // Bind to \a object.slot.
00040     void init(const std::string& object, const std::string& slot,
00041               urbi::impl::UContextImpl* = 0);
00042 
00043     // Emit the event.
00044     void emit(urbi::UAutoValue v1 = UAutoValue(),
00045               urbi::UAutoValue v2 = UAutoValue(),
00046               urbi::UAutoValue v3 = UAutoValue(),
00047               urbi::UAutoValue v4 = UAutoValue(),
00048               urbi::UAutoValue v5 = UAutoValue(),
00049               urbi::UAutoValue v6 = UAutoValue(),
00050               urbi::UAutoValue v7 = UAutoValue());
00051 
00052  private:
00053     void __init();
00054 
00056 # define PRIVATE(Type, Name)                    \
00057   public:                                       \
00058     Type get_ ##  Name ()                       \
00059     {                                           \
00060       return Name;                              \
00061     }                                           \
00062     Type get_ ##  Name () const                 \
00063     {                                           \
00064       return Name;                              \
00065     }                                           \
00066     void set_ ##  Name (const Type& v)          \
00067     {                                           \
00068       Name = v;                                 \
00069     }                                           \
00070   private:                                      \
00071     Type Name;
00072 
00074     PRIVATE(std::string, name)
00075 # undef PRIVATE
00076   };
00077 } // end namespace urbi
00078 
00079 # include <urbi/uevent.hxx>
00080 
00081 #endif // ! URBI_UEVENT_HH