Re: [osg-users] Node::Description intoageneralized propertymechanism?

2010-01-05 Thread Ulrich Hertlein
Hi Bryan,

On 5/01/10 3:31 AM, Thrall, Bryan wrote:
 Data is stored like this: osg::Propertyint* ip = new 
 osg::Propertyint(42); 
 obj-setProperty(my.int, ip);
 
 and retrieved like this: osg::Propertyint* ip0 = 
 dynamic_castosg::Propertyint
 (obj-
 getProperty(my.int));
 ip0-get() == 42;
 
 The assignment and comparison syntax is a little odd; I think adding 
 operator=(),
 operator==(), etc. to osg::Property would be better, so you could do
 
 *obj-getPropertyint(my.int) = 42; if (*obj-getPropertyint(my.int) 
 == 42) {
 ...}
 
 Thanks for the hard work, I'm looking forward to seeing this in OSG :)

My fault, I actually implemented this as well. :-)

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Node::Description intoageneralized propertymechanism?

2010-01-04 Thread Thrall, Bryan
Ulrich Hertlein wrote on 2009-12-31: 
 I have coded up a proposal for a general-purpose property system for
 osg::Object and would
 like to present it for comments and discussion.

Looks very cool!

 For data that is not derived from osg::Referenced (like floats, int,
 strings) instead of
 using a variant class I've created the following template class:
 
 template typename T class Property : public Referenced {
 public:
 //...
 void set(const T data) { _data = data; }
 const T get() const { return _data; }
 T get() { return _data; }
 private:
 T _data;
 };
 
 Data is stored like this:
 osg::Propertyint* ip = new osg::Propertyint(42);
 obj-setProperty(my.int, ip);
 
 and retrieved like this:
 osg::Propertyint* ip0 = dynamic_castosg::Propertyint (obj-
 getProperty(my.int));
 ip0-get() == 42;

The assignment and comparison syntax is a little odd; I think adding 
operator=(), operator==(), etc. to osg::Property would be better, so you could 
do

*obj-getPropertyint(my.int) = 42;
if (*obj-getPropertyint(my.int) == 42) { ...}

Thanks for the hard work, I'm looking forward to seeing this in OSG :)
--
Bryan Thrall
FlightSafety International
bryan.thr...@flightsafety.com
  

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org