diff options
chore(frame): Implement rule of 4 and move implementations from header to source
1 files changed, 15 insertions, 21 deletions
| -rw-r--r-- | src/frame.h | 36 |
diff --git a/src/frame.h b/src/frame.h index 92b9c8f..989ee38 100644 --- a/src/frame.h +++ b/src/frame.h @@ -15,31 +15,25 @@ class Frame { void parse_frame_str(const unsigned char* iso_tp_frame); -public: - Frame(const char* iso_tp_frame) { - this->parse_frame_str((const unsigned char*)iso_tp_frame); - } - - ~Frame() { - delete[] this->data; - } + void free(); + void copyFrom(const Frame& other); - FrameType get_type() const { - return this->type; - } - - unsigned int get_size() const { - return this->size; - } +public: + Frame(const char* iso_tp_frame); - unsigned int get_data_size() const { - return this->data_size; - } + /* Rule of 4 */ + Frame() = default; + ~Frame(); + Frame(const Frame& other); + Frame& operator=(const Frame& other); - const unsigned char* get_data() const { - return this->data; - } + /* Getters */ + FrameType get_type() const; + unsigned int get_size() const; + unsigned int get_data_size() const; + const unsigned char* get_data() const; + /* IO */ friend std::ostream& operator<<(std::ostream& os, const Frame& f); }; |
