Skip to content

Commit

Permalink
#125 Move node_id_vector from graph_interface.hpp to a separate header
Browse files Browse the repository at this point in the history
It allow to leave it in detail namespace while all other graph_interface.hpp content will be moved into core namespace
  • Loading branch information
YarikTH committed Sep 4, 2023
1 parent 52f4a90 commit 9be46c3
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 28 deletions.
1 change: 1 addition & 0 deletions include/ureact/detail/graph_impl.inl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <ureact/detail/defines.hpp>
#include <ureact/detail/graph_impl.hpp>
#include <ureact/detail/graph_interface.hpp>
#include <ureact/detail/node_id_vector.hpp>
#include <ureact/detail/slot_map.hpp>

UREACT_BEGIN_NAMESPACE
Expand Down
24 changes: 0 additions & 24 deletions include/ureact/detail/graph_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define UREACT_DETAIL_GRAPH_INTERFACE_HPP

#include <cstddef>
#include <vector>

#include <ureact/detail/defines.hpp>

Expand Down Expand Up @@ -58,25 +57,6 @@ class node_id
value_type m_id = -1;
};

class node_id_vector
{
public:
using value_type = node_id;
using container_type = std::vector<value_type>;
using iterator = container_type::iterator;

void add( node_id id );
void remove( node_id id );
void clear();
UREACT_WARN_UNUSED_RESULT bool empty() const;

UREACT_WARN_UNUSED_RESULT iterator begin();
UREACT_WARN_UNUSED_RESULT iterator end();

private:
container_type m_data;
};

enum class update_result
{
unchanged,
Expand Down Expand Up @@ -106,8 +86,4 @@ struct observer_interface

UREACT_END_NAMESPACE

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

#endif //UREACT_DETAIL_GRAPH_INTERFACE_HPP
1 change: 1 addition & 0 deletions include/ureact/detail/node_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <ureact/context.hpp>
#include <ureact/detail/graph_impl.hpp>
#include <ureact/detail/graph_interface.hpp>
#include <ureact/detail/node_id_vector.hpp>

UREACT_BEGIN_NAMESPACE

Expand Down
50 changes: 50 additions & 0 deletions include/ureact/detail/node_id_vector.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// Copyright (C) 2014-2017 Sebastian Jeckel.
// Copyright (C) 2020-2023 Krylov Yaroslav.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

#ifndef UREACT_DETAIL_NODE_ID_VECTOR_HPP
#define UREACT_DETAIL_NODE_ID_VECTOR_HPP

#include <vector>

#include <ureact/detail/defines.hpp>
#include <ureact/detail/graph_interface.hpp>

UREACT_BEGIN_NAMESPACE

namespace detail
{

class node_id_vector
{
public:
using value_type = node_id;
using container_type = std::vector<value_type>;
using iterator = container_type::iterator;

void add( node_id id );
void remove( node_id id );
void clear();
UREACT_WARN_UNUSED_RESULT bool empty() const;

UREACT_WARN_UNUSED_RESULT iterator begin();
UREACT_WARN_UNUSED_RESULT iterator end();

private:
container_type m_data;
};

} // namespace detail

UREACT_END_NAMESPACE

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

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

#ifndef UREACT_DETAIL_GRAPH_INTERFACE_INL
#define UREACT_DETAIL_GRAPH_INTERFACE_INL
#ifndef UREACT_DETAIL_NODE_ID_VECTOR_INL
#define UREACT_DETAIL_NODE_ID_VECTOR_INL

#include <cassert>

#include <ureact/detail/algorithm.hpp>
#include <ureact/detail/defines.hpp>
#include <ureact/detail/graph_interface.hpp>
#include <ureact/detail/node_id_vector.hpp>

UREACT_BEGIN_NAMESPACE

Expand Down Expand Up @@ -66,4 +66,4 @@ UREACT_FUNC node_id_vector::iterator node_id_vector::end()

UREACT_END_NAMESPACE

#endif //UREACT_DETAIL_GRAPH_INTERFACE_INL
#endif //UREACT_DETAIL_NODE_ID_VECTOR_INL

0 comments on commit 9be46c3

Please sign in to comment.