Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into houliston/changingstuff
Browse files Browse the repository at this point in the history
  • Loading branch information
TrentHouliston committed Aug 12, 2024
2 parents 6d98873 + 852d2d7 commit 44569ba
Show file tree
Hide file tree
Showing 45 changed files with 152 additions and 172 deletions.
2 changes: 1 addition & 1 deletion docs/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Transient

.. codeblock:: c++
template <>
struct is_transient<word::IO::Event> : public std::true_type {};
struct is_transient<word::IO::Event> : std::true_type {};

When the data returned from a `get` is falsy and its type is marked transient the latest truthy data from the `get`
return is instead used. If the data is falsy and is either not marked transient or nothing truthy has yet been returned
Expand Down
1 change: 1 addition & 0 deletions src/LogLevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#include "LogLevel.hpp"

#include <ostream>
Expand Down
2 changes: 1 addition & 1 deletion src/clock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace NUClear {
/**
* A clock class that extends a base clock type and allows for clock adjustment and setting.
*/
struct clock : public NUCLEAR_CLOCK_TYPE {
struct clock : NUCLEAR_CLOCK_TYPE {
using base_clock = NUCLEAR_CLOCK_TYPE;

/**
Expand Down
14 changes: 7 additions & 7 deletions src/dsl/Fusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ namespace dsl {
/// All of the words from a reaction handle "fused" together into one type
template <typename... Words>
struct Fusion
: public fusion::BindFusion<Words...>
, public fusion::GetFusion<Words...>
, public fusion::PreconditionFusion<Words...>
, public fusion::PriorityFusion<Words...>
, public fusion::GroupFusion<Words...>
, public fusion::PoolFusion<Words...>
, public fusion::PostconditionFusion<Words...> {};
: fusion::BindFusion<Words...>
, fusion::GetFusion<Words...>
, fusion::PreconditionFusion<Words...>
, fusion::PriorityFusion<Words...>
, fusion::GroupFusion<Words...>
, fusion::PoolFusion<Words...>
, fusion::PostconditionFusion<Words...> {};

} // namespace dsl
} // namespace NUClear
Expand Down
8 changes: 4 additions & 4 deletions src/dsl/fusion/BindFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct BindWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<has_bind<Word1>::value,
/*T*/ BindWords<std::tuple<WordN...>, std::tuple<FoundWords..., Word1>>,
/*F*/ BindWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
: std::conditional_t<has_bind<Word1>::value,
/*T*/ BindWords<std::tuple<WordN...>, std::tuple<FoundWords..., Word1>>,
/*F*/ BindWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};

/**
* Termination case for the BindWords metafunction
Expand Down Expand Up @@ -144,7 +144,7 @@ namespace dsl {

template <typename Word1, typename... WordN>
struct BindFusion
: public BindFuser<
: BindFuser<
typename BindWords<std::tuple<typename Bind<Word1>::type, typename Bind<WordN>::type...>>::type> {};

} // namespace fusion
Expand Down
9 changes: 4 additions & 5 deletions src/dsl/fusion/GetFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct GetWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<has_get<Word1>::value,
/*T*/ GetWords<std::tuple<WordN...>, std::tuple<FoundWords..., Word1>>,
/*F*/ GetWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
: std::conditional_t<has_get<Word1>::value,
/*T*/ GetWords<std::tuple<WordN...>, std::tuple<FoundWords..., Word1>>,
/*F*/ GetWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};

/**
* Termination case for the GetWords metafunction.
Expand Down Expand Up @@ -104,8 +104,7 @@ namespace dsl {

template <typename Word1, typename... WordN>
struct GetFusion
: public GetFuser<
typename GetWords<std::tuple<typename Get<Word1>::type, typename Get<WordN>::type...>>::type> {};
: GetFuser<typename GetWords<std::tuple<typename Get<Word1>::type, typename Get<WordN>::type...>>::type> {};

} // namespace fusion
} // namespace dsl
Expand Down
4 changes: 2 additions & 2 deletions src/dsl/fusion/GroupFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct GroupWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<
: std::conditional_t<
has_group<typename Group<Word1>::type>::value,
/*T*/ GroupWords<std::tuple<WordN...>, std::tuple<FoundWords..., typename Group<Word1>::type>>,
/*F*/ GroupWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
Expand Down Expand Up @@ -101,7 +101,7 @@ namespace dsl {
};

template <typename Word1, typename... WordN>
struct GroupFusion : public GroupFuser<typename GroupWords<std::tuple<Word1, WordN...>>::type> {};
struct GroupFusion : GroupFuser<typename GroupWords<std::tuple<Word1, WordN...>>::type> {};

} // namespace fusion
} // namespace dsl
Expand Down
4 changes: 2 additions & 2 deletions src/dsl/fusion/PoolFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct PoolWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<
: std::conditional_t<
has_pool<typename Pool<Word1>::type>::value,
/*T*/ PoolWords<std::tuple<WordN...>, std::tuple<FoundWords..., typename Pool<Word1>::type>>,
/*F*/ PoolWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace dsl {
};

