|
Urbi SDK Remote for C++
2.7.5
|
00001 /* 00002 * Copyright (C) 2009-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 #ifndef URBI_UBLEND_TYPE_HH 00012 # define URBI_UBLEND_TYPE_HH 00013 00014 # include <libport/cstring> 00015 # include <libport/cassert> 00016 00017 namespace urbi 00018 { 00019 00020 /*-------------. 00021 | UBlendType. | 00022 `-------------*/ 00023 00024 //WARNING: synchronize with blendNames below, must be 0-based 00026 enum UBlendType 00027 { 00028 UMIX, 00029 UADD, 00030 UDISCARD, 00031 UQUEUE, 00032 UCANCEL, 00033 UNORMAL 00034 }; 00035 00036 namespace 00037 { 00038 const char* UBlendNames[]= 00039 { 00040 "mix", 00041 "add", 00042 "discard", 00043 "queue", 00044 "cancel", 00045 "normal", 00046 }; 00047 } 00048 00049 inline 00050 // FIXME: This is needed by urbi-sdk/uvar.cc. 00051 bool 00052 is_blendtype (int i) 00053 { 00054 return static_cast<int> (UMIX) <= i && i <= static_cast<int> (UNORMAL); 00055 } 00056 00057 // values for enum-like properties 00058 inline 00059 const char* 00060 name (UBlendType u) 00061 { 00062 return UBlendNames[static_cast <int> (u)]; 00063 } 00064 00065 inline 00066 UBlendType 00067 ublendtype (const char* cp) 00068 { 00069 for (int i = 0; is_blendtype (i); ++i) 00070 if (libport::streq (UBlendNames[i], cp)) 00071 return static_cast<UBlendType> (i); 00072 pabort ("unknown blendtype: " << cp); 00073 00074 } 00075 00076 } // end namespace urbi 00077 00078 #endif // ! URBI_UBLEND_TYPE_HH