00001
00010 #ifndef BS_WELLS_WELL_RATE_CONTROL_CALL_PROXY_H_
00011 #define BS_WELLS_WELL_RATE_CONTROL_CALL_PROXY_H_
00012
00013 namespace blue_sky
00014 {
00015
00016 template <typename wrapped_t, typename callee_t>
00017 struct one_call_proxy
00018 {
00019 one_call_proxy (wrapped_t *wrapped, callee_t callee)
00020 : wrapped_ (wrapped)
00021 , callee_ (callee)
00022 {
00023 }
00024
00025 template <typename locked_connection_t, typename data_t, typename params_t>
00026 void
00027 operator () (const locked_connection_t &c, const data_t &data, params_t ¶ms) const
00028 {
00029 ((*wrapped_).*callee_) (c, data, params);
00030 }
00031 template <typename locked_connection_t, typename data_t>
00032 void
00033 operator () (const locked_connection_t &c, const data_t &data) const
00034 {
00035 ((*wrapped_).*callee_) (c, data);
00036 }
00037 template <typename locked_connection_t, typename params_t>
00038 void
00039 operator () (const locked_connection_t &c, params_t ¶ms) const
00040 {
00041 ((*wrapped_).*callee_) (c, params);
00042 }
00043
00044 wrapped_t *wrapped_;
00045 callee_t callee_;
00046 };
00047
00048 template <typename wrapped_t, typename callee_t>
00049 struct two_call_proxy
00050 {
00051 two_call_proxy (wrapped_t *wrapped, callee_t first_callee, callee_t second_callee)
00052 : wrapped_ (wrapped)
00053 , first_callee_ (first_callee)
00054 , second_callee_ (second_callee)
00055 {
00056 }
00057
00058 template <typename locked_connection_t, typename data_t, typename params_t>
00059 void
00060 operator () (const locked_connection_t &c, const data_t &data, params_t ¶ms) const
00061 {
00062 ((*wrapped_).*first_callee_) (c, data, params);
00063 ((*wrapped_).*second_callee_) (c, data, params);
00064 }
00065
00066 wrapped_t *wrapped_;
00067 callee_t first_callee_;
00068 callee_t second_callee_;
00069 };
00070
00071 template <typename this_t, typename callee_t>
00072 static one_call_proxy <this_t, callee_t>
00073 one_call (this_t *this_, callee_t callee)
00074 {
00075 return one_call_proxy <this_t, callee_t> (this_, callee);
00076 }
00077 template <typename this_t, typename callee_t>
00078 static two_call_proxy <this_t, callee_t>
00079 two_call (this_t *this_, callee_t first_callee, callee_t second_callee)
00080 {
00081 return two_call_proxy <this_t, callee_t> (this_, first_callee, second_callee);
00082 }
00083
00084 }
00085
00086 #endif // #ifndef BS_WELL_WELL_RATE_CONTROL_CALL_PROXY_H_
00087