From 61c4f3192d742be4c9a7a5f5e2bf84e42b9a6306 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 3 Jul 2025 15:10:16 +0300 Subject: chore(message): Implement rule of 4 and move implementations from header to source --- src/message.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/message.h') diff --git a/src/message.h b/src/message.h index c988059..fcc8258 100644 --- a/src/message.h +++ b/src/message.h @@ -10,19 +10,23 @@ class Message { unsigned int received; unsigned char* msg; + void free(); + void copyFrom(const Message& other); + public: - Message() = default; Message(unsigned int can_id, const Frame& first_frame); - Message(const Message& rhs); - ~Message() { - delete[] this->msg; - } + /* Rule of 4 */ + Message() = default; + ~Message(); + Message(const Message& other); + Message& operator=(const Message& other); + /* Logic */ void receive_frame(const Frame& f); - bool expects_more_frames() const; + /* IO */ friend std::ostream& operator<<(std::ostream& os, const Message& m); }; -- cgit v1.3.1-26-gb76a