Commit 02325052 authored by legoc's avatar legoc
Browse files

Renamed SocketImpl into StreamSocketImpl

parent bbf4e0d5
......@@ -25,7 +25,7 @@ libcameo_la_SOURCES = \
cameo/StarterServerException.cpp \
cameo/ResponderCreationException.cpp \
cameo/RequesterCreationException.cpp \
cameo/impl/SocketImpl.cpp \
cameo/impl/StreamSocketImpl.cpp \
cameo/impl/SocketWaitingImpl.cpp \
cameo/impl/GenericWaitingImpl.cpp \
cameo/impl/WaitingImplSet.cpp \
......@@ -45,7 +45,7 @@ libcameo_la_SOURCES = \
cameo/Server.cpp \
cameo/impl/HandlerImpl.cpp \
cameo/Application.cpp \
cameo/impl/SocketImpl.h \
cameo/impl/StreamSocketImpl.h \
cameo/impl/WaitingImpl.h \
cameo/impl/SocketWaitingImpl.h \
cameo/impl/GenericWaitingImpl.h \
......
......@@ -27,11 +27,11 @@
#include "impl/RequesterImpl.h"
#include "impl/RequestImpl.h"
#include "impl/ResponderImpl.h"
#include "impl/SocketImpl.h"
#include "impl/SubscriberImpl.h"
#include "impl/WaitingImpl.h"
#include "impl/WaitingImplSet.h"
#include "impl/HandlerImpl.h"
#include "impl/StreamSocketImpl.h"
#include "PortEvent.h"
#include "ProtoType.h"
#include "PublisherEvent.h"
......
......@@ -16,19 +16,19 @@
#include "EventStreamSocket.h"
#include "impl/SocketImpl.h"
#include "impl/SocketWaitingImpl.h"
#include "PortEvent.h"
#include "PublisherEvent.h"
#include "ResultEvent.h"
#include "StatusEvent.h"
#include "../proto/Messages.pb.h"
#include "impl/StreamSocketImpl.h"
using namespace std;
namespace cameo {
EventStreamSocket::EventStreamSocket(SocketImpl * impl) : m_impl(impl) {
EventStreamSocket::EventStreamSocket(StreamSocketImpl * impl) : m_impl(impl) {
}
EventStreamSocket::~EventStreamSocket() {
......
......@@ -22,7 +22,7 @@
namespace cameo {
class SocketImpl;
class StreamSocketImpl;
class WaitingImpl;
namespace application {
......@@ -43,11 +43,11 @@ public:
void cancel();
private:
EventStreamSocket(SocketImpl * impl);
EventStreamSocket(StreamSocketImpl * impl);
WaitingImpl * waiting();
std::unique_ptr<SocketImpl> m_impl;
std::unique_ptr<StreamSocketImpl> m_impl;
};
}
......
......@@ -16,11 +16,11 @@
#include "OutputStreamSocket.h"
#include "impl/SocketImpl.h"
#include "impl/SocketWaitingImpl.h"
#include "impl/ServicesImpl.h"
#include "../proto/Messages.pb.h"
#include <iostream>
#include "impl/StreamSocketImpl.h"
using namespace std;
......@@ -38,7 +38,7 @@ const std::string& Output::getMessage() const {
return m_message;
}
OutputStreamSocket::OutputStreamSocket(SocketImpl * impl) :
OutputStreamSocket::OutputStreamSocket(StreamSocketImpl * impl) :
m_ended(false),
m_canceled(false),
m_impl(impl) {
......
......@@ -22,7 +22,7 @@
namespace cameo {
class SocketImpl;
class StreamSocketImpl;
class WaitingImpl;
namespace application {
......@@ -61,14 +61,14 @@ public:
bool isCanceled() const;
private:
OutputStreamSocket(SocketImpl * impl);
OutputStreamSocket(StreamSocketImpl * impl);
WaitingImpl * waiting();
bool m_ended;
bool m_canceled;
std::unique_ptr<SocketImpl> m_impl;
std::unique_ptr<StreamSocketImpl> m_impl;
};
}
......
......@@ -21,9 +21,9 @@
#include "Application.h"
#include "ConnectionChecker.h"
#include "impl/ServicesImpl.h"
#include "impl/SocketImpl.h"
#include "ProtoType.h"
#include "EventThread.h"
#include "impl/StreamSocketImpl.h"
using namespace std;
......
......@@ -21,7 +21,7 @@
#include <stdexcept>
#include "impl/CancelIdGenerator.h"
#include "impl/ServicesImpl.h"
#include "impl/SocketImpl.h"
#include "impl/StreamSocketImpl.h"
#include "ProtoType.h"
using namespace std;
......@@ -136,7 +136,7 @@ std::unique_ptr<EventStreamSocket> Services::openEventStream() {
string strRequestData = m_impl->createInitRequest();
m_impl->waitForSubscriber(subscriber, strRequestType, strRequestData, m_serverEndpoint);
return unique_ptr<EventStreamSocket>(new EventStreamSocket(new SocketImpl(subscriber, cancelPublisher)));
return unique_ptr<EventStreamSocket>(new EventStreamSocket(new StreamSocketImpl(subscriber, cancelPublisher)));
}
std::unique_ptr<OutputStreamSocket> Services::createOutputStreamSocket(int port) {
......@@ -154,7 +154,7 @@ std::unique_ptr<OutputStreamSocket> Services::createOutputStreamSocket(int port)
zmq::socket_t * cancelPublisher = m_impl->createCancelPublisher(cancelEndpoint);
zmq::socket_t * subscriber = m_impl->createOutputStreamSubscriber(streamEndpoint, cancelEndpoint);
return unique_ptr<OutputStreamSocket>(new OutputStreamSocket(new SocketImpl(subscriber, cancelPublisher)));
return unique_ptr<OutputStreamSocket>(new OutputStreamSocket(new StreamSocketImpl(subscriber, cancelPublisher)));
}
}
......@@ -14,7 +14,7 @@
* limitations under the Licence.
*/
#include "SocketImpl.h"
#include "StreamSocketImpl.h"
#include <iostream>
......@@ -22,24 +22,24 @@ using namespace std;
namespace cameo {
const std::string SocketImpl::CANCEL = "CANCEL";
const std::string StreamSocketImpl::CANCEL = "CANCEL";
SocketImpl::SocketImpl(zmq::socket_t * socket, zmq::socket_t * cancelSocket) :
StreamSocketImpl::StreamSocketImpl(zmq::socket_t * socket, zmq::socket_t * cancelSocket) :
m_socket(socket), m_cancelSocket(cancelSocket) {
}
SocketImpl::~SocketImpl() {
StreamSocketImpl::~StreamSocketImpl() {
close();
}
void SocketImpl::send(const std::string& data) {
void StreamSocketImpl::send(const std::string& data) {
zmq::message_t messageData(data.size());
memcpy((void *) messageData.data(), data.c_str(), data.size());
m_socket->send(messageData);
}
std::unique_ptr<zmq::message_t> SocketImpl::receive(bool blocking) {
std::unique_ptr<zmq::message_t> StreamSocketImpl::receive(bool blocking) {
// Use the message interface.
unique_ptr<zmq::message_t> message(new zmq::message_t());
......@@ -51,7 +51,7 @@ std::unique_ptr<zmq::message_t> SocketImpl::receive(bool blocking) {
return unique_ptr<zmq::message_t>(nullptr);
}
void SocketImpl::cancel() {
void StreamSocketImpl::cancel() {
if (m_cancelSocket.get() != nullptr) {
zmq::message_t requestType(CANCEL.length());
string data("cancel");
......@@ -63,7 +63,7 @@ void SocketImpl::cancel() {
}
}
void SocketImpl::close() {
void StreamSocketImpl::close() {
m_socket->close();
}
......
......@@ -14,8 +14,8 @@
* limitations under the Licence.
*/
#ifndef CAMEO_SOCKETIMPL_H_
#define CAMEO_SOCKETIMPL_H_
#ifndef CAMEO_STREAMSOCKETIMPL_H_
#define CAMEO_STREAMSOCKETIMPL_H_
#include <string>
#include <memory>
......@@ -23,11 +23,11 @@
namespace cameo {
class SocketImpl {
class StreamSocketImpl {
public:
SocketImpl(zmq::socket_t * socket, zmq::socket_t * cancelSocket = nullptr);
virtual ~SocketImpl();
StreamSocketImpl(zmq::socket_t * socket, zmq::socket_t * cancelSocket = nullptr);
virtual ~StreamSocketImpl();
void send(const std::string& data);
std::unique_ptr<zmq::message_t> receive(bool blocking = true);
......
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