Skip to content

Commit edac01a

Browse files
committed
#125 Move graph_impl.hpp into a new folder <ureact/core/>
* move all graph_impl.hpp content into a new public interface ureact::core
1 parent 3832ee9 commit edac01a

File tree

6 files changed

+34
-25
lines changed

6 files changed

+34
-25
lines changed

include/ureact/context.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
#include <memory>
1414

15+
#include <ureact/core/graph_impl.hpp>
1516
#include <ureact/detail/defines.hpp>
16-
#include <ureact/detail/graph_impl.hpp>
1717

1818
UREACT_BEGIN_NAMESPACE
1919

@@ -23,13 +23,14 @@ namespace detail
2323
class UREACT_API context_internals
2424
{
2525
public:
26-
explicit context_internals( std::shared_ptr<react_graph> graph = make_react_graph() );
26+
explicit context_internals(
27+
std::shared_ptr<core::react_graph> graph = core::make_react_graph() );
2728

28-
UREACT_WARN_UNUSED_RESULT react_graph& get_graph();
29-
UREACT_WARN_UNUSED_RESULT const react_graph& get_graph() const;
29+
UREACT_WARN_UNUSED_RESULT core::react_graph& get_graph();
30+
UREACT_WARN_UNUSED_RESULT const core::react_graph& get_graph() const;
3031

3132
private:
32-
std::shared_ptr<react_graph> m_graph_ptr;
33+
std::shared_ptr<core::react_graph> m_graph_ptr;
3334
};
3435

3536
} // namespace detail
@@ -102,7 +103,7 @@ class UREACT_API context final : protected detail::context_internals
102103
/*!
103104
* @brief Construct @ref context from given react_graph
104105
*/
105-
explicit context( std::shared_ptr<detail::react_graph> graph );
106+
explicit context( std::shared_ptr<core::react_graph> graph );
106107
};
107108

108109
UREACT_END_NAMESPACE

include/ureact/detail/graph_impl.hpp renamed to include/ureact/core/graph_impl.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// http://www.boost.org/LICENSE_1_0.txt)
88
//
99

10-
#ifndef UREACT_DETAIL_GRAPH_IMPL_HPP
11-
#define UREACT_DETAIL_GRAPH_IMPL_HPP
10+
#ifndef UREACT_CORE_GRAPH_IMPL_HPP
11+
#define UREACT_CORE_GRAPH_IMPL_HPP
1212

1313
#include <memory>
1414

@@ -17,7 +17,7 @@
1717

1818
UREACT_BEGIN_NAMESPACE
1919

20-
namespace detail
20+
namespace core
2121
{
2222

2323
#if !defined( NDEBUG )
@@ -88,12 +88,12 @@ struct react_graph
8888

8989
UREACT_API std::shared_ptr<react_graph> make_react_graph();
9090

91-
} // namespace detail
91+
} // namespace core
9292

9393
UREACT_END_NAMESPACE
9494

9595
#if UREACT_HEADER_ONLY
9696
# include <ureact/detail/graph_impl.inl>
9797
#endif
9898

99-
#endif // UREACT_DETAIL_GRAPH_IMPL_HPP
99+
#endif // UREACT_CORE_GRAPH_IMPL_HPP

include/ureact/detail/context.inl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@
1313
#include <memory>
1414

1515
#include <ureact/context.hpp>
16+
#include <ureact/core/graph_impl.hpp>
1617
#include <ureact/detail/defines.hpp>
17-
#include <ureact/detail/graph_impl.hpp>
1818

1919
UREACT_BEGIN_NAMESPACE
2020

