feat fix event_bus test
Some checks failed
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 1m4s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 1m2s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 1m21s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 1m44s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 1m41s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 1m57s

This commit is contained in:
tqcq 2024-04-03 13:59:37 +08:00
parent 8bd904bfb6
commit 35e01dccd2
4 changed files with 9 additions and 6 deletions

View File

@ -97,8 +97,11 @@ private:
class EventBus { class EventBus {
public: public:
template<typename mt_policy = sigslot::multi_threaded_local> using MultiThreadedLocal = sigslot::multi_threaded_local;
using Subscriber = sigslot::has_slots<mt_policy>; using MultiThreadedGlobal = sigslot::multi_threaded_global;
template<typename mt_policy = MultiThreadedLocal>
using Subscriber = sigslot::has_slots<mt_policy>;
EventBus() = default; EventBus() = default;

View File

@ -13,7 +13,7 @@ struct AtomicEvent {
std::atomic<int> &data; std::atomic<int> &data;
}; };
struct Subscriber : public sled::EventBus::Subscriber { struct Subscriber : public sled::EventBus::Subscriber<> {
void OnEvent(Event event) { (*event.data)++; } void OnEvent(Event event) { (*event.data)++; }
void OnAtomicnEvent(AtomicEvent event) { event.data.fetch_add(1); } void OnAtomicnEvent(AtomicEvent event) { event.data.fetch_add(1); }

View File

@ -26,7 +26,7 @@ struct Event2 {
std::string str; std::string str;
}; };
struct Subscriber : public sled::EventBus::Subscriber { struct Subscriber : public sled::EventBus::Subscriber<> {
void OnEvent1(Event1 event) { a += event.a; } void OnEvent1(Event1 event) { a += event.a; }
void OnEvent2(Event2 event) { str += event.str; } void OnEvent2(Event2 event) { str += event.str; }

View File

@ -167,8 +167,8 @@ Base64::Decode(const uint8_t *ptr, size_t len)
break; break;
} else { } else {
// invalid character // invalid character
return make_status_or<std::string>(StatusCode::kInvalidArgument, return MakeStatusOr<std::string>(StatusCode::kInvalidArgument,
fmt::format("Invalid character [{}] at index [{}]", (char) c, index)); fmt::format("Invalid character [{}] at index [{}]", (char) c, index));
} }
++index; ++index;
} }