Is there a way to easily implement a proxy class template in C ++? Do not use AspectC ++ or other heavy tools, just built-in macros or templates.
Explaining what I want:
class base_class { public: virtual void method_one() { ... } virtual void method_two() { ... } } class class_proxy : base_class { protected: void before_any_method_call() { do stuff }; void after_any_method_call(std::exception* ex) { do stuff } }
Here is the script. The class that I want the proxy (base_class) makes remote calls, however, when the network is disconnected, it will throw a transport exception, obtained from std :: exception. Base_class has tons of method, and I would like to catch a transport exception, answer with an empty result and reconnect until the next method call.
Ivan G.
source share