Skip to content

Removed topics from yarp::os #3241

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/release/master.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ Breaking Changes

### libYARP_os

* Removed the following methods from `yarp::os::NameSpace` : `connectPortToTopic`, `connectTopicToPort`,
`disconnectPortFromTopic`, `disconnectTopicFromPort`
* Removed classes `yarp::os::Node`,`yarp::os::Nodes`,`yarp::os::Publisher`,`yarp::os::Subscriber`
* Removed ROS1-related management logic in YARP nameserver
44 changes: 0 additions & 44 deletions src/libYARP_os/src/yarp/os/MultiNameSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,50 +280,6 @@ Contact MultiNameSpace::queryName(const std::string& name)
return HELPER(this).queryName(name);
}

bool MultiNameSpace::connectPortToTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style)
{
NameSpace* ns = HELPER(this).getOne();
if (ns == nullptr) {
return false;
}
return ns->connectPortToTopic(src, dest, style);
}

bool MultiNameSpace::connectTopicToPort(const Contact& src,
const Contact& dest,
const ContactStyle& style)
{
NameSpace* ns = HELPER(this).getOne();
if (ns == nullptr) {
return false;
}
return ns->connectTopicToPort(src, dest, style);
}

bool MultiNameSpace::disconnectPortFromTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style)
{
NameSpace* ns = HELPER(this).getOne();
if (ns == nullptr) {
return false;
}
return ns->disconnectPortFromTopic(src, dest, style);
}

bool MultiNameSpace::disconnectTopicFromPort(const Contact& src,
const Contact& dest,
const ContactStyle& style)
{
NameSpace* ns = HELPER(this).getOne();
if (ns == nullptr) {
return false;
}
return ns->disconnectTopicFromPort(src, dest, style);
}

bool MultiNameSpace::connectPortToPortPersistently(const Contact& src,
const Contact& dest,
const ContactStyle& style)
Expand Down
16 changes: 0 additions & 16 deletions src/libYARP_os/src/yarp/os/MultiNameSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,6 @@ class YARP_os_API MultiNameSpace : public NameSpace

Value* getProperty(const std::string& name, const std::string& key) override;

virtual bool connectPortToTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style) override;

virtual bool connectTopicToPort(const Contact& src,
const Contact& dest,
const ContactStyle& style) override;

virtual bool disconnectPortFromTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style) override;

virtual bool disconnectTopicFromPort(const Contact& src,
const Contact& dest,
const ContactStyle& style) override;

virtual bool connectPortToPortPersistently(const Contact& src,
const Contact& dest,
const ContactStyle& style) override;
Expand Down
28 changes: 0 additions & 28 deletions src/libYARP_os/src/yarp/os/NameSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,34 +122,6 @@ class YARP_os_API NameSpace
virtual Value *getProperty(const std::string& name,
const std::string& key) = 0;

/**
* Publish a port to a topic.
*/
virtual bool connectPortToTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style) = 0;

/**
* Subscribe a port to a topic.
*/
virtual bool connectTopicToPort(const Contact& src,
const Contact& dest,
const ContactStyle& style) = 0;

/**
* Stop publishing a port to a topic.
*/
virtual bool disconnectPortFromTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style) = 0;

/**
* Stop subscribing a port to a topic.
*/
virtual bool disconnectTopicFromPort(const Contact& src,
const Contact& dest,
const ContactStyle& style) = 0;

/**
* Connect two ports with persistence.
*/
Expand Down
36 changes: 0 additions & 36 deletions src/libYARP_os/src/yarp/os/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,42 +490,6 @@ static int metaConnect(const std::string& src,
destIsTopic = true;
}

