New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic usage questions #12
Comments
Hi there, we are all learning, all the time, so don't worry about that. I took on this project as a learning exercise in how to use new advanced C++11 features (and the web site is Jekyll and Bootstrap, another learning exercise!). And to that end it is still a work in progress. I have other projects on the go so will try and keep up to date with this one as well. The original project was not my work, this is a fork, so please forgive any misinformation I pass on. Answers to questions:
I mainly use static linking, as I'm a game developer, and some platforms (e.g. iOS) only allow static linking of libraries. Here, it is not such a problem, but when using DLLs you need to think about dependencies. If you have a "core" DLL, which everything else depends on, this would be the place to put Ponder. The binding could then be done anywhere as the objects created are stored in Ponder. Because of the DLLs you need to pay attention to deletion. I.e. Ponder has to delete anything it created, e.g. const ponder::Class& metaclass = ponder::classByName("Person");
ponder::UserObject john = metaclass.construct(ponder::Args("John"));
metaclass.destroy(john); // *** Ponder destroys the object it created
Ponder has automatic registration so you should be able to do this already. Look at the unit tests for examples.
Have a look at
Could you not create a composite object
Not so little, but perhaps should be allowed. Perhaps "policies" could be introduced for error handling. You might pass one in so that your app can deal with errors however it chooses? |
Might I ask why you want errors handled as asserts? |
Thank you for your detailed answer. This is really helpful and now I feel I am able to do at least 80% of the things that I think I need to do.
Perfect, in the unit tests I see the macro
It works if I first construct the metaclass with
Sorry, I don't know how I missed this. It works absolutely perfectly and does exactly what I wanted!
Sorry, my explanation wasn't very clear. Actually I meant that these are a sort of meta-data about the properties, the same as "writeable" etc. (but at a different level). My plan is to use Ponder as a kind of data mapping layer where I have database tables like By using Ponder binding, I am able to have some generic functions for reading tables and converting them into vectors of 'intermediate class' objects. Most of the time these are then processed into other objects, but occasionally I would like to be able to throw up a quick dialog or list of the 'raw' intermediate objects. It would be great if I can set meta data for a property that gives guidance on how to display that property (Ponder already has its name and type I can use for this purpose). I thought it might be possible with tags, but these can only be attached to the metaclass and not to the properties. I can work around by having a static list that shadows the Ponder binding, but something like the following would be great:
Thanks again, this really is a great library :) |
After learning more, I now realise that exactly this is possible. IIUC
Fantastic!! |
Looks like there is nothing to do for this. |
Yes, sorry I should have closed it. Basically, Ponder does everything I want it to do! |
Hi, I would like to use Ponder to replace my home grown reflection that is currently implemented using nested macros and which suffers from all the debugging problems you mention in your blog :)
I need to warn you that I am relatively inexperienced in C++, so there may be some basic concepts I am missing.
ponder::Class::declare<Person>("Person")...
) ? I was wondering if I could create a composite container that holds my class and the binding within a static "Init" method. Thus, the binding will occur at startup and be already available whenever I instantiate the superclass.Person
asEmployee
andCustomer
, do I have to rebind&Employee::name, &Employee::age, &Employee::speak, &Customer::name, &Customer::age, &Customer::speak
etc. I tried to see if this possible without binding subclasses, but get aproperty age not found
exception. With my macros I am using a lambda to extend the static bind map of the base class.property("name", &Person::name, visible, 200)
. I think this should be possible by subclassingponder::UserProperty
but would really appreciate if you could give me an example.Lastly, just one little request ... can we have asserts instead of exceptions please ?!!!
Thanks for a great library, with a great licence 👍
The text was updated successfully, but these errors were encountered: