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
19 : : * This header defines the SessionData class.
20 : : */
21 : :
22 : : #ifndef __SSRC_WSPR_SESSION_DATA_H
23 : : #define __SSRC_WSPR_SESSION_DATA_H
24 : :
25 : : #include <ssrc/wispers/types.h>
26 : : #include <ssrc/wispers/utility/Properties.h>
27 : :
28 : : __BEGIN_NS_SSRC_WSPR_SESSION
29 : :
30 : : using std::string;
31 : : using NS_SSRC_WSPR_UTILITY::Properties;
32 : :
33 : : typedef unsigned int idle_count_type;
34 : :
35 [ # # # # : 48 : struct SessionData {
# # # + -
+ - + - +
- # ]
36 : : sid_type sid;
37 : : sid_type xsrf_token;
38 : : uid_type uid;
39 : : idle_count_type idle_count;
40 : : boost::shared_ptr<Properties> attributes;
41 : :
42 : 12 : SessionData() :
43 [ + - + - ]: 12 : sid(), xsrf_token(), uid(), idle_count(), attributes()
44 : 12 : { }
45 : :
46 : : #if !defined(SWIG)
47 : : explicit
48 : 7 : SessionData(const sid_type & sid,
49 : : const sid_type & xsrf_token,
50 : : const idle_count_type idle_count = 0,
51 : : const uid_type uid = 0,
52 : : Properties && attributes = Properties()) :
53 : : sid(sid), xsrf_token(xsrf_token), uid(uid), idle_count(idle_count),
54 [ + - + - : 7 : attributes(new Properties(std::move(attributes)))
+ - + - +
- ]
55 : 7 : { }
56 : : #endif
57 : :
58 : : string login() { return attributes->get<string>("", "login"); }
59 : :
60 : : template<class Archive>
61 : 26 : void serialize(Archive & ar, const unsigned int) {
62 : 26 : ar & sid & xsrf_token & uid & idle_count & attributes;
63 : 26 : }
64 : :
65 : : };
66 : :
67 : : typedef boost::shared_ptr<SessionData> session_ptr;
68 : :
69 : : __END_NS_SSRC_WSPR_SESSION
70 : :
71 : : #if !defined(SWIG)
72 : : BOOST_CLASS_TRACKING(NS_SSRC_WSPR_SESSION::SessionData, boost::serialization::track_never)
73 : : #endif
74 : :
75 : : #endif
|