Skip to content

Commit

Permalink
Make it impossible to not define class_name for Sender class.
Browse files Browse the repository at this point in the history
  • Loading branch information
nealkruis committed May 27, 2024
1 parent 5e9d131 commit 347b685
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions include/courier/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ class DefaultCourier : public Courier {
class Sender {
public:
Sender() = default;
explicit Sender(std::string name_in,
explicit Sender(std::string class_name_in,
std::string name_in,
const std::shared_ptr<Courier>& courier_in = std::make_shared<DefaultCourier>())
: name(std::move(name_in)), courier(courier_in) {};
: name(std::move(name_in)), courier(courier_in), class_name(std::move(class_name_in)) {};
std::string name;

protected:
Expand Down Expand Up @@ -61,6 +62,8 @@ class Sender {
{
courier->send_debug(make_message(message));
}
void set_courier(const std::shared_ptr<Courier>& courier_in) { courier = courier_in; }
std::shared_ptr<Courier> get_courier() { return courier; };
};

} // namespace Courier
3 changes: 1 addition & 2 deletions test/library.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ class LibraryClass : Courier::Sender {
explicit LibraryClass(std::string name_in,
const std::shared_ptr<Courier::Courier>& courier_in =
std::make_shared<Courier::DefaultCourier>())
: Courier::Sender(std::move(name_in), courier_in)
: Courier::Sender("LibraryClass", std::move(name_in), courier_in)
{
class_name = "LibraryClass";
}
void generate_debug() { send_debug("Something for the developer happened."); }
void generate_info() { send_info("Something you should notice happened."); }
Expand Down

0 comments on commit 347b685

Please sign in to comment.