-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Breaking out the base class (and make one, where non exists) into a s…
…eparate header file breaks the circular dependency.
- Loading branch information
Showing
10 changed files
with
188 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* This software is distributed under the terms of the MIT License. | ||
* Copyright (c) 2020-2023 LXRobotics. | ||
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com> | ||
* Contributors: https://github.com/107-systems/107-Arduino-Cyphal/graphs/contributors. | ||
*/ | ||
|
||
#ifndef INC_107_ARDUINO_CYPHAL_PUBLISHER_BASE_H | ||
#define INC_107_ARDUINO_CYPHAL_PUBLISHER_BASE_H | ||
|
||
/************************************************************************************** | ||
* INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include "Node.hpp" | ||
|
||
/************************************************************************************** | ||
* NAMESPACE | ||
**************************************************************************************/ | ||
|
||
namespace impl | ||
{ | ||
|
||
/************************************************************************************** | ||
* CLASS DECLARATION | ||
**************************************************************************************/ | ||
|
||
template <typename T> | ||
class PublisherBase | ||
{ | ||
public: | ||
PublisherBase() { } | ||
virtual ~PublisherBase() { } | ||
PublisherBase(PublisherBase const &) = delete; | ||
PublisherBase(PublisherBase &&) = delete; | ||
PublisherBase &operator=(PublisherBase const &) = delete; | ||
PublisherBase &operator=(PublisherBase &&) = delete; | ||
|
||
virtual bool publish(T const & msg) = 0; | ||
}; | ||
|
||
/************************************************************************************** | ||
* NAMESPACE | ||
**************************************************************************************/ | ||
|
||
} /* impl */ | ||
|
||
/************************************************************************************** | ||
* TYPEDEF | ||
**************************************************************************************/ | ||
|
||
template <typename T> | ||
using Publisher = std::shared_ptr<impl::PublisherBase<T>>; | ||
|
||
#endif /* INC_107_ARDUINO_CYPHAL_PUBLISHER_BASE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* This software is distributed under the terms of the MIT License. | ||
* Copyright (c) 2020-2023 LXRobotics. | ||
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com> | ||
* Contributors: https://github.com/107-systems/107-Arduino-Cyphal/graphs/contributors. | ||
*/ | ||
|
||
#ifndef INC_107_ARDUINO_CYPHAL_SERVICE_CLIENT_BASE_HPP | ||
#define INC_107_ARDUINO_CYPHAL_SERVICE_CLIENT_BASE_HPP | ||
|
||
/************************************************************************************** | ||
* INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include <memory> | ||
|
||
#include "SubscriptionBase.h" | ||
|
||
/************************************************************************************** | ||
* NAMESPACE | ||
**************************************************************************************/ | ||
|
||
namespace impl | ||
{ | ||
|
||
/************************************************************************************** | ||
* CLASS DECLARATION | ||
**************************************************************************************/ | ||
|
||
template <typename T_REQ> | ||
class ServiceClientBase : public SubscriptionBase | ||
{ | ||
public: | ||
ServiceClientBase() : SubscriptionBase{CanardTransferKindResponse} { } | ||
virtual ~ServiceClientBase() { } | ||
virtual bool request(CanardNodeID const remote_node_id, T_REQ const & req) = 0; | ||
}; | ||
|
||
/************************************************************************************** | ||
* NAMESPACE | ||
**************************************************************************************/ | ||
|
||
} /* impl */ | ||
|
||
/************************************************************************************** | ||
* TYPEDEF | ||
**************************************************************************************/ | ||
|
||
template <typename T_REQ> | ||
using ServiceClient = std::shared_ptr<impl::ServiceClientBase<T_REQ>>; | ||
|
||
#endif /* INC_107_ARDUINO_CYPHAL_SERVICE_CLIENT_BASE_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* This software is distributed under the terms of the MIT License. | ||
* Copyright (c) 2020-2023 LXRobotics. | ||
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com> | ||
* Contributors: https://github.com/107-systems/107-Arduino-Cyphal/graphs/contributors. | ||
*/ | ||
|
||
#ifndef INC_107_ARDUINO_CYPHAL_SERVICE_SERVER_BASE_HPP | ||
#define INC_107_ARDUINO_CYPHAL_SERVICE_SERVER_BASE_HPP | ||
|
||
/************************************************************************************** | ||
* INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include <memory> | ||
|
||
#include "SubscriptionBase.h" | ||
|
||
#include "Node.hpp" | ||
|
||
/************************************************************************************** | ||
* NAMESPACE | ||
**************************************************************************************/ | ||
|
||
namespace impl | ||
{ | ||
|
||
/************************************************************************************** | ||
* CLASS DECLARATION | ||
**************************************************************************************/ | ||
|
||
class ServiceServerBase : public SubscriptionBase | ||
{ | ||
public: | ||
ServiceServerBase() : SubscriptionBase{CanardTransferKindRequest} { } | ||
}; | ||
|
||
/************************************************************************************** | ||
* NAMESPACE | ||
**************************************************************************************/ | ||
|
||
} /* impl */ | ||
|
||
/************************************************************************************** | ||
* TYPEDEF | ||
**************************************************************************************/ | ||
|
||
using ServiceServer = std::shared_ptr<impl::ServiceServerBase>; | ||
|
||
#endif /* INC_107_ARDUINO_CYPHAL_SERVICE_SERVER_BASE_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters