Hi Chris,

Chris 'Xenon' Hanson schrieb:
Peter Hrenka wrote:
Has anybody had a look at Qt's QFlags?
http://doc.trolltech.com/4.5/qflags.html

They provide a type-safe way of dealing with bit-mask-style enums.
The implementation is mostly a template class with overloaded
operators. Once you have the idea, it should be rather trivial
to reimplement this from scratch and tailor it OSG's requirements.

  I'm not familiar with it, but I agree that perhaps a flags class/template 
would be a
smart way to clean up the situation. If it would solve the issues.

  I know I'm always happier using a provided set/test API than manually masking 
stuff. As
long as it doesn't bloat the data size beyond the simple storage of the flag 
word. as long
as we don't make any of it virtual, I think it would be ok. Though I don't know 
how RTTI
adds to the class per-instance weight of a real class (as opposed to a built-in 
type like
unsigned long int). Any C++ guru care to comment on that?

Nothing needs to be virtual here. It's just a template class
with overloaded operators which means everything is effectively
inlined. We could also use an "unsigned int" as internal storage type
(Qt seems to use a signed int).


Cheers,

Peter



--
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

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

Reply via email to