Urbi SDK Remote for C++  2.7.5
uevent.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010, 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 libuco/uevent-common.cc
00012 #include <urbi/ucontext.hh>
00013 #include <urbi/uobject.hh>
00014 #include <urbi/uvalue.hh>
00015 
00016 namespace urbi
00017 {
00018 
00019   /*---------.
00020   | UEvent.  |
00021   `---------*/
00022   UEvent::UEvent(const std::string& varname,
00023                  impl::UContextImpl* impl)
00024     : UContext(impl)
00025     , name(varname)
00026   {
00027     __init();
00028   }
00029 
00030   UEvent::UEvent(UObject& obj, const std::string& varname,
00031                  impl::UContextImpl* impl)
00032     : UContext(impl)
00033     , name(obj.__name + '.' + varname)
00034   {
00035     __init();
00036   }
00037 
00038   UEvent::UEvent(const std::string& objname, const std::string& varname,
00039                  impl::UContextImpl* impl)
00040     : UContext(impl)
00041     , name(objname + '.' + varname)
00042   {
00043     __init();
00044   }
00045 
00046   UEvent::UEvent(const UEvent& b)
00047     : UContext(b.ctx_)
00048     , name(b.name)
00049   {
00050     __init();
00051   }
00052 
00053   void
00054   UEvent::init(const std::string& objname, const std::string& varname,
00055                impl::UContextImpl* ctx)
00056   {
00057     ctx_ = ctx;
00058     if (!ctx_)
00059       ctx_ = getCurrentContext();
00060     name = objname + '.' + varname;
00061     ctx->declare_event(this);
00062   }
00063 
00064 } // namespace urbi