Inside the static member function I need to get the type.
class MyClass { public: static void myStaticFunc(); ... };
And then in the implementation I want:
void MyClass::myStaticFunc() {
Is it possible? Normally I would use something from typeinfo for the object, but I don't have this .
I don't want to just use (MyClass*) , because it happens inside a macro, and I would like to keep it as simple as possible so that it can be called without a class name.
If this helps, I use QT, but I could not find any macros to get the current class. It does not have to be software - it can be a macro.
Hooray!
EDIT: Here is the actual macro function:
#define RPC_FUNCTION(funcName) \ static void rpc_##funcName(void* oOwner, RpcManager::RpcParamsContainer params){ ((__class__*)oOwner)->funcName(params); }; \ void funcName(RpcManager::RpcParamsContainer params);
Then I call RPC_FUNCTION(foo) in the class declaration. I want __class__ be any declaration of the class I was in. I am well aware that I can just add className after funcName, but I want it to be as simple as possible when using. My RPC manager calls rpc_foo and passes a pointer to the class object in which I declared it. Essentially, I need to know how to determine the actual class of this parameter void *.
source share