Re: [osg-users] Unknown visitor running first and general visitor types

2008-12-17 Thread Art Tevs
Sorry, I have send the message before completing it:

unsigned int osg::computeVisitorType(const std::string type_id)
{
   return some_hash(type_id);
}

This would enable the possibility to check out which type of visitor is 
currently traversing the node. Also in future releases or in external 
applications with just different visitors there would be a possibility to 
detect visitor types in a simple way.

All osg visitors might be named with osg_ prefix and hence make them more or 
less unique (of course in the limitation of the hash function used).

What about that idea?

art
 It seems that in the current version of osg, there is some
 unknown node visitor running over all of my nodes. The node
 type does return just NODE_VISITOR=0. Hence I do not see any
 way to find out, which type of visitor is traversing there.
 
 Currently there exists so many different node visitors in
 the core osg, that it is somehow very strange to have the
 VisitorType enum only describing couple of them, which are
 even come from osgUtil and not from osg ;). I would propose
 to have here some other kind of identification of a visitor.
 
 What about being the visitor type not an enumeration but an
 integer and create new visitor types by something like a
 hash function over a string or so. Maybe a global method in
 the core osg like:
 unsigned int osg::computeVisitorType(const std::string
 type_id)
 {
 
 }
 
 
 
   
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


Re: [osg-users] Unknown visitor running first and general visitor types

2008-12-17 Thread Art Tevs
Hi

yes we could also add some kind of getName() which returns a string. However 
using a hash based approach would have more performance, because only integer 
comparison is needed (if you want to check for the visitor type during a 
traversal call for example). It will also remove the VisitorType enum which 
isn't really covers the whole bunch of visitor types.

cheers,
art




--- Robert Osfield robert.osfi...@gmail.com schrieb am Mi, 17.12.2008:

 Von: Robert Osfield robert.osfi...@gmail.com
 Betreff: Re: [osg-users] Unknown visitor running first and general visitor 
 types
 An: stud_in...@yahoo.de, OpenSceneGraph Users 
 osg-users@lists.openscenegraph.org
 Datum: Mittwoch, 17. Dezember 2008, 12:17
 Hi Art,
 
 All osg::Object's have a className() method. 
 NodeVisitor is just
 subclass from osg::Referenced so doesn't have this, but
 we could
 certainly add it, it'd be less effort and more
 informative than the
 coming up with some hashmap scheme.
 
 Robert.
 
 On Wed, Dec 17, 2008 at 10:30 AM, Art Tevs
 stud_in...@yahoo.de wrote:
  Hi folks,
 
  It seems that in the current version of osg, there is
 some unknown node visitor running over all of my nodes. The
 node type does return just NODE_VISITOR=0. Hence I do not
 see any way to find out, which type of visitor is traversing
 there.
 
  Currently there exists so many different node visitors
 in the core osg, that it is somehow very strange to have the
 VisitorType enum only describing couple of them, which are
 even come from osgUtil and not from osg ;). I would propose
 to have here some other kind of identification of a visitor.
 
  What about being the visitor type not an enumeration
 but an integer and create new visitor types by something
 like a hash function over a string or so. Maybe a global
 method in the core osg like:
  unsigned int osg::computeVisitorType(const
 std::string type_id)
  {
 
  }
 
 
 
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 


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


Re: [osg-users] Unknown visitor running first and general visitor types

2008-12-17 Thread Robert Osfield
Hi Art,

All osg::Object's have a className() method.  NodeVisitor is just
subclass from osg::Referenced so doesn't have this, but we could
certainly add it, it'd be less effort and more informative than the
coming up with some hashmap scheme.

Robert.

On Wed, Dec 17, 2008 at 10:30 AM, Art Tevs stud_in...@yahoo.de wrote:
 Hi folks,

 It seems that in the current version of osg, there is some unknown node 
 visitor running over all of my nodes. The node type does return just 
 NODE_VISITOR=0. Hence I do not see any way to find out, which type of visitor 
 is traversing there.

 Currently there exists so many different node visitors in the core osg, that 
 it is somehow very strange to have the VisitorType enum only describing 
 couple of them, which are even come from osgUtil and not from osg ;). I would 
 propose to have here some other kind of identification of a visitor.

 What about being the visitor type not an enumeration but an integer and 
 create new visitor types by something like a hash function over a string or 
 so. Maybe a global method in the core osg like:
 unsigned int osg::computeVisitorType(const std::string type_id)
 {

 }




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

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


[osg-users] Unknown visitor running first and general visitor types

2008-12-17 Thread Art Tevs
Hi folks,

It seems that in the current version of osg, there is some unknown node visitor 
running over all of my nodes. The node type does return just NODE_VISITOR=0. 
Hence I do not see any way to find out, which type of visitor is traversing 
there.

Currently there exists so many different node visitors in the core osg, that it 
is somehow very strange to have the VisitorType enum only describing couple of 
them, which are even come from osgUtil and not from osg ;). I would propose to 
have here some other kind of identification of a visitor.

What about being the visitor type not an enumeration but an integer and create 
new visitor types by something like a hash function over a string or so. Maybe 
a global method in the core osg like:
unsigned int osg::computeVisitorType(const std::string type_id)
{

}



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


Re: [osg-users] Unknown visitor running first and general visitor types

2008-12-17 Thread Robert Osfield
Hi Art,

On Wed, Dec 17, 2008 at 11:33 AM, Art Tevs stud_in...@yahoo.de wrote:
 yes we could also add some kind of getName() which returns a string. However 
 using a hash based approach would have more performance, because only integer 
 comparison is needed (if you want to check for the visitor type during a 
 traversal call for example). It will also remove the VisitorType enum which 
 isn't really covers the whole bunch of visitor types.

Um... I'm absolutely not about to go breaking the API so VisitorType
stays. The VisitorType is very useful for detecting specific types of
visitors such as event visitors, cull visitors etc as these have a
special role in the OSG as they are a fundamental part of each frame.
The rest of the NodeVisitor provided specialist functions.

className() is not getName(), one uses getName() for names of objects,
className() in the OSG is used exclusively for reporting the name of
the class.  This is both useful for serialisation and debugging
purposes.

I'm afraid I don't get the value of hash map in this context, the
performance aspect is trivial as this type of operation is done so
rarely per frame.

I have begun adding className and libraryName and a META_NodeVisitor
macro definition of these to all the core OSG node visitor, you are
welcome use this or ignore them.  I'm certainly not about to drop
existing API's to appease you preferences.

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