Savarese Software Research Corporation
call_util.h
Go to the documentation of this file.
00001 /* Copyright 2011 Savarese Software Research Corporation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     https://www.savarese.com/software/ApacheLicense-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00022 #ifndef __SSRC_WSPR_WS_CALL_UTIL_H
00023 #define __SSRC_WSPR_WS_CALL_UTIL_H
00024 
00025 #include <ssrc/wispers/ws/protocol.h>
00026 #include <ssrc/wispers/utility/emplace.h>
00027 
00028 __BEGIN_NS_SSRC_WSPR_WS
00029 
00030 typedef NS_SSRC_WSPR_FCGI::parameter_map::value_type Parameter;
00031 
00032 inline Properties *
00033 get_event(const properties_ptr & template_data, const unsigned int i = 0) {
00034   property_vector *events =
00035     template_data->get_ptr<property_vector>("wspr", "event");
00036   return (events != 0 && events->size() > i ? &(*events)[i] : 0);
00037 }
00038 
00039 inline WebServiceProtocol::CallTwoWay::return_type
00040 call_two_way(WebServiceProtocol::caller_type & call, const string & dest,
00041              const string & ws_call, const session_ptr & session,
00042              NS_SSRC_WSPR_FCGI::parameter_map && parameters)
00043 {
00044   WebServiceProtocol::CallTwoWay::parameter_type msg(ws_call, parameters, session);
00045   WebServiceProtocol::CallTwoWay::return_type reply;
00046   call.call<WebServiceProtocol::CallTwoWay>(dest, &reply, msg);
00047   return reply;
00048 }
00049 
00050 template<typename... P>
00051 inline WebServiceProtocol::CallTwoWay::return_type
00052 call_two_way(WebServiceProtocol::caller_type & call, const string & dest,
00053              const string & ws_call, const session_ptr & session, P && ...p)
00054 {
00055   NS_SSRC_WSPR_FCGI::parameter_map parameters;
00056   NS_SSRC_WSPR_UTILITY::emplace(parameters, std::forward<P>(p)...);
00057   return call_two_way(call, dest, ws_call, session, std::move(parameters));
00058 }
00059 
00060 __END_NS_SSRC_WSPR_WS
00061 
00062 #endif

Savarese Software Research Corporation
Copyright © 2006-2011 Savarese Software Research Corporation. All rights reserved.