template <typename Word1, typename... WordN>
struct PoolFusion : public PoolFuser<typename PoolWords<std::tuple<Word1, WordN...>>::type> {};
struct PoolFusion : PoolFuser<typename PoolWords<std::tuple<Word1, WordN...>>::type> {};

} // namespace fusion
} // namespace dsl
Expand Down
13 changes: 6 additions & 7 deletions src/dsl/fusion/PostconditionFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct PostconditionWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<
has_postcondition<typename Postcondition<Word1>::type>::value,
/*T*/
PostconditionWords<std::tuple<WordN...>,
std::tuple<FoundWords..., typename Postcondition<Word1>::type>>,
/*F*/ PostconditionWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
: std::conditional_t<has_postcondition<typename Postcondition<Word1>::type>::value,
/*T*/
PostconditionWords<std::tuple<WordN...>,
std::tuple<FoundWords..., typename Postcondition<Word1>::type>>,
/*F*/ PostconditionWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};

/**
* Termination case for the PostconditionWords metafunction.
Expand Down Expand Up @@ -100,7 +99,7 @@ namespace dsl {

template <typename Word1, typename... WordN>
struct PostconditionFusion
: public PostconditionFuser<typename PostconditionWords<std::tuple<Word1, WordN...>>::type> {};
: PostconditionFuser<typename PostconditionWords<std::tuple<Word1, WordN...>>::type> {};

} // namespace fusion
} // namespace dsl
Expand Down
14 changes: 6 additions & 8 deletions src/dsl/fusion/PreconditionFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct PreconditionWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<
has_precondition<typename Precondition<Word1>::type>::value,
/*T*/
PreconditionWords<std::tuple<WordN...>,
std::tuple<FoundWords..., typename Precondition<Word1>::type>>,
/*F*/ PreconditionWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
: std::conditional_t<has_precondition<typename Precondition<Word1>::type>::value,
/*T*/
PreconditionWords<std::tuple<WordN...>,
std::tuple<FoundWords..., typename Precondition<Word1>::type>>,
/*F*/ PreconditionWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};

/**
* Termination case for the PreconditionWords metafunction.
Expand Down Expand Up @@ -97,8 +96,7 @@ namespace dsl {
};

template <typename Word1, typename... WordN>
struct PreconditionFusion
: public PreconditionFuser<typename PreconditionWords<std::tuple<Word1, WordN...>>::type> {};
struct PreconditionFusion : PreconditionFuser<typename PreconditionWords<std::tuple<Word1, WordN...>>::type> {};

} // namespace fusion
} // namespace dsl
Expand Down
4 changes: 2 additions & 2 deletions src/dsl/fusion/PriorityFusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace dsl {
*/
template <typename Word1, typename... WordN, typename... FoundWords>
struct PriorityWords<std::tuple<Word1, WordN...>, std::tuple<FoundWords...>>
: public std::conditional_t<
: std::conditional_t<
has_priority<typename Priority<Word1>::type>::value,
/*T*/ PriorityWords<std::tuple<WordN...>, std::tuple<FoundWords..., typename Priority<Word1>::type>>,
/*F*/ PriorityWords<std::tuple<WordN...>, std::tuple<FoundWords...>>> {};
Expand Down Expand Up @@ -95,7 +95,7 @@ namespace dsl {
};

