Commit d4d33029 authored by legoc's avatar legoc
Browse files

Remove friend declarations for coms classes

parent a74a9465
......@@ -54,21 +54,6 @@ class WaitingImplSet;
class HandlerImpl;
class RequestSocketImpl;
namespace coms {
// forward declarations
class Publisher;
class Subscriber;
class Responder;
class Requester;
class PublisherImpl;
class SubscriberImpl;
class RequestImpl;
class ResponderImpl;
class RequesterImpl;
}
namespace application {
class Instance;
......@@ -97,13 +82,6 @@ const State KILLED = 256;
*/
class This : private EventListener {
friend class cameo::coms::Publisher;
friend class cameo::coms::Responder;
friend class cameo::coms::Requester;
friend class cameo::coms::PublisherImpl;
friend class cameo::coms::RequestImpl;
friend class cameo::coms::ResponderImpl;
friend class cameo::coms::RequesterImpl;
friend class cameo::SocketWaitingImpl;
friend class cameo::GenericWaitingImpl;
friend class cameo::Server;
......@@ -238,7 +216,6 @@ private:
class Instance : private EventListener {
friend class cameo::Server;
friend class cameo::coms::Subscriber;
friend std::ostream& operator<<(std::ostream&, const Instance&);
public:
......
......@@ -21,6 +21,9 @@
namespace cameo {
namespace coms {
class PublisherImpl;
class SubscriberImpl;
///////////////////////////////////////////////////////////////////////////
// Publisher
......
......@@ -21,6 +21,11 @@
namespace cameo {
namespace coms {
class Responder;
class RequestImpl;
class ResponderImpl;
class RequesterImpl;
///////////////////////////////////////////////////////////////////////////
// Request
......
......@@ -44,11 +44,6 @@ class Server {
friend class application::Instance;
friend class application::This;
friend class coms::Subscriber;
friend class coms::SubscriberImpl;
friend class coms::RequestImpl;
friend std::ostream& operator<<(std::ostream&, const Server&);
public:
......
......@@ -42,7 +42,7 @@ Publisher::~Publisher() {
std::unique_ptr<Publisher> Publisher::create(const std::string& name, int numberOfSubscribers) {
json::Object response = application::This::getCom().requestJSON(createCreatePublisherRequest(application::This::m_instance.m_id, name, numberOfSubscribers));
json::Object response = application::This::getCom().requestJSON(createCreatePublisherRequest(application::This::getId(), name, numberOfSubscribers));
int publisherPort = response[message::PublisherResponse::PUBLISHER_PORT].GetInt();
if (publisherPort == -1) {
......@@ -134,7 +134,7 @@ Subscriber::~Subscriber() {
std::unique_ptr<Subscriber> Subscriber::createSubscriber(application::Instance & instance, const std::string& publisherName, const std::string& instanceName) {
// Get the JSON response.
json::Object response = instance.getCom().requestJSON(createConnectPublisherRequest(instance.m_id, publisherName));
json::Object response = instance.getCom().requestJSON(createConnectPublisherRequest(instance.getId(), publisherName));
int publisherPort = response[message::PublisherResponse::PUBLISHER_PORT].GetInt();
if (publisherPort == -1) {
......@@ -153,7 +153,7 @@ std::unique_ptr<Subscriber> Subscriber::createSubscriber(application::Instance &
std::unique_ptr<Subscriber> Subscriber::create(application::Instance & instance, const std::string& publisherName) {
try {
return createSubscriber(instance, publisherName, instance.m_name);
return createSubscriber(instance, publisherName, instance.getName());
} catch (const SubscriberCreationException& e) {
// the publisher does not exist, so we are waiting for it
......@@ -171,7 +171,7 @@ std::unique_ptr<Subscriber> Subscriber::create(application::Instance & instance,
}
try {
return createSubscriber(instance, publisherName, instance.m_name);
return createSubscriber(instance, publisherName, instance.getName());
} catch (const SubscriberCreationException& e) {
// that should not happen
......
......@@ -121,7 +121,7 @@ Responder::~Responder() {
std::unique_ptr<Responder> Responder::create(const std::string& name) {
std::string portName = ResponderImpl::RESPONDER_PREFIX + name;
json::Object response = application::This::getCom().requestJSON(createRequestPortV0Request(application::This::m_instance.m_id, portName));
json::Object response = application::This::getCom().requestJSON(createRequestPortV0Request(application::This::getId(), portName));
int responderPort = response[message::RequestResponse::VALUE].GetInt();
if (responderPort == -1) {
......@@ -191,7 +191,7 @@ std::unique_ptr<Requester> Requester::create(application::Instance & instance, c
}
// Request a requester port.
response = application::This::getCom().requestJSON(createRequestPortV0Request(application::This::m_instance.m_id, requesterPortName));
response = application::This::getCom().requestJSON(createRequestPortV0Request(application::This::getId(), requesterPortName));
int requesterPort = response[message::RequestResponse::VALUE].GetInt();
if (requesterPort == -1) {
......
......@@ -179,7 +179,7 @@ void PublisherImpl::terminate() {
setEnd();
m_publisher.reset(nullptr);
json::Object response = application::This::getCom().requestJSON(createTerminatePublisherRequest(application::This::m_instance.m_id, m_name));
json::Object response = application::This::getCom().requestJSON(createTerminatePublisherRequest(application::This::getId(), m_name));
int value = response[message::RequestResponse::VALUE].GetInt();
bool success = (value != -1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment