Calling Can I call my defined ROS services through a vector of function pointers? [closed]
My code is something like this.
class Foo { public: typedef bool (Foo::*fnPtr) (int, int);
struct serv_desc{
std::string service_name;
std::string callback_name;
fnPtr call_backFunction;
ros::ServiceServer server;
};
std::vector <serv_desc> serv_list;
bool start_services ()
{
for (std::vector<fnPtr>::iterator iter = serv_list.begin(); iter != serv_list.end(); iter++ )
{
iter->server = n->advertise(iter->service_name,iter->fnPtr,this);
}
}
};
I need to know hot to define my fnPtr (?????,????); so that i can call setup callbacks and advertisement for various services. through a vector and kill them etc using the vector andlook them up by name etc within the program. Is there a parent type for all package_name::service_type::Request and Response types that i can use and type cast later.
Any help might end up saving me and my team 1000s of lines of code. so thanks in advance