Project

General

Profile

Actions

Task #1299

closed

Enforce Interest/Data is created with make_shared

Added by Junxiao Shi over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Docs
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

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);
};
Actions #1

Updated by Alex Afanasyev over 10 years ago

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.

Actions #2

Updated by Junxiao Shi over 10 years ago

Doxygen comments should be added to indicates which operations are unsafe if Interest/Data isn’t created with create.

Actions #3

Updated by Alex Afanasyev over 10 years ago

They are unsafe only in certain context, not in general (I will add the comment)

Actions #4

Updated by Alex Afanasyev over 10 years ago

  • 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

Actions #5

Updated by Alex Afanasyev over 10 years ago

  • Status changed from Code review to Closed
Actions

Also available in: Atom PDF