|
Urbi SDK Remote for C++
2.7.5
|
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 <libport/debug.hh> 00012 #include <iostream> 00013 #include "generic.hh" 00014 00015 GD_CATEGORY(Test.Generic); 00016 UStart (generic); 00017 00018 generic::generic(const std::string& s) 00019 : UObject(s) 00020 { 00021 UBindVar(generic, val); 00022 UBindFunction(generic, init); 00023 UBindFunction(generic, foo); 00024 UBindFunction(generic, inc); 00025 00026 UNotifyChange(val, &generic::newval); 00027 #if FIXME 00028 // This feature is deprecated (it is not implemented in k2, and it 00029 // was considered not relevant). So unless there are reason to 00030 // reenable it, don't use it. 00031 00032 // This means that the group "generics" will be created 00033 // automatically. 00034 UAutoGroup(); 00035 #endif 00036 } 00037 00038 int 00039 generic::init() 00040 { 00041 return 0; 00042 } 00043 00044 int 00045 generic::foo(int x) 00046 { 00047 GD_FINFO_DEBUG("foo(%s)", x); 00048 val = x; 00049 return x+1; 00050 } 00051 00052 IF_VOID(void, int) 00053 generic::inc() 00054 { 00055 GD_INFO_DEBUG("inc"); 00056 // Yeah, not nicely written... Study the UVar interface to rewrite 00057 // this cleanly. 00058 val = (int) val + 1; 00059 IF_VOID(, return 666); 00060 } 00061 00062 UReturn 00063 generic::newval(UVar& v) 00064 { 00065 LIBPORT_USE(v); 00066 GD_FINFO_DEBUG("newval: %s", (int) v); 00067 return 0; 00068 }