template <typename Word1, typename... WordN>
struct PriorityFusion : public PriorityFuser<typename PriorityWords<std::tuple<Word1, WordN...>>::type> {};
struct PriorityFusion : PriorityFuser<typename PriorityWords<std::tuple<Word1, WordN...>>::type> {};

} // namespace fusion
} // namespace dsl
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/trait/is_transient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dsl {
* @tparam typename the datatype that is to be considered transient
*/
template <typename DataType>
struct is_transient : public std::false_type {};
struct is_transient : std::false_type {};

} // namespace trait
} // namespace dsl
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Every.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace dsl {
struct Per;

template <typename Unit, std::intmax_t num, std::intmax_t den>
struct Per<std::chrono::duration<Unit, std::ratio<num, den>>> : public clock::duration {
struct Per<std::chrono::duration<Unit, std::ratio<num, den>>> : clock::duration {
explicit Per(int ticks)
: clock::duration(std::lround((double(num) / double(ticks * den))
* (double(clock::period::den) / double(clock::period::num)))) {}
Expand Down
10 changes: 5 additions & 5 deletions src/dsl/word/IO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ namespace dsl {

// On windows we use different wait events
#ifdef _WIN32
// NOLINTNEXTLINE(performance-enum-size)
// NOLINTNEXTLINE(performance-enum-size) these have to be fixed types based on the api
enum EventType : event_t {
READ = FD_READ | FD_OOB | FD_ACCEPT,
WRITE = FD_WRITE,
CLOSE = FD_CLOSE,
ERROR = 0,
};
#else
// NOLINTNEXTLINE(performance-enum-size)
// NOLINTNEXTLINE(performance-enum-size) these have to be fixed types based on the api
enum EventType : event_t {
READ = POLLIN,
WRITE = POLLOUT,
Expand Down Expand Up @@ -151,19 +151,19 @@ namespace dsl {

// Otherwise return an invalid event
return Event{INVALID_SOCKET, 0};
}
} // namespace word

template <typename DSL>
static void postcondition(threading::ReactionTask& task) {
task.parent->reactor.emit<emit::Direct>(std::make_unique<IOFinished>(task.parent->id));
}
};
}; // namespace dsl

} // namespace word

namespace trait {
template <>
struct is_transient<word::IO::Event> : public std::true_type {};
struct is_transient<word::IO::Event> : std::true_type {};
} // namespace trait

} // namespace dsl
Expand Down
4 changes: 2 additions & 2 deletions src/dsl/word/Last.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace dsl {
* @tparam DSLWords The DSL word/activity being modified.
*/
template <size_t n, typename... DSLWords>
struct Last : public Fusion<DSLWords...> {
struct Last : Fusion<DSLWords...> {

private:
template <typename... T, int... Index>
Expand Down Expand Up @@ -185,7 +185,7 @@ namespace dsl {
namespace trait {

template <size_t n, typename T>
struct is_transient<word::LastItemStorage<n, T>> : public std::true_type {};
struct is_transient<word::LastItemStorage<n, T>> : std::true_type {};

} // namespace trait
} // namespace dsl
Expand Down
6 changes: 3 additions & 3 deletions src/dsl/word/Network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace dsl {
namespace word {

template <typename T>
struct NetworkData : public std::shared_ptr<T> {
struct NetworkData : std::shared_ptr<T> {
NetworkData() : std::shared_ptr<T>() {}
explicit NetworkData(T* ptr) : std::shared_ptr<T>(ptr) {}
NetworkData(const std::shared_ptr<T>& ptr) : std::shared_ptr<T>(ptr) {}
Expand Down Expand Up @@ -111,10 +111,10 @@ namespace dsl {
namespace trait {

template <typename T>
struct is_transient<typename word::NetworkData<T>> : public std::true_type {};
struct is_transient<typename word::NetworkData<T>> : std::true_type {};

template <>
struct is_transient<typename std::shared_ptr<word::NetworkSource>> : public std::true_type {};
struct is_transient<typename std::shared_ptr<word::NetworkSource>> : std::true_type {};

} // namespace trait
} // namespace dsl
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Once.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace dsl {
* Any reactions listed with this DSL word will run only once.
* This is the only time these reactions will run as the postcondition Unbinds the current reaction.
*/
struct Once : public Single {
struct Once : Single {

// Post condition to unbind this reaction.
template <typename DSL>
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace dsl {
* @tparam DSLWords The DSL word/activity being modified.
*/
template <typename... DSLWords>
struct Optional : public Fusion<DSLWords...> {
struct Optional : Fusion<DSLWords...> {

private:
template <typename... T, int... Index>
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Shutdown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace dsl {
* Bind
*/
struct Shutdown
: public operation::TypeBind<Shutdown>
: operation::TypeBind<Shutdown>
, Priority::IDLE {};

} // namespace word
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Single.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace dsl {
* @par Implements
* Precondition
*/
struct Single : public Buffer<1> {};
struct Single : Buffer<1> {};

} // namespace word
} // namespace dsl
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Startup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace dsl {
* @par Implements
* Bind
*/
struct Startup : public operation::TypeBind<Startup> {};
struct Startup : operation::TypeBind<Startup> {};

} // namespace word
} // namespace dsl
Expand Down
5 changes: 2 additions & 3 deletions src/dsl/word/TCP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

#include <cstring>

#include "../../PowerPlant.hpp"
#include "../../threading/Reaction.hpp"
#include "../../util/FileDescriptor.hpp"
#include "../../util/network/resolve.hpp"
Expand Down Expand Up @@ -63,7 +62,7 @@ namespace dsl {
* @par Implements
* Bind
*/
struct TCP : public IO {
struct TCP : IO {

struct Connection {

Expand Down Expand Up @@ -203,7 +202,7 @@ namespace dsl {
namespace trait {

template <>
struct is_transient<word::TCP::Connection> : public std::false_type {};
struct is_transient<word::TCP::Connection> : std::false_type {};

} // namespace trait
} // namespace dsl
Expand Down
2 changes: 1 addition & 1 deletion src/dsl/word/Trigger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace dsl {
* Emission of this datatype into the system will trigger the subscribing reaction.
*/
template <typename... Ts>
struct Trigger : public Fusion<operation::TypeBind<Ts>..., operation::CacheGet<Ts>...> {};
struct Trigger : Fusion<operation::TypeBind<Ts>..., operation::CacheGet<Ts>...> {};

} // namespace word
} // namespace dsl
Expand Down
Loading

0 comments on commit 44569ba

Please sign in to comment.