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
19 : : * This header defines types shared throughout the system.
20 : : */
21 : :
22 : : #ifndef __SSRC_WSPR_TYPES_H
23 : : #define __SSRC_WSPR_TYPES_H
24 : :
25 : : #include <ssrc/wispers-packages.h>
26 : : #include <ssrc/wisp/utility/TimeValue.h>
27 : :
28 : : #include <string>
29 : :
30 : : __BEGIN_NS_SSRC_WSPR
31 : :
32 : : using NS_SSRC_WISP_UTILITY::TimeValue;
33 : : using NS_SSRC_WISP_UTILITY::InfiniteTimeValue;
34 : : using std::string;
35 : :
36 : : /** Session identifier. */
37 : : typedef string sid_type;
38 : : enum SessionIdLimits { SessionIdNumBytes = 16, SessionIdNumChars = 32 };
39 : :
40 : : /** User identifier. */
41 : : typedef std::uint64_t uid_type;
42 : :
43 : : /** Group identifier. */
44 : : typedef std::uint64_t gid_type;
45 : :
46 : : /** Group session identifier. */
47 : : typedef std::int64_t gsid_type;
48 : :
49 : : /** Seconds. */
50 : : typedef TimeValue::sec_type sec_type;
51 : :
52 : : // These should probably be std::int64_t.
53 : : typedef unsigned int db_limit_type;
54 : : typedef unsigned int db_offset_type;
55 : :
56 : : /** Database row identifier. */
57 : : typedef std::uint64_t row_id_type;
58 : :
59 : : // Conventions for representing most row identifiers..
60 : : const row_id_type NullRowId = boost::integer_traits<row_id_type>::const_min;
61 : : const row_id_type MinRowId = NullRowId + 1;
62 : : // We lose half of the 64-bit space because sqlite deals in signed integers.
63 : : // We used to use a signed row_id_type, but that presented its own
64 : : // complications.
65 : : //const row_id_type MaxRowId = boost::integer_traits<row_id_type>::const_max;
66 : : const row_id_type MaxRowId = boost::integer_traits<std::int64_t>::const_max;
67 : :
68 : : template<typename value_type>
69 : 2 : inline value_type null_row_id() {
70 : 2 : return boost::integer_traits<value_type>::const_min;
71 : : }
72 : :
73 : : template<typename value_type>
74 : 1 : inline value_type min_row_id() {
75 : 1 : return null_row_id<value_type>() + 1;
76 : : }
77 : :
78 : : /**
79 : : * uuid key. We use a composite key of two 64-bit integers to store
80 : : * a UUID in a database.
81 : : */
82 : : struct uuid_key_type {
83 : : std::int64_t high_bits;
84 : : std::int64_t low_bits;
85 : : };
86 : :
87 : : __END_NS_SSRC_WSPR
88 : :
89 : : #endif
|
Copyright © 2017 Savarese Software Research Corporation. All rights reserved