Skip to content

Commit

Permalink
Tweak
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero committed Feb 1, 2024
1 parent 77c2c47 commit 889f3aa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
4 changes: 2 additions & 2 deletions include/gz/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1217,8 +1217,8 @@ namespace gz

if (this->verbose)
{
std::cout << "\t* Sending " << msgs::ToString(_type)
<< " msg [" << _pub.Topic() << "]" << std::endl;
// std::cout << "\t* Sending " << msgs::ToString(_type)
// << " msg [" << _pub.Topic() << "]" << std::endl;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
SYSTEM PUBLIC
$<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:CPPZMQ::CPPZMQ,INTERFACE_INCLUDE_DIRECTORIES>)
$<TARGET_PROPERTY:CPPZMQ::CPPZMQ,INTERFACE_INCLUDE_DIRECTORIES>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/gz_msgs_gen>)

# Windows system library provides UUID
if (NOT MSVC)
Expand Down
30 changes: 15 additions & 15 deletions src/Publisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ void Publisher::SetOptions(const AdvertiseOptions &_opts)
}

//////////////////////////////////////////////////
void Publisher::FillDiscovery(msgs::Discovery &_msg) const
void Publisher::FillDiscovery(private_msgs::Discovery &_msg) const
{
msgs::Discovery::Publisher *pub = _msg.mutable_pub();
private_msgs::Discovery::Publisher *pub = _msg.mutable_pub();
pub->set_topic(this->Topic());
pub->set_address(this->Addr());
pub->set_process_uuid(this->PUuid());
Expand All @@ -113,20 +113,20 @@ void Publisher::FillDiscovery(msgs::Discovery &_msg) const
switch (this->opts.Scope())
{
case Scope_t::PROCESS:
pub->set_scope(msgs::Discovery::Publisher::PROCESS);
pub->set_scope(private_msgs::Discovery::Publisher::PROCESS);
break;
case Scope_t::HOST:
pub->set_scope(msgs::Discovery::Publisher::HOST);
pub->set_scope(private_msgs::Discovery::Publisher::HOST);
break;
default:
case Scope_t::ALL:
pub->set_scope(msgs::Discovery::Publisher::ALL);
pub->set_scope(private_msgs::Discovery::Publisher::ALL);
break;
}
}

//////////////////////////////////////////////////
void Publisher::SetFromDiscovery(const msgs::Discovery &_msg)
void Publisher::SetFromDiscovery(const private_msgs::Discovery &_msg)
{
if (_msg.has_sub())
this->topic = _msg.sub().topic();
Expand All @@ -139,14 +139,14 @@ void Publisher::SetFromDiscovery(const msgs::Discovery &_msg)

switch (_msg.pub().scope())
{
case msgs::Discovery::Publisher::PROCESS:
case private_msgs::Discovery::Publisher::PROCESS:
this->opts.SetScope(Scope_t::PROCESS);
break;
case msgs::Discovery::Publisher::HOST:
case private_msgs::Discovery::Publisher::HOST:
this->opts.SetScope(Scope_t::HOST);
break;
default:
case msgs::Discovery::Publisher::ALL:
case private_msgs::Discovery::Publisher::ALL:
this->opts.SetScope(Scope_t::ALL);
break;
}
Expand Down Expand Up @@ -216,10 +216,10 @@ void MessagePublisher::SetOptions(const AdvertiseMessageOptions &_opts)
}

//////////////////////////////////////////////////
void MessagePublisher::FillDiscovery(msgs::Discovery &_msg) const
void MessagePublisher::FillDiscovery(private_msgs::Discovery &_msg) const
{
Publisher::FillDiscovery(_msg);
msgs::Discovery::Publisher *pub = _msg.mutable_pub();
private_msgs::Discovery::Publisher *pub = _msg.mutable_pub();

// Message options
pub->mutable_msg_pub()->set_ctrl(this->Ctrl());
Expand All @@ -229,7 +229,7 @@ void MessagePublisher::FillDiscovery(msgs::Discovery &_msg) const
}

//////////////////////////////////////////////////
void MessagePublisher::SetFromDiscovery(const msgs::Discovery &_msg)
void MessagePublisher::SetFromDiscovery(const private_msgs::Discovery &_msg)
{
Publisher::SetFromDiscovery(_msg);
this->ctrl = _msg.pub().msg_pub().ctrl();
Expand Down Expand Up @@ -319,10 +319,10 @@ void ServicePublisher::SetOptions(const AdvertiseServiceOptions &_opts)
}

//////////////////////////////////////////////////
void ServicePublisher::FillDiscovery(msgs::Discovery &_msg) const
void ServicePublisher::FillDiscovery(private_msgs::Discovery &_msg) const
{
Publisher::FillDiscovery(_msg);
msgs::Discovery::Publisher *pub = _msg.mutable_pub();
private_msgs::Discovery::Publisher *pub = _msg.mutable_pub();

// Service publisher info
pub->mutable_srv_pub()->set_socket_id(this->SocketId());
Expand All @@ -331,7 +331,7 @@ void ServicePublisher::FillDiscovery(msgs::Discovery &_msg) const
}

//////////////////////////////////////////////////
void ServicePublisher::SetFromDiscovery(const msgs::Discovery &_msg)
void ServicePublisher::SetFromDiscovery(const private_msgs::Discovery &_msg)
{
Publisher::SetFromDiscovery(_msg);
this->srvOpts.SetScope(Publisher::Options().Scope());
Expand Down
6 changes: 3 additions & 3 deletions src/Publisher_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ TEST(PublisherTest, PublisherIO)

// Pack a Publisher.
Publisher publisher(g_topic, g_addr, g_puuid, g_nuuid, g_opts1);
msgs::Discovery msg;
private_msgs::Discovery msg;
publisher.FillDiscovery(msg);

// Unpack the Publisher.
Expand Down Expand Up @@ -206,7 +206,7 @@ TEST(PublisherTest, MessagePublisherIO)
MessagePublisher publisher(g_topic, g_addr, g_ctrl, g_puuid, g_nuuid,
g_msgTypeName, g_msgOpts2);

msgs::Discovery msg;
private_msgs::Discovery msg;
publisher.FillDiscovery(msg);

// Unpack the Publisher.
Expand Down Expand Up @@ -311,7 +311,7 @@ TEST(PublisherTest, ServicePublisherIO)
ServicePublisher publisher(g_topic, g_addr, g_socketId, g_puuid, g_nuuid,
g_reqTypeName, g_repTypeName, g_srvOpts2);

msgs::Discovery msg;
private_msgs::Discovery msg;
publisher.FillDiscovery(msg);

// Unpack the Publisher.
Expand Down

0 comments on commit 889f3aa

Please sign in to comment.