Skip to content

Commit f4f8269

Browse files
committed
Create separate header for namespace level typedefs.
1 parent 787c66e commit f4f8269

File tree

7 files changed

+72
-30
lines changed

7 files changed

+72
-30
lines changed

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ include_bitcoin_database_HEADERS = \
144144
include/bitcoin/database/query.hpp \
145145
include/bitcoin/database/settings.hpp \
146146
include/bitcoin/database/store.hpp \
147+
include/bitcoin/database/types.hpp \
147148
include/bitcoin/database/version.hpp
148149

149150
include_bitcoin_database_filedir = ${includedir}/bitcoin/database/file

builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\states.hpp" />
198198
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\table.hpp" />
199199
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\tables.hpp" />
200+
<ClInclude Include="..\..\..\..\include\bitcoin\database\types.hpp" />
200201
<ClInclude Include="..\..\..\..\include\bitcoin\database\version.hpp" />
201202
<ClInclude Include="..\..\..\..\src\memory\mman-win32\mman.hpp" />
202203
</ItemGroup>

builds/msvc/vs2022/libbitcoin-database/libbitcoin-database.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@
290290
<ClInclude Include="..\..\..\..\include\bitcoin\database\tables\tables.hpp">
291291
<Filter>include\bitcoin\database\tables</Filter>
292292
</ClInclude>
293+
<ClInclude Include="..\..\..\..\include\bitcoin\database\types.hpp">
294+
<Filter>include\bitcoin\database</Filter>
295+
</ClInclude>
293296
<ClInclude Include="..\..\..\..\include\bitcoin\database\version.hpp">
294297
<Filter>include\bitcoin\database</Filter>
295298
</ClInclude>

include/bitcoin/database.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <bitcoin/database/query.hpp>
2222
#include <bitcoin/database/settings.hpp>
2323
#include <bitcoin/database/store.hpp>
24+
#include <bitcoin/database/types.hpp>
2425
#include <bitcoin/database/version.hpp>
2526
#include <bitcoin/database/file/file.hpp>
2627
#include <bitcoin/database/file/rotator.hpp>

include/bitcoin/database/impl/query/objects.ipp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ typename CLASS::output::cptr CLASS::get_output(
305305
}
306306

307307
TEMPLATE
308-
typename CLASS::outpoint CLASS::get_spent(
309-
const output_link& link) const NOEXCEPT
308+
typename outpoint CLASS::get_spent(const output_link& link) const NOEXCEPT
310309
{
311310
table::output::get_parent_value out{};
312311
if (!store_.output.get(link, out))
@@ -320,7 +319,8 @@ typename CLASS::outpoint CLASS::get_spent(
320319
}
321320

322321
TEMPLATE
323-
typename CLASS::point CLASS::get_spender(const point_link& link) const NOEXCEPT
322+
typename CLASS::point CLASS::get_spender(
323+
const point_link& link) const NOEXCEPT
324324
{
325325
const auto tx = to_spending_tx(link);
326326
if (tx.is_terminal())

include/bitcoin/database/query.hpp

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,11 @@
2424
#include <utility>
2525
#include <bitcoin/system.hpp>
2626
#include <bitcoin/database/define.hpp>
27-
#include <bitcoin/database/error.hpp>
28-
#include <bitcoin/database/primitives/primitives.hpp>
29-
#include <bitcoin/database/tables/tables.hpp>
27+
#include <bitcoin/database/types.hpp>
3028

3129
namespace libbitcoin {
3230
namespace database {
3331

34-
/// Database type aliases.
35-
using height_link = table::height::link;
36-
using header_link = table::header::link;
37-
using output_link = table::output::link;
38-
using input_link = table::input::link;
39-
using outs_link = table::outs::link;
40-
using ins_link = table::ins::link;
41-
using point_link = table::point::link;
42-
using tx_link = table::transaction::link;
43-
using filter_link = table::filter_tx::link;
44-
using strong_link = table::strong_tx::link;
45-
46-
using header_links = std::vector<header_link::integer>;
47-
using tx_links = std::vector<tx_link::integer>;
48-
using input_links = std::vector<input_link::integer>;
49-
using output_links = std::vector<output_link::integer>;
50-
using point_links = std::vector<point_link::integer>;
51-
using two_counts = std::pair<size_t, size_t>;
52-
using point_key = table::point::key;
53-
54-
struct header_state{ header_link link; code ec; };
55-
using header_states = std::vector<header_state>;
56-
5732
// Writers (non-const) are only: push_, pop_, set_ and initialize.
5833
template <typename Store>
5934
class query
@@ -66,7 +41,6 @@ class query
6641
using point = system::chain::point;
6742
using input = system::chain::input;
6843
using output = system::chain::output;
69-
using outpoint = system::chain::outpoint;
7044
using header = system::chain::header;
7145
using script = system::chain::script;
7246
using witness = system::chain::witness;

include/bitcoin/database/types.hpp

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
3+
*
4+
* This file is part of libbitcoin.
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
#ifndef LIBBITCOIN_DATABASE_TYPES_HPP
20+
#define LIBBITCOIN_DATABASE_TYPES_HPP
21+
22+
#include <set>
23+
#include <utility>
24+
#include <bitcoin/database/define.hpp>
25+
#include <bitcoin/database/tables/tables.hpp>
26+
27+
namespace libbitcoin {
28+
namespace database {
29+
30+
/// Database type aliases.
31+
using height_link = table::height::link;
32+
using header_link = table::header::link;
33+
using output_link = table::output::link;
34+
using input_link = table::input::link;
35+
using outs_link = table::outs::link;
36+
using ins_link = table::ins::link;
37+
using point_link = table::point::link;
38+
using tx_link = table::transaction::link;
39+
using filter_link = table::filter_tx::link;
40+
using strong_link = table::strong_tx::link;
41+
42+
using header_links = std::vector<header_link::integer>;
43+
using tx_links = std::vector<tx_link::integer>;
44+
using input_links = std::vector<input_link::integer>;
45+
using output_links = std::vector<output_link::integer>;
46+
using point_links = std::vector<point_link::integer>;
47+
using two_counts = std::pair<size_t, size_t>;
48+
using point_key = table::point::key;
49+
50+
struct header_state{ header_link link; code ec; };
51+
using header_states = std::vector<header_state>;
52+
53+
// TODO: define a system::chain::inpoint with added state.
54+
using inpoint = system::chain::point;
55+
using inpoints = std::set<inpoint>;
56+
using outpoint = system::chain::outpoint;
57+
using outpoints = std::set<outpoint>;
58+
59+
} // namespace database
60+
} // namespace libbitcoin
61+
62+
#endif

0 commit comments

Comments
 (0)