|
Urbi SDK Remote for C++
2.7.5
|
00001 /* 00002 * Copyright (C) 2009, 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 00012 00013 #ifndef URBI_UPROPERTY_HH 00014 # define URBI_UPROPERTY_HH 00015 00016 # include <libport/cstring> 00017 # include <libport/cassert> 00018 00019 namespace urbi 00020 { 00021 00023 enum UProperty 00024 { 00025 PROP_RANGEMIN, 00026 PROP_RANGEMAX, 00027 PROP_SPEEDMIN, 00028 PROP_SPEEDMAX, 00029 PROP_BLEND, 00030 PROP_DELTA, 00031 PROP_CONSTANT, 00032 }; 00033 00034 namespace 00035 { 00036 const char* UPropertyNames[]= 00037 { 00038 "rangemin", 00039 "rangemax", 00040 "speedmin", 00041 "speedmax", 00042 "blend", 00043 "delta", 00044 "constant", 00045 }; 00046 } 00047 00048 // FIXME: This is needed by urbi-sdk/uvar.cc. 00049 inline 00050 bool 00051 is_propertytype (int i) 00052 { 00053 return (static_cast<int> (PROP_RANGEMAX) <= i 00054 && i <= static_cast<int> (PROP_CONSTANT)); 00055 } 00056 00057 // values for enum-like properties 00058 inline 00059 const char* 00060 name (UProperty u) 00061 { 00062 return UPropertyNames[static_cast <int> (u)]; 00063 } 00064 00065 inline 00066 UProperty 00067 uproperty (const char* cp) 00068 { 00069 for (int i = 0; is_propertytype (i); ++i) 00070 if (libport::streq (UPropertyNames[i], cp)) 00071 return static_cast<UProperty> (i); 00072 pabort ("unknown uproperty: " << cp); 00073 } 00074 00075 } 00076 00077 #endif