Web Wispers 1.2.2 C++ Unit Test Coverage |
|
|
|
|
Branch data Line data Source code
1 : : /*
2 : : * Copyright 2006-2009 Savarese Software Research Corporation
3 : : *
4 : : * Licensed under the Apache License, Version 2.0 (the "License");
5 : : * you may not use this file except in compliance with the License.
6 : : * You may obtain a copy of the License at
7 : : *
8 : : * https://www.savarese.com/software/ApacheLicense-2.0
9 : : *
10 : : * Unless required by applicable law or agreed to in writing, software
11 : : * distributed under the License is distributed on an "AS IS" BASIS,
12 : : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : : * See the License for the specific language governing permissions and
14 : : * limitations under the License.
15 : : */
16 : :
17 : : /**
18 : : * @file This header defines the ModuleContext class.
19 : : */
20 : :
21 : : #ifndef __SSRC_WSPR_WS_LUA_MODULE_CONTEXT_H
22 : : #define __SSRC_WSPR_WS_LUA_MODULE_CONTEXT_H
23 : :
24 : : #include <ssrc/wisp/protocol.h>
25 : : #include <ssrc/wispers/ws/protocol.h>
26 : : #include <ssrc/wispers/utility/ToString.h>
27 : :
28 : : __BEGIN_NS_SSRC_WSPR_WS_LUA
29 : :
30 : : using std::string;
31 : : using ssrc::wisp::protocol::MessageInfo;
32 : : using NS_SSRC_WSPR::sid_type;
33 : : using NS_SSRC_WSPR_WS::WebServiceCall;
34 : : using NS_SSRC_WSPR_UTILITY::ToString;
35 : :
36 : : // We place the import here to trick SWIG into recognizing nested class.
37 : : WISP_IMPORT(NS_SSRC_WSPR_WS::WebServiceProtocol, MessageResponse);
38 : :
39 [ + - + - ]: 1 : class ModuleContext {
40 : : const WebServiceCall *_call;
41 : : const MessageInfo *_msginfo;
42 : : MessageResponse *_response;
43 : : ToString _string_cast;
44 : : const string _empty_string;
45 : : const string _zero_string;
46 : :
47 : : public:
48 : :
49 : 1 : ModuleContext() :
50 : : _call(0), _msginfo(0), _response(0), _string_cast(),
51 [ + - + - ]: 1 : _empty_string(), _zero_string("0")
52 : 1 : { }
53 : :
54 : 1 : void start_call(const WebServiceCall *call,
55 : : const MessageInfo *msginfo,
56 : : MessageResponse *response)
57 : : {
58 : 1 : _call = call;
59 : 1 : _msginfo = msginfo;
60 : 1 : _response = response;
61 : 1 : }
62 : :
63 : 1 : void end_call() {
64 : 1 : _call = 0;
65 : 1 : _msginfo = 0;
66 : 1 : _response = 0;
67 : 1 : }
68 : :
69 : : void clear_session() {
70 : : if(_response->session)
71 : : _response->session.reset();
72 : : }
73 : :
74 : : // Macro namespace qualification for return type is for SWIG.
75 : : const NS_SSRC_WSPR_SESSION::session_ptr & session() {
76 : : return _response->session;
77 : : }
78 : :
79 : : // Macro namespace qualification for return type is for SWIG.
80 : : NS_SSRC_WSPR_WS_LUA::MessageResponse * response() {
81 : : return _response;
82 : : }
83 : :
84 : : string call_name() const { return _call->call; }
85 : :
86 : : string sender() const { return _msginfo->sender(); }
87 : : };
88 : :
89 : : __END_NS_SSRC_WSPR_WS_LUA
90 : :
91 : : #endif
|
Copyright © 2017 Savarese Software Research Corporation. All rights reserved