Skip to content

Commit

Permalink
rename cavl -> libcyphal::common::cavl #verification #sonar #docs
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed Dec 9, 2024
1 parent 5aba8c7 commit fe4f7c6
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 25 deletions.
2 changes: 1 addition & 1 deletion include/libcyphal/application/registry/register.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ enum class SetError : std::uint8_t

/// Defines interface for a register.
///
class IRegister : public cavl::Node<IRegister>
class IRegister : public common::cavl::Node<IRegister>
{
// 1AD1885B-954B-48CF-BAC4-FA0A251D3FC0
// clang-format off
Expand Down
4 changes: 2 additions & 2 deletions include/libcyphal/application/registry/registry_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ class Registry final : public IIntrospectableRegistry
[key = IRegister::Key{name}](const IRegister& other) { return other.compareBy(key); });
}

cetl::pmr::memory_resource& memory_;
cavl::Tree<IRegister> registers_tree_;
cetl::pmr::memory_resource& memory_;
common::cavl::Tree<IRegister> registers_tree_;

}; // Registry

Expand Down
8 changes: 7 additions & 1 deletion include/libcyphal/common/cavl/cavl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@

// NOLINTBEGIN(cppcoreguidelines-pro-bounds-constant-array-index)

namespace libcyphal
{
namespace common
{
namespace cavl
{
template <typename Derived>
Expand Down Expand Up @@ -788,7 +792,7 @@ class Tree final // NOSONAR cpp:S3624
{
public:
/// Helper alias of the compatible node type.
using NodeType = ::cavl::Node<Derived>;
using NodeType = Node<Derived>;
using DerivedType = Derived;

Tree() = default;
Expand Down Expand Up @@ -998,5 +1002,7 @@ class Tree final // NOSONAR cpp:S3624
};

} // namespace cavl
} // namespace common
} // namespace libcyphal

// NOLINTEND(cppcoreguidelines-pro-bounds-constant-array-index)
4 changes: 2 additions & 2 deletions include/libcyphal/platform/single_threaded_executor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SingleThreadedExecutor : public IExecutor
}

protected:
class CallbackNode : public cavl::Node<CallbackNode>, public Callback::Interface
class CallbackNode : public libcyphal::common::cavl::Node<CallbackNode>, public Callback::Interface
{
public:
CallbackNode(SingleThreadedExecutor& executor, Callback::Function&& function)
Expand Down Expand Up @@ -272,7 +272,7 @@ class SingleThreadedExecutor : public IExecutor
// MARK: - Data members:

/// Holds AVL tree of registered callback node, sorted by the next execution time.
cavl::Tree<CallbackNode> callback_nodes_;
common::cavl::Tree<CallbackNode> callback_nodes_;

}; // SingleThreadedExecutor

Expand Down
6 changes: 3 additions & 3 deletions include/libcyphal/presentation/client_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace presentation
namespace detail
{

class SharedClient : public cavl::Node<SharedClient>, public SharedObject
class SharedClient : public common::cavl::Node<SharedClient>, public SharedObject
{
public:
using Node::remove;
Expand Down Expand Up @@ -388,9 +388,9 @@ class SharedClient : public cavl::Node<SharedClient>, public SharedObject
const UniquePtr<transport::IRequestTxSession> svc_request_tx_session_;
const UniquePtr<transport::IResponseRxSession> svc_response_rx_session_;
const transport::ResponseRxParams response_rx_params_;
cavl::Tree<CallbackNode> cb_nodes_by_transfer_id_;
common::cavl::Tree<CallbackNode> cb_nodes_by_transfer_id_;
TimePoint nearest_deadline_;
cavl::Tree<TimeoutNode> timeout_nodes_by_deadline_;
common::cavl::Tree<TimeoutNode> timeout_nodes_by_deadline_;
IExecutor::Callback::Any nearest_deadline_callback_;

}; // SharedClient
Expand Down
16 changes: 8 additions & 8 deletions include/libcyphal/presentation/presentation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,14 +727,14 @@ class Presentation final : private detail::IPresentationDelegate

// MARK: Data members:

cetl::pmr::memory_resource& memory_;
IExecutor& executor_;
transport::ITransport& transport_;
cavl::Tree<detail::SharedClient> shared_client_nodes_;
cavl::Tree<detail::PublisherImpl> publisher_impl_nodes_;
cavl::Tree<detail::SubscriberImpl> subscriber_impl_nodes_;
detail::UnRefNode unreferenced_nodes_;
IExecutor::Callback::Any unref_nodes_deleter_callback_;
cetl::pmr::memory_resource& memory_;
IExecutor& executor_;
transport::ITransport& transport_;
common::cavl::Tree<detail::SharedClient> shared_client_nodes_;
common::cavl::Tree<detail::PublisherImpl> publisher_impl_nodes_;
common::cavl::Tree<detail::SubscriberImpl> subscriber_impl_nodes_;
detail::UnRefNode unreferenced_nodes_;
IExecutor::Callback::Any unref_nodes_deleter_callback_;

}; // Presentation

