Summary Files Commits Branches @commit @diff @stats
path: root / src / frame.h
diff options
context:
space:
mode:
Commitdb6384c470fe5660bf474aa49f46b00b893c4b3e (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-07-03 15:10:02 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-07-03 15:10:02 +0300
Files757b8683feb6bffbbc7f2643636806fd5b140858 /src/frame.h
iso-tp-parser-carista-db6384c470fe5660bf474aa49f46b00b893c4b3e.tar
iso-tp-parser-carista-db6384c470fe5660bf474aa49f46b00b893c4b3e.tar.gz
iso-tp-parser-carista-db6384c470fe5660bf474aa49f46b00b893c4b3e.zip
Parentbef1b7e46471f1668d2c84380ef685a15defe06a (diff)
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.h36
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);
};