2121
namespace detail
2222
{
2323

24-
UREACT_FUNC context_internals::context_internals( std::shared_ptr<react_graph> graph )
24+
UREACT_FUNC context_internals::context_internals( std::shared_ptr<core::react_graph> graph )
2525
: m_graph_ptr( std::move( graph ) )
2626
{}
2727

28-
UREACT_FUNC react_graph& context_internals::get_graph()
28+
UREACT_FUNC core::react_graph& context_internals::get_graph()
2929
{
3030
return *m_graph_ptr;
3131
}
3232

33-
UREACT_FUNC const react_graph& context_internals::get_graph() const
33+
UREACT_FUNC const core::react_graph& context_internals::get_graph() const
3434
{
3535
return *m_graph_ptr;
3636
}
3737

3838
} // namespace detail
3939

40-
UREACT_FUNC context::context( std::shared_ptr<detail::react_graph> graph )
40+
UREACT_FUNC context::context( std::shared_ptr<core::react_graph> graph )
4141
: detail::context_internals( std::move( graph ) )
4242
{}
4343

@@ -46,13 +46,13 @@ namespace default_context
4646

4747
UREACT_FUNC context get()
4848
{
49-
thread_local static std::weak_ptr<detail::react_graph> s_instance;
49+
thread_local static std::weak_ptr<core::react_graph> s_instance;
5050

5151
auto graphPtr = s_instance.lock();
5252

5353
if( !graphPtr )
5454
{
55-
s_instance = graphPtr = detail::make_react_graph();
55+
s_instance = graphPtr = core::make_react_graph();
5656
}
5757

5858
return context{ std::move( graphPtr ) };

include/ureact/detail/graph_impl.inl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#include <memory>
1616
#include <vector>
1717

18+
#include <ureact/core/graph_impl.hpp>
19+
#include <ureact/core/graph_interface.hpp>
1820
#include <ureact/detail/algorithm.hpp>
1921
#include <ureact/detail/defines.hpp>
20-
#include <ureact/detail/graph_impl.hpp>
21-
#include <ureact/core/graph_interface.hpp>
2222
#include <ureact/detail/node_id_vector.hpp>
2323
#include <ureact/detail/slot_map.hpp>
2424

@@ -27,7 +27,7 @@ UREACT_BEGIN_NAMESPACE
2727
namespace detail
2828
{
2929

30-
class react_graph_impl : public react_graph
30+
class react_graph_impl : public core::react_graph
3131
{
3232
#if !defined( NDEBUG )
3333
bool m_is_locked = false;
@@ -50,6 +50,9 @@ class react_graph_impl : public react_graph
5050
}
5151
#endif
5252
public:
53+
using node_id = core::node_id;
54+
using reactive_node_interface = core::reactive_node_interface;
55+
5356
react_graph_impl() = default;
5457
~react_graph_impl() override;
5558

@@ -389,12 +392,17 @@ UREACT_FUNC bool react_graph_impl::topological_queue::fetch_next()
389392
return !m_next_data.empty();
390393
}
391394

395+
} // namespace detail
396+
397+
namespace core
398+
{
399+
392400
UREACT_FUNC std::shared_ptr<react_graph> make_react_graph()
393401
{
394-
return std::make_shared<react_graph_impl>();
402+
return std::make_shared<detail::react_graph_impl>();
395403
}
396404

397-
} // namespace detail
405+
} // namespace core
398406

399407
UREACT_END_NAMESPACE
400408

include/ureact/detail/node_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <utility>
1616

1717
#include <ureact/context.hpp>
18+
#include <ureact/core/graph_impl.hpp>
1819
#include <ureact/core/graph_interface.hpp>
19-
#include <ureact/detail/graph_impl.hpp>
2020
#include <ureact/detail/node_id_vector.hpp>
2121

2222
UREACT_BEGIN_NAMESPACE

include/ureact/detail/transaction.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include <cassert>
1414

1515
#include <ureact/context.hpp>
16+
#include <ureact/core/graph_impl.hpp>
1617
#include <ureact/detail/defines.hpp>
17-
#include <ureact/detail/graph_impl.hpp>
1818
#include <ureact/transaction.hpp>
1919

2020
UREACT_BEGIN_NAMESPACE

0 commit comments

Comments
 (0)