-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Modernization/migrate to smart pointers #49
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,27 +34,11 @@ class memory_walker_adler16: | |
public memory_walker | ||
{ | ||
public: | ||
typedef std::shared_ptr<memory_walker_adler16> pointer; | ||
|
||
/** | ||
* The destructor. | ||
*/ | ||
~memory_walker_adler16() override = default; | ||
|
||
private: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This inclusion of private here is intentional. The idea is that the headers are written from a template and in a very structured way. Rather than mysteriously move the constructor to the bottom of the header, it's left in the usual spot as a prompt (to the lib user especially) that the create method should be used. |
||
/** | ||
* The default constructor. It is private on purpose, use the | ||
* #create method instead. | ||
*/ | ||
memory_walker_adler16() = default; | ||
|
||
public: | ||
/** | ||
* The create class method is used to create new dynamically | ||
* allocated instances of this class. | ||
*/ | ||
static pointer create(); | ||
|
||
/** | ||
* The get method is used to get the ADLER16 checksum once all memory | ||
* chunks have been processed by calls to our observe method. | ||
|
@@ -82,6 +66,12 @@ class memory_walker_adler16: | |
* The assignment operator. | ||
*/ | ||
memory_walker_adler16 &operator=(const memory_walker_adler16 &) = delete; | ||
|
||
/** | ||
* The default constructor. It is private on purpose, use the | ||
* #create method instead. | ||
*/ | ||
memory_walker_adler16() = default; | ||
}; | ||
|
||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,27 +34,11 @@ class memory_walker_adler32: | |
public memory_walker | ||
{ | ||
public: | ||
typedef std::shared_ptr<memory_walker_adler32> pointer; | ||
|
||
/** | ||
* The destructor. | ||
*/ | ||
~memory_walker_adler32() override = default; | ||
|
||
private: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional, same as in adler16.h above. |
||
/** | ||
* The default constructor. It is private on purpose, use the | ||
* #create method instead. | ||
*/ | ||
memory_walker_adler32() = default; | ||
|
||
public: | ||
/** | ||
* The create class method is used to create new dynamically | ||
* allocated instances of this class. | ||
*/ | ||
static pointer create(); | ||
|
||
/** | ||
* The get method is used to get the ADLER32 checksum once all memory | ||
* chunks have been processed by calls to our observe method. | ||
|
@@ -82,6 +66,12 @@ class memory_walker_adler32: | |
* The assignment operator. | ||
*/ | ||
memory_walker_adler32 &operator=(const memory_walker_adler32 &) = delete; | ||
|
||
/** | ||
* The default constructor. It is private on purpose, use the | ||
* #create method instead. | ||
*/ | ||
memory_walker_adler32() = default; | ||
}; | ||
|
||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely keen to move to smart pointers. I should have picked these up when I moved from boost to std share pointers elsewhere.
However, I'd rather move the creation of the smart pointer into the create method in the class(es). My worry is that someone using libsrecord won't get the benefit or more importantly may mix smart and non-smart pointers if they are using base and library code from the project.