if (srcIsTopic || destIsTopic) {
Bottle cmd;
Bottle reply;
NameSpace& ns = getNameSpace();

bool ok = false;
if (srcIsTopic) {
if (mode == YARP_ENACT_CONNECT) {
ok = ns.connectTopicToPort(staticSrc, staticDest, style);
} else if (mode == YARP_ENACT_DISCONNECT) {
ok = ns.disconnectTopicFromPort(staticSrc, staticDest, style);
} else {
yCError(NETWORK, "Failure: cannot check subscriptions yet");
return 1;
}
} else {
if (mode == YARP_ENACT_CONNECT) {
ok = ns.connectPortToTopic(staticSrc, staticDest, style);
} else if (mode == YARP_ENACT_DISCONNECT) {
ok = ns.disconnectPortFromTopic(staticSrc, staticDest, style);
} else {
yCError(NETWORK, "Failure: cannot check subscriptions yet");
return 1;
}
}
if (!ok) {
return 1;
}
if (!style.quiet) {
if (style.verboseOnSuccess) {
yCInfo(NETWORK, "Success: connection to topic %s.", mode == YARP_ENACT_CONNECT ? "added" : "removed");
}
}
return 0;
}

yCTrace(NETWORK,
"dynamicSrc.getCarrier() = %s",
dynamicSrc.getCarrier().c_str());
Expand Down
38 changes: 0 additions & 38 deletions src/libYARP_os/src/yarp/os/YarpNameSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,49 +57,11 @@ Contact YarpNameSpace::registerContact(const Contact& contact)
Contact address = nic.registerName(contact.getName(), contact);
yCDebug(YARPNAMESPACE, "Registered address: %s", address.toURI().c_str());

if (address.isValid()) {
NestedContact nc;
nc.fromString(address.getRegName());
std::string cat = nc.getCategory();
if (!nc.getNestedName().empty()) {
//bool service = (cat.find("1") != std::string::npos);
bool publish = (cat.find('+') != std::string::npos);
bool subscribe = (cat.find('-') != std::string::npos);
ContactStyle style;
Contact c1(nc.getFullName());
Contact c2(std::string("topic:/") + nc.getNestedName());
if (subscribe) {
style.persistenceType = ContactStyle::END_WITH_TO_PORT;
connectPortToTopic(c2, c1, style);
}
if (publish) {
style.persistenceType = ContactStyle::END_WITH_FROM_PORT;
connectPortToTopic(c1, c2, style);
}
}
}
return address;
}

Contact YarpNameSpace::unregisterName(const std::string& name)
{
NestedContact nc;
nc.fromString(name);
std::string cat = nc.getCategory();
if (!nc.getNestedName().empty()) {
//bool service = (cat.find("1") != std::string::npos);
bool publish = (cat.find('+') != std::string::npos);
bool subscribe = (cat.find('-') != std::string::npos);
ContactStyle style;
Contact c1(nc.getFullName());
Contact c2(std::string("topic:/") + nc.getNestedName());
if (subscribe) {
disconnectPortFromTopic(c2, c1, style);
}
if (publish) {
disconnectPortFromTopic(c1, c2, style);
}
}
NameClient& nic = HELPER(this);
return nic.unregisterName(name);
}
Expand Down
28 changes: 0 additions & 28 deletions src/libYARP_os/src/yarp/os/YarpNameSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,6 @@ class YARP_os_API YarpNameSpace : public NameSpace
virtual Value* getProperty(const std::string& name,
const std::string& key) override;

virtual bool connectPortToTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style) override
{
return connectTopic("subscribe", false, true, src, dest, style);
}

virtual bool connectTopicToPort(const Contact& src,
const Contact& dest,
const ContactStyle& style) override
{
return connectTopic("subscribe", true, false, src, dest, style);
}

virtual bool disconnectPortFromTopic(const Contact& src,
const Contact& dest,
const ContactStyle& style) override
{
return connectTopic("unsubscribe", false, true, src, dest, style);
}

virtual bool disconnectTopicFromPort(const Contact& src,
const Contact& dest,
const ContactStyle& style) override
{
return connectTopic("unsubscribe", true, false, src, dest, style);
}

virtual bool connectPortToPortPersistently(const Contact& src,
const Contact& dest,
const ContactStyle& style) override
Expand Down
Loading