Skip to content

Commit

Permalink
Rename node_base to node
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikTH committed Oct 28, 2023
1 parent b117fb1 commit b0e78e2
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion include/ureact/adaptor/flatten.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <ureact/context.hpp>
#include <ureact/detail/adaptor.hpp>
#include <ureact/detail/node_base.hpp>
#include <ureact/detail/node.hpp>
#include <ureact/utility/type_traits.hpp>

UREACT_BEGIN_NAMESPACE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef UREACT_DETAIL_NODE_BASE_HPP
#define UREACT_DETAIL_NODE_BASE_HPP
#ifndef UREACT_DETAIL_NODE_HPP
#define UREACT_DETAIL_NODE_HPP

#include <memory>
#include <tuple>
Expand Down Expand Up @@ -40,12 +40,12 @@ Ret create_wrapped_node( Args&&... args )
return Ret{ create_node<Node>( std::forward<Args>( args )... ) };
}

class UREACT_API node_base : public reactive_node_interface
class UREACT_API node : public reactive_node_interface
{
public:
explicit node_base( context context );
explicit node( context context );

~node_base() override;
~node() override;

UREACT_WARN_UNUSED_RESULT node_id get_node_id() const
{
Expand Down Expand Up @@ -95,7 +95,7 @@ class UREACT_API node_base : public reactive_node_interface
friend class detach_functor;

private:
UREACT_MAKE_NONCOPYABLE( node_base );
UREACT_MAKE_NONCOPYABLE( node );

context m_context{};

Expand All @@ -109,7 +109,7 @@ class UREACT_API node_base : public reactive_node_interface
UREACT_END_NAMESPACE

#if UREACT_HEADER_ONLY
# include <ureact/detail/node_base.inl>
# include <ureact/detail/node.inl>
#endif

#endif // UREACT_DETAIL_NODE_BASE_HPP
#endif // UREACT_DETAIL_NODE_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,55 @@
// http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef UREACT_DETAIL_NODE_BASE_INL
#define UREACT_DETAIL_NODE_BASE_INL
#ifndef UREACT_DETAIL_NODE_INL
#define UREACT_DETAIL_NODE_INL

#include <cassert>

#include <ureact/detail/defines.hpp>
#include <ureact/detail/node_base.hpp>
#include <ureact/detail/node.hpp>

UREACT_BEGIN_NAMESPACE

namespace detail
{

UREACT_FUNC node_base::node_base( context context )
UREACT_FUNC node::node( context context )
: m_context( std::move( context ) )
{
assert( !get_graph().is_locked() && "Can't create node from callback" );
m_id = get_graph().register_node();
}

UREACT_FUNC node_base::~node_base()
UREACT_FUNC node::~node()
{
detach_from_all();
get_graph().unregister_node( m_id );
}

UREACT_FUNC react_graph& node_base::get_graph()
UREACT_FUNC react_graph& node::get_graph()
{
return get_internals( m_context ).get_graph();
}

UREACT_FUNC const react_graph& node_base::get_graph() const
UREACT_FUNC const react_graph& node::get_graph() const
{
return get_internals( m_context ).get_graph();
}

UREACT_FUNC void node_base::attach_to( node_id parentId )
UREACT_FUNC void node::attach_to( node_id parentId )
{
m_parents.add( parentId );
get_graph().attach_node( m_id, parentId );
}

UREACT_FUNC void node_base::detach_from( node_id parentId )
UREACT_FUNC void node::detach_from( node_id parentId )
{
get_graph().detach_node( m_id, parentId );
m_parents.remove( parentId );
}

UREACT_FUNC void node_base::detach_from_all()
UREACT_FUNC void node::detach_from_all()
{
for( node_id parentId : m_parents )
get_graph().detach_node( m_id, parentId );
Expand All @@ -66,4 +66,4 @@ UREACT_FUNC void node_base::detach_from_all()

UREACT_END_NAMESPACE

#endif //UREACT_DETAIL_NODE_BASE_INL
#endif //UREACT_DETAIL_NODE_INL
6 changes: 3 additions & 3 deletions include/ureact/detail/observer_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
#define UREACT_DETAIL_OBSERVER_NODE_HPP

#include <ureact/detail/graph_interface.hpp>
#include <ureact/detail/node_base.hpp>
#include <ureact/detail/node.hpp>

UREACT_BEGIN_NAMESPACE

namespace detail
{

class observer_node
: public node_base
: public node
, public observer_interface
{
public:
explicit observer_node( const context& context )
: node_base( context )
: node( context )
{}
};

Expand Down
6 changes: 3 additions & 3 deletions include/ureact/events.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <type_traits>

#include <ureact/context.hpp>
#include <ureact/detail/node_base.hpp>
#include <ureact/detail/node.hpp>
#include <ureact/utility/event_range.hpp> // event ranges often needed along with events.hpp header
#include <ureact/utility/unit.hpp>

Expand All @@ -24,13 +24,13 @@ namespace detail
{

template <typename E>
class event_stream_node : public node_base
class event_stream_node : public node
{
public:
using event_value_list = std::vector<E>;

explicit event_stream_node( const context& context )
: node_base( context )
: node( context )
{}

event_value_list& get_events()
Expand Down
2 changes: 1 addition & 1 deletion include/ureact/observer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include <utility>

#include <ureact/detail/node_base.hpp>
#include <ureact/detail/node.hpp>
#include <ureact/detail/observer_node.hpp>

UREACT_BEGIN_NAMESPACE
Expand Down
8 changes: 4 additions & 4 deletions include/ureact/signal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <ureact/context.hpp>
#include <ureact/detail/has_changed.hpp>
#include <ureact/detail/node_base.hpp>
#include <ureact/detail/node.hpp>
#include <ureact/utility/type_traits.hpp>

UREACT_BEGIN_NAMESPACE
Expand All @@ -23,16 +23,16 @@ namespace detail
{

template <typename S>
class signal_node : public node_base
class signal_node : public node
{
public:
explicit signal_node( const context& context )
: node_base( context )
: node( context )
{}

template <typename T>
signal_node( const context& context, T&& value )
: node_base( context )
: node( context )
, m_value( std::forward<T>( value ) )
{}

Expand Down
10 changes: 5 additions & 5 deletions tests/src/detail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#include <tuple>

#include "catch2_extra.hpp"
#include "ureact/detail/node_base.hpp"
#include "ureact/detail/node.hpp"
#include "ureact/detail/slot_map.hpp"

// non-copyable and non-movable
static_assert( !std::is_copy_constructible_v<ureact::detail::node_base> );
static_assert( !std::is_copy_assignable_v<ureact::detail::node_base> );
static_assert( !std::is_move_constructible_v<ureact::detail::node_base> );
static_assert( !std::is_move_assignable_v<ureact::detail::node_base> );
static_assert( !std::is_copy_constructible_v<ureact::detail::node> );
static_assert( !std::is_copy_assignable_v<ureact::detail::node> );
static_assert( !std::is_move_constructible_v<ureact::detail::node> );
static_assert( !std::is_move_assignable_v<ureact::detail::node> );

namespace
{
Expand Down

0 comments on commit b0e78e2

Please sign in to comment.