Expand Down
2 changes: 1 addition & 1 deletion include/libcyphal/presentation/publisher_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace presentation
namespace detail
{

class PublisherImpl final : public cavl::Node<PublisherImpl>, public SharedObject
class PublisherImpl final : public common::cavl::Node<PublisherImpl>, public SharedObject
{
public:
using Node::remove;
Expand Down
4 changes: 2 additions & 2 deletions include/libcyphal/presentation/subscriber_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace presentation
namespace detail
{

class SubscriberImpl final : public cavl::Node<SubscriberImpl>, public SharedObject
class SubscriberImpl final : public common::cavl::Node<SubscriberImpl>, public SharedObject
{
public:
using Node::remove;
Expand Down Expand Up @@ -304,7 +304,7 @@ class SubscriberImpl final : public cavl::Node<SubscriberImpl>, public SharedObj
ITimeProvider& time_provider_;
const UniquePtr<transport::IMessageRxSession> msg_rx_session_;
const transport::PortId subject_id_;
cavl::Tree<CallbackNode> callback_nodes_;
common::cavl::Tree<CallbackNode> callback_nodes_;
CallbackNode* next_cb_node_;

}; // SubscriberImpl
Expand Down
6 changes: 3 additions & 3 deletions include/libcyphal/transport/udp/session_tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class SessionTree final

// MARK: Data members:

cavl::Tree<Node> nodes_;
common::cavl::Tree<Node> nodes_;
libcyphal::detail::PmrAllocator<Node> allocator_;

}; // SessionTree
Expand All @@ -150,10 +150,10 @@ class SessionTree final
struct RxSessionTreeNode
{
template <typename Derived>
class Base : public cavl::Node<Derived>
class Base : public common::cavl::Node<Derived>
{
public:
using cavl::Node<Derived>::getChildNode;
using common::cavl::Node<Derived>::getChildNode;
using ReferenceWrapper = std::reference_wrapper<Derived>;

explicit Base(const PortId port_id)
Expand Down
6 changes: 4 additions & 2 deletions test/unittest/common/cavl/test_cavl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
# endif
#endif

using namespace libcyphal::common;

namespace
{
/// These aliases are introduced to keep things nicely aligned in test cases.
Expand All @@ -49,7 +51,7 @@ class My : public cavl::Node<My>
: value(v)
{
}
using Self = cavl::Node<My>;
using Self = Node;
using Self::isLinked;
using Self::isRoot;
using Self::getChildNode;
Expand Down Expand Up @@ -991,7 +993,7 @@ TEST(TestCavl, manualMy)
class V : public cavl::Node<V>
{
public:
using Self = cavl::Node<V>;
using Self = Node;
using Self::isLinked;
using Self::isRoot;
using Self::getChildNode;
Expand Down

0 comments on commit fe4f7c6

Please sign in to comment.