Revision: 7549
http://playerstage.svn.sourceforge.net/playerstage/?rev=7549&view=rev
Author: rtv
Date: 2009-03-27 08:50:26 +0000 (Fri, 27 Mar 2009)
Log Message:
-----------
cleaned API for property database
Modified Paths:
--------------
code/stage/trunk/libstage/model_props.cc
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/libstage/model_props.cc
===================================================================
--- code/stage/trunk/libstage/model_props.cc 2009-03-27 07:18:14 UTC (rev
7548)
+++ code/stage/trunk/libstage/model_props.cc 2009-03-27 08:50:26 UTC (rev
7549)
@@ -4,7 +4,7 @@
#define MATCH(A,B) (strcmp(A,B)== 0)
-void* Model::GetProperty( char* key )
+void* Model::GetProperty( const char* key )
{
// see if the key has the predefined-property prefix
if( strncmp( key, MP_PREFIX, strlen(MP_PREFIX)) == 0 )
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-03-27 07:18:14 UTC (rev 7548)
+++ code/stage/trunk/libstage/stage.hh 2009-03-27 08:50:26 UTC (rev 7549)
@@ -1623,6 +1623,7 @@
Visibility vis;
+ stg_usec_t GetSimInterval(){ return world->interval_sim; }
void Lock()
{
@@ -2044,8 +2045,48 @@
/** named-property interface
*/
- void* GetProperty( char* key );
-
+ void* GetProperty( const char* key );
+
+ bool GetPropertyFloat( const char* key, float* f, float defaultval )
+ {
+ float* fp = (float*)GetProperty( key );
+ if( fp )
+ {
+ *f = *fp;
+ return true;
+ }
+
+ *f = defaultval;
+ return false;
+ }
+
+ bool GetPropertyInt( const char* key, int* i, int defaultval )
+ {
+ int* ip = (int*)GetProperty( key );
+ if( ip )
+ {
+ *i = *ip;
+ return true;
+ }
+
+ *i = defaultval;
+ return false;
+ }
+
+ bool GetPropertyStr( const char* key, char** c, char* defaultval )
+ {
+ char* cp = (char*)GetProperty( key );
+
+ if( cp )
+ {
+ *c = cp;
+ return true;
+ }
+
+ *c = defaultval;
+ return false;
+ }
+
/** @brief Set a named property of a Stage model.
Set a property of a Stage model.
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit