Home | Tutorials | Wiki | Issues
Ask Your Question
0

Ptr in function parameter[in]

asked 2017-05-27 01:30:51 -0500

shawnysh gravatar image

Beginner Tutorial: Velodyne Sensor

public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
    {
      // Just output a message for now
      std::cerr << "\nThe velodyne plugin is attach to model[" <<
        _model->GetName() << "]\n";
    }

I am new to C++, i want to know more about the Ptr in function parameter[in], it can be seen everywhere.

Any gentle guide or hint would be appreciated.

Thanks for your kindness

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2017-05-30 11:47:20 -0500

Carlos Agüero gravatar image

ModelPtr is a custom type declaration. Here, you can see the typedef and how ModelPtr is equivalent to boost::shared_ptr<Model>. In a nutshell, a ModelPtr is a shared pointer to a model object. Here's a quick tutorial about boost smart pointers.

An ElementPtr is also a custom type, another shared pointer to an sdf::Element. Here, you can see the typedef in SDFormat.

edit flag offensive delete link more

Comments

Thanks for your helpful answers!

shawnysh gravatar imageshawnysh ( 2017-06-06 05:36:14 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-27 01:30:51 -0500

Seen: 107 times

Last updated: May 30 '17