get/set Properties for Object, without known the Methods.
- Praetor
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
Yeah ^ is a reference-counted pointer. Just syntactic sugar on a built-in smart pointer implementation.
Implementations for delegates do exist. I have one in the odyssey library. Boost's signals and slots can give a very generic mechanism similar to delegates, and boost's function and bind libraries can be used as well (and of course there's even more available). In C++, you try to do things with libraries instead of language features if you can.
Implementations for delegates do exist. I have one in the odyssey library. Boost's signals and slots can give a very generic mechanism similar to delegates, and boost's function and bind libraries can be used as well (and of course there's even more available). In C++, you try to do things with libraries instead of language features if you can.
- Caius
- Halfling
- Posts: 52
- Joined: Fri Oct 06, 2006 9:00 pm
yep, I'll have a look on boost,
here is the article I've found on delegate, it looks really well though
here is the article I've found on delegate, it looks really well though
- Praetor
- OGRE Retired Team Member
- Posts: 3335
- Joined: Tue Jun 21, 2005 8:26 pm
- Location: Rochester, New York, US
- x 3
- Contact:
That's a popular one, because it really is fast. Very thorough description and good read if you want to dig deep down into the implementation details of some of C++'s language features. I prefer boost largely because it is more generic and is generally easier to use. The one complaint being its size, and given the incredible interconnectedness of it, it is sometimes difficult to untangle one library from another. The first time you bring boost in as a dependency can be painful, but once you get used to it and have it available it definitely repays you for your efforts.
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
yeah that's what the links I posted do! They have a utility to parse all the source and another to do simple reflection (presumably with the parsed info but I haven't tested it yet). It looks very neat and it's LGPLCaius wrote:A reflection system tool that would launch on prebuild event, look into the project directory, parse each .h file and add/update string-based class information
It's damn possible!
The difference between .Net and c++, is multiple inheritance capabilities, which means reflection information should be in a form of a hierarchic three nodes... it's duable !
If this does not exist, i'm gonna work on it
- Caius
- Halfling
- Posts: 52
- Joined: Fri Oct 06, 2006 9:00 pm
so the wheel has already been invented ehyeah that's what the links I posted do! They have a utility to parse all the source and another to do simple reflection (presumably with the parsed info but I haven't tested it yet). It looks very neat and it's LGPL
what the hell am I gonna do this week end now =)
ok i know, i'll be compiling boostThe first time you bring boost in as a dependency can be painful, but once you get used to it and have it available it definitely repays you for your efforts.
yeah I compiled it once long time ago, it was painful indeed, Jbam and all that mess yeah I remember =)
Is cross platform/compiler compatibility 100% guarantied? I guess it is
go back to the article, at the bottom:That's a popular one, because it really is fast. Very thorough description and good read if you want to dig deep down into the implementation details of some of C++'s language features. I prefer boost largely because it is more generic and is generally easier to use.
you might want to use FastDelegate now =)Natural syntax and Boost compatibility (new to 1.4)
Jody Hagins has enhanced the FastDelegateN classes to allow the same attractive syntax provided by recent versions of Boost.Function and Boost.Signal.
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
- Contact:
- FrameFever
- Platinum Sponsor
- Posts: 414
- Joined: Fri Apr 27, 2007 10:05 am
why are you compiling it by yourself?
http://www.boost-consulting.com/products/free
you can get it prebuild like OGRE
http://www.boost-consulting.com/products/free
you can get it prebuild like OGRE
- Project5
- Goblin
- Posts: 245
- Joined: Mon Nov 22, 2004 11:56 pm
- Location: New York, NY, USA
Two other approaches to consider are Luabind's and FUBI's, the former if you want manual control of what gets bound, and the latter if you'd rather walk the exports table for your platform than parse C++ code for the auto approach.
I'm using the former since it gives more control (and I can tag attributes), but having it done automatically must be nice when you're refactoring
--Ben
I'm using the former since it gives more control (and I can tag attributes), but having it done automatically must be nice when you're refactoring
--Ben
- Caius
- Halfling
- Posts: 52
- Joined: Fri Oct 06, 2006 9:00 pm
i'll give a shotget it actually working and post a demo using ogre
thanks for that link!why are you compiling it by yourself?
yeah you're right, a manual approach is better, especially for a game.Two other approaches to consider are Luabind's and FUBI's, the former if you want manual control of what gets bound, and the latter if you'd rather walk the exports table for your platform than parse C++ code for the auto approach.
I don't know if that reflex lib scans every classes of the project... What I was thinking to do, would have been manual selection of classes just by inheriting from an abstract class that would be called something like "reflectable", so the parser would look for those classes only also I was thinking, the public interface only is necessary to bind right?
The idea of reflection, is different to scripts engine's purpose, the idea is to be able to query the nature of an object, on the fly, used for example in an AI system, where an entity could query in a generic way what's around it. and act depending the environment.
- FrameFever
- Platinum Sponsor
- Posts: 414
- Joined: Fri Apr 27, 2007 10:05 am
damn, nobody is reading my post above, you don't need a parser and all this shit. metadata is nice, but makes you programm big, Like Stroustrup said.
you can do a nice property system without this shit.
think about, when you devloping an editor, with plugin functionality.
than these people need also the parser, and all these crap.
this is what you need, and nothing more
http://www.delta3d.org/article.php?stor ... =tutorials
you can do a nice property system without this shit.
think about, when you devloping an editor, with plugin functionality.
than these people need also the parser, and all these crap.
this is what you need, and nothing more
http://www.delta3d.org/article.php?stor ... =tutorials
- Caius
- Halfling
- Posts: 52
- Joined: Fri Oct 06, 2006 9:00 pm
It is a great pattern indeed, thanks for the link =)
As Stroustrup said, it does take a lot of memory.
but he said it thinking of the way microsoft does it (every classes of every assembly)
What I have in mind is actually like that tutorial, but with a tool that binds it for you, using hard coded constant strings, only for the classes you need, and only the public interface described.
It would be a way to transpose directly objects relationships of the code to the virtual world. it would have query functions that would allow to do things like "does this object "pizza" is a food?" you see what I mean?
and since that tutorial has a great pattern, it's a great starting point, thanks =)
As Stroustrup said, it does take a lot of memory.
but he said it thinking of the way microsoft does it (every classes of every assembly)
What I have in mind is actually like that tutorial, but with a tool that binds it for you, using hard coded constant strings, only for the classes you need, and only the public interface described.
It would be a way to transpose directly objects relationships of the code to the virtual world. it would have query functions that would allow to do things like "does this object "pizza" is a food?" you see what I mean?
and since that tutorial has a great pattern, it's a great starting point, thanks =)