Urbi SDK Remote for C++  2.7.5
uaccess3.uob/uaccess.cc
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008-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 #include "uaccess.hh"
00012 #include <libport/debug.hh>
00013 #include <iostream>
00014 using namespace urbi;
00015 
00016 UStart (uaccess);
00017 GD_CATEGORY(Test.UAccess);
00018 
00019 uaccess::uaccess (const std::string& s)
00020   : UObject (s)
00021 {
00022   UBindFunction (uaccess, init);
00023   UBindVar (uaccess, val);
00024   UOwned (val);
00025   UNotifyAccess (val, &uaccess::newval);
00026   UNotifyChange  (val, &uaccess::changed);
00027 }
00028 
00029 int
00030 uaccess::init ()
00031 {
00032   val = 0;
00033   return 0;
00034 }
00035 
00036 UReturn
00037 uaccess::newval (UVar& v)
00038 {
00039   static int value = 0;
00040   value++;
00041   GD_FINFO_DEBUG("newval: value = %s", value);
00042   v = value;
00043   return 0;
00044 }
00045 
00046 UReturn
00047 uaccess::changed (UVar& v)
00048 {
00049   std::cout <<  (int)v << "\n";
00050   return 0;
00051 }