Ultimately there's no real way for Python to create new C++ types, which is essentially what you're asking. If you want to be able to create new event types in Python which are on equal footing with what you can create in C++, then you'll need a more dynamic, Python-like structure in C++.
If your requirement really is that this works only in C++ and Python (i.e. you don't intend to extend this to other languages) then you might consider storing your event parameters in a boost::python::dict
instead of as individual data members. You'll need to use boost::python::extract<>
in C++ to access the values, but otherwise it's a pretty clean system. (And you can probably hide the extract call inside a templated accessor method.)
Another option is to access event parameters with a getter, e.g. Event::get_param<T>("name")
. If you make this virtual then Python-based implementation of events can provide their own version.