Task #1299
closed
Enforce Interest/Data is created with make_shared
Added by Junxiao Shi over 10 years ago.
Updated over 10 years ago.
Description
Interest class and Data class are not fully functional if they are not created with boost::make_shared
.
To enforce this requirement, their constructors should be marked private, and a static method should be provided to create shared_ptr<Interest>
and shared_ptr<Data>
:
class Interest
{
public:
static shared_ptr<Interest>
create(const Name& name);
private:
explicit
Interest(const Name& name);
};
I can provide create
methods, but I do not want to make create
methods the only way to create Interests/Data. While inside NFD, Interst/Data must be shared_ptr, this is not a general requirement for all ndn-cpp-dev based applications.
Doxygen comments should be added to indicates which operations are unsafe if Interest/Data isn’t created with create
.
They are unsafe only in certain context, not in general (I will add the comment)
- Category set to Docs
- Status changed from New to Code review
- Target version set to v0.2
I have added the comment for each Interest/Data constructor
- Status changed from Code review to Closed
Also available in: Atom
PDF