简体   繁体   English

接口的自动代理类

[英]Auto proxy class for interfaces

I have few interfaces IFace1 , IFace2 , etc. The interfaces have different set of methods, all the methods have different return and input params types. 我只有几个接口IFace1IFace2等。这些接口具有不同的方法集,所有方法都具有不同的返回和输入参数类型。

I'd like to have a proxy class like 我想要一个像

template<typename IFace>
class TheProxyClass : public<IFace>
{
/*...................*/
private:
  IFace * iface;
}

I need the class to have IFace methods, making them transit calling via iface attribute. 我需要该类具有IFace方法,以使其通过iface属性进行IFace调用。 A kind of automatic generation IFace methods, doing only calling corresponding ones via iface . 一种自动生成的IFace方法,仅通过iface调用相应的方法。

Is there way i can do it? 有办法吗? No C++11, boost is allowed. 没有C ++ 11,允许升压。

Here - http://yadi.sk/d/dyOfa8yo2SbRf - is a Python script of mine, that generates impementation for given interface. 这里- http://yadi.sk/d/dyOfa8yo2SbRf -是我的Python脚本,产生了给定接口impementation。 Now method bodies are empty, but I think it's not so hard to modify them to insert something like that 现在方法主体为空,但我认为修改它们以插入类似内容并不难

"iface->" + funcName

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM