Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Shervin Nourbakhsh
cameo
Commits
27eb4eb9
Commit
27eb4eb9
authored
Mar 05, 2020
by
legoc
Browse files
Renamed createRequest() into createRequestType()
parent
ea2992a0
Changes
11
Hide whitespace changes
Inline
Side-by-side
cameo-api-cpp/src/cameo/Application.cpp
View file @
27eb4eb9
...
...
@@ -264,7 +264,7 @@ void This::cancelWaitings() {
int
This
::
initUnmanagedApplication
()
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_STARTEDUNMANAGED
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_STARTEDUNMANAGED
);
string
strRequestData
=
m_impl
->
createStartedUnmanagedRequest
(
m_name
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -276,7 +276,7 @@ int This::initUnmanagedApplication() {
void
This
::
terminateUnmanagedApplication
()
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_TERMINATEDUNMANAGED
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_TERMINATEDUNMANAGED
);
string
strRequestData
=
m_impl
->
createTerminatedUnmanagedRequest
(
m_id
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -286,7 +286,7 @@ void This::terminateUnmanagedApplication() {
bool
This
::
setRunning
()
{
string
strRequestType
=
m_instance
.
m_impl
->
createRequest
(
PROTO_SETSTATUS
);
string
strRequestType
=
m_instance
.
m_impl
->
createRequest
Type
(
PROTO_SETSTATUS
);
string
strRequestData
=
m_instance
.
m_impl
->
createSetStatusRequest
(
m_instance
.
m_id
,
RUNNING
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_instance
.
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_instance
.
m_serverEndpoint
);
...
...
@@ -302,7 +302,7 @@ bool This::setRunning() {
void
This
::
setBinaryResult
(
const
std
::
string
&
data
)
{
string
strRequestType
=
m_instance
.
m_impl
->
createRequest
(
PROTO_SETRESULT
);
string
strRequestType
=
m_instance
.
m_impl
->
createRequest
Type
(
PROTO_SETRESULT
);
string
strRequestData
=
m_instance
.
m_impl
->
createSetResultRequest
(
m_instance
.
m_id
,
data
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_instance
.
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_instance
.
m_serverEndpoint
);
...
...
@@ -352,7 +352,7 @@ void This::setResult(const double* data, std::size_t size) {
State
This
::
getState
(
int
id
)
const
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_GETSTATUS
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_GETSTATUS
);
string
strRequestData
=
m_impl
->
createGetStatusRequest
(
id
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -364,7 +364,7 @@ State This::getState(int id) const {
bool
This
::
destroyPublisher
(
const
std
::
string
&
name
)
const
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_TERMINATEPUBLISHER
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_TERMINATEPUBLISHER
);
string
strRequestData
=
m_impl
->
createTerminatePublisherRequest
(
m_id
,
name
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -377,7 +377,7 @@ bool This::destroyPublisher(const std::string& name) const {
bool
This
::
removePort
(
const
std
::
string
&
name
)
const
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_REMOVEPORT
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_REMOVEPORT
);
string
strRequestData
=
m_impl
->
createRemovePortRequest
(
m_id
,
name
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -781,7 +781,7 @@ Publisher::~Publisher() {
std
::
unique_ptr
<
Publisher
>
Publisher
::
create
(
const
std
::
string
&
name
,
int
numberOfSubscribers
)
{
string
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
(
PROTO_CREATEPUBLISHER
);
string
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
Type
(
PROTO_CREATEPUBLISHER
);
string
strRequestData
=
This
::
m_instance
.
m_impl
->
createCreatePublisherRequest
(
This
::
m_instance
.
m_id
,
name
,
numberOfSubscribers
);
unique_ptr
<
zmq
::
message_t
>
reply
=
This
::
m_instance
.
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
This
::
m_instance
.
m_serverEndpoint
);
...
...
@@ -1043,7 +1043,7 @@ std::unique_ptr<Responder> Responder::create(const std::string& name) {
string
portName
=
ResponderImpl
::
RESPONDER_PREFIX
+
name
;
string
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
(
PROTO_REQUESTPORT
);
string
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
Type
(
PROTO_REQUESTPORT
);
string
strRequestData
=
This
::
m_instance
.
m_impl
->
createRequestPortRequest
(
This
::
m_instance
.
m_id
,
portName
);
unique_ptr
<
zmq
::
message_t
>
reply
=
This
::
m_instance
.
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
This
::
m_instance
.
m_serverEndpoint
);
...
...
@@ -1102,7 +1102,7 @@ std::unique_ptr<Requester> Requester::create(Instance & instance, const std::str
int
requesterId
=
RequesterImpl
::
newRequesterId
();
string
requesterPortName
=
RequesterImpl
::
getRequesterPortName
(
name
,
responderId
,
requesterId
);
string
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
(
PROTO_CONNECTPORT
);
string
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
Type
(
PROTO_CONNECTPORT
);
string
strRequestData
=
This
::
m_instance
.
m_impl
->
createConnectPortRequest
(
responderId
,
responderPortName
);
unique_ptr
<
zmq
::
message_t
>
reply
=
This
::
m_instance
.
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
responderEndpoint
);
...
...
@@ -1128,7 +1128,7 @@ std::unique_ptr<Requester> Requester::create(Instance & instance, const std::str
}
// Request a requester port
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
(
PROTO_REQUESTPORT
);
strRequestType
=
This
::
m_instance
.
m_impl
->
createRequest
Type
(
PROTO_REQUESTPORT
);
strRequestData
=
This
::
m_instance
.
m_impl
->
createRequestPortRequest
(
This
::
m_instance
.
m_id
,
requesterPortName
);
reply
=
This
::
m_instance
.
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
This
::
m_instance
.
m_serverEndpoint
);
...
...
cameo-api-cpp/src/cameo/Server.cpp
View file @
27eb4eb9
...
...
@@ -107,7 +107,7 @@ std::unique_ptr<application::Instance> Server::start(const std::string& name, Op
int
Server
::
getStreamPort
(
const
std
::
string
&
name
)
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_OUTPUT
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_OUTPUT
);
string
strRequestData
=
m_impl
->
createOutputRequest
(
name
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -136,7 +136,7 @@ std::unique_ptr<application::Instance> Server::start(const std::string& name, co
instance
->
setOutputStreamSocket
(
socket
);
}
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_START
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_START
);
string
strRequestData
=
m_impl
->
createStartRequest
(
name
,
args
,
application
::
This
::
getReference
());
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -163,10 +163,10 @@ Response Server::stopApplicationAsynchronously(int id, bool immediately) const {
string
strRequestData
;
if
(
immediately
)
{
strRequestType
=
m_impl
->
createRequest
(
PROTO_KILL
);
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_KILL
);
strRequestData
=
m_impl
->
createKillRequest
(
id
);
}
else
{
strRequestType
=
m_impl
->
createRequest
(
PROTO_STOP
);
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_STOP
);
strRequestData
=
m_impl
->
createStopRequest
(
id
);
}
...
...
@@ -184,7 +184,7 @@ application::InstanceArray Server::connectAll(const std::string& name, Option op
application
::
InstanceArray
instances
;
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_CONNECT
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_CONNECT
);
string
strRequestData
=
m_impl
->
createConnectRequest
(
name
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -266,7 +266,7 @@ void Server::killAllAndWaitFor(const std::string& name) {
bool
Server
::
isAlive
(
int
id
)
const
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_ISALIVE
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_ISALIVE
);
string
strRequestData
=
m_impl
->
createIsAliveRequest
(
id
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -280,7 +280,7 @@ std::vector<application::Configuration> Server::getApplicationConfigurations() c
vector
<
application
::
Configuration
>
configVector
;
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_ALLAVAILABLE
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_ALLAVAILABLE
);
string
strRequestData
=
m_impl
->
createAllAvailableRequest
();
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -308,7 +308,7 @@ std::vector<application::Info> Server::getApplicationInfos() const {
vector
<
application
::
Info
>
infoVector
;
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_SHOWALL
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_SHOWALL
);
string
strRequestData
=
m_impl
->
createShowAllRequest
();
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -352,7 +352,7 @@ std::unique_ptr<EventStreamSocket> Server::openEventStream() {
std
::
unique_ptr
<
application
::
Subscriber
>
Server
::
createSubscriber
(
int
id
,
const
std
::
string
&
publisherName
,
const
std
::
string
&
instanceName
)
const
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_CONNECTPUBLISHER
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_CONNECTPUBLISHER
);
string
strRequestData
=
m_impl
->
createConnectPublisherRequest
(
id
,
publisherName
);
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
cameo-api-cpp/src/cameo/Services.cpp
View file @
27eb4eb9
...
...
@@ -22,6 +22,7 @@
#include
"impl/CancelIdGenerator.h"
#include
"impl/ServicesImpl.h"
#include
"impl/StreamSocketImpl.h"
#include
"impl/RequestSocketImpl.h"
#include
"ProtoType.h"
using
namespace
std
;
...
...
@@ -88,7 +89,7 @@ const std::string& Services::getStatusEndpoint() const {
}
bool
Services
::
isAvailable
(
int
timeout
)
const
{
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_INIT
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_INIT
);
string
strRequestData
=
m_impl
->
createInitRequest
();
return
m_impl
->
isAvailable
(
strRequestType
,
strRequestData
,
m_serverEndpoint
,
timeout
);
}
...
...
@@ -96,7 +97,7 @@ bool Services::isAvailable(int timeout) const {
void
Services
::
initStatus
()
{
// get the status port
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_STATUS
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_STATUS
);
string
strRequestData
=
m_impl
->
createShowStatusRequest
();
unique_ptr
<
zmq
::
message_t
>
reply
=
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
@@ -132,7 +133,7 @@ std::unique_ptr<EventStreamSocket> Services::openEventStream() {
zmq
::
socket_t
*
subscriber
=
m_impl
->
createEventSubscriber
(
m_serverStatusEndpoint
,
cancelEndpoint
.
str
());
// wait for the connection
string
strRequestType
=
m_impl
->
createRequest
(
PROTO_INIT
);
string
strRequestType
=
m_impl
->
createRequest
Type
(
PROTO_INIT
);
string
strRequestData
=
m_impl
->
createInitRequest
();
m_impl
->
waitForSubscriber
(
subscriber
,
strRequestType
,
strRequestData
,
m_serverEndpoint
);
...
...
cameo-api-cpp/src/cameo/Services.h
View file @
27eb4eb9
...
...
@@ -21,11 +21,11 @@
#include
<vector>
#include
"EventStreamSocket.h"
#include
"OutputStreamSocket.h"
#include
"impl/RequestSocketImpl.h"
namespace
cameo
{
class
ServicesImpl
;
class
RequestSocketImpl
;
class
Services
{
...
...
cameo-api-cpp/src/cameo/impl/PublisherImpl.cpp
View file @
27eb4eb9
...
...
@@ -134,7 +134,7 @@ void PublisherImpl::cancelWaitForSubscribers() {
stringstream
endpoint
;
endpoint
<<
m_application
->
getUrl
()
<<
":"
<<
(
m_publisherPort
+
1
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
(
PROTO_CANCEL
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
Type
(
PROTO_CANCEL
);
string
strRequestData
;
proto
::
CancelPublisherSyncCommand
cancelPublisherSyncCommand
;
...
...
cameo-api-cpp/src/cameo/impl/RequestImpl.cpp
View file @
27eb4eb9
...
...
@@ -44,7 +44,7 @@ RequestImpl::~RequestImpl() {
}
void
RequestImpl
::
replyBinary
(
const
std
::
string
&
response
)
{
string
strRequestType
=
m_application
->
m_impl
->
createRequest
(
PROTO_RESPONSE
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
Type
(
PROTO_RESPONSE
);
m_application
->
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
response
,
m_requesterEndpoint
);
}
...
...
cameo-api-cpp/src/cameo/impl/RequesterImpl.cpp
View file @
27eb4eb9
...
...
@@ -74,7 +74,7 @@ WaitingImpl * RequesterImpl::waiting() {
void
RequesterImpl
::
sendBinary
(
const
std
::
string
&
request
)
{
string
strRequestType
=
m_application
->
m_impl
->
createRequest
(
PROTO_REQUEST
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
Type
(
PROTO_REQUEST
);
string
strRequestData
;
proto
::
Request
requestCommand
;
...
...
@@ -102,7 +102,7 @@ void RequesterImpl::send(const std::string& request) {
void
RequesterImpl
::
sendTwoBinaryParts
(
const
std
::
string
&
request1
,
const
std
::
string
&
request2
)
{
string
strRequestType
=
m_application
->
m_impl
->
createRequest
(
PROTO_REQUEST
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
Type
(
PROTO_REQUEST
);
string
strRequestData
;
proto
::
Request
requestCommand
;
...
...
@@ -172,7 +172,7 @@ void RequesterImpl::cancel() {
stringstream
requesterEndpoint
;
requesterEndpoint
<<
m_application
->
getUrl
()
<<
":"
<<
m_requesterPort
;
string
strRequestType
=
m_application
->
m_impl
->
createRequest
(
PROTO_CANCEL
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
Type
(
PROTO_CANCEL
);
string
strRequestData
=
"cancel"
;
unique_ptr
<
zmq
::
message_t
>
reply
=
m_application
->
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
requesterEndpoint
.
str
());
...
...
cameo-api-cpp/src/cameo/impl/ResponderImpl.cpp
View file @
27eb4eb9
...
...
@@ -50,7 +50,7 @@ void ResponderImpl::cancel() {
stringstream
endpoint
;
endpoint
<<
m_application
->
getUrl
()
<<
":"
<<
m_responderPort
;
string
strRequestType
=
m_application
->
m_impl
->
createRequest
(
PROTO_CANCEL
);
string
strRequestType
=
m_application
->
m_impl
->
createRequest
Type
(
PROTO_CANCEL
);
string
strRequestData
=
"cancel"
;
unique_ptr
<
zmq
::
message_t
>
reply
=
m_application
->
m_impl
->
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
endpoint
.
str
());
...
...
cameo-api-cpp/src/cameo/impl/ServicesImpl.cpp
View file @
27eb4eb9
...
...
@@ -74,7 +74,7 @@ std::string ServicesImpl::createInitRequest() const {
return
strRequestData
;
}
std
::
string
ServicesImpl
::
createRequest
(
ProtoType
type
)
const
{
std
::
string
ServicesImpl
::
createRequest
Type
(
ProtoType
type
)
const
{
proto
::
MessageType
messageType
;
messageType
.
set_type
(
convertToProtoType
(
type
));
std
::
string
strRequestType
;
...
...
@@ -432,7 +432,7 @@ void ServicesImpl::waitForSubscriber(zmq::socket_t * subscriber, const std::stri
void
ServicesImpl
::
subscribeToPublisher
(
const
std
::
string
&
endpoint
)
{
string
strRequestType
=
createRequest
(
PROTO_SUBSCRIBEPUBLISHER
);
string
strRequestType
=
createRequest
Type
(
PROTO_SUBSCRIBEPUBLISHER
);
string
strRequestData
=
createSubscribePublisherRequest
();
unique_ptr
<
zmq
::
message_t
>
reply
=
tryRequestWithOnePartReply
(
strRequestType
,
strRequestData
,
endpoint
);
...
...
cameo-api-cpp/src/cameo/impl/ServicesImpl.h
View file @
27eb4eb9
...
...
@@ -38,7 +38,7 @@ public:
void
waitForSubscriber
(
zmq
::
socket_t
*
subscriber
,
const
std
::
string
&
strRequestType
,
const
std
::
string
&
strRequestData
,
const
std
::
string
&
endpoint
);
void
subscribeToPublisher
(
const
std
::
string
&
endpoint
);
std
::
string
createRequest
(
ProtoType
type
)
const
;
std
::
string
createRequest
Type
(
ProtoType
type
)
const
;
std
::
string
createInitRequest
()
const
;
std
::
string
createStartRequest
(
const
std
::
string
&
name
,
const
std
::
vector
<
std
::
string
>
&
args
,
const
std
::
string
&
instanceReference
)
const
;
std
::
string
createStopRequest
(
int
id
)
const
;
...
...
cameo-api-cpp/src/cameo/impl/SubscriberImpl.cpp
View file @
27eb4eb9
...
...
@@ -98,7 +98,7 @@ void SubscriberImpl::init() {
while
(
!
ready
)
{
string
strRequestType
=
m_server
->
m_impl
->
createRequest
(
PROTO_INIT
);
string
strRequestType
=
m_server
->
m_impl
->
createRequest
Type
(
PROTO_INIT
);
string
strRequestData
=
m_server
->
m_impl
->
createInitRequest
();
m_server
->
m_impl
->
isAvailable
(
strRequestType
,
strRequestData
,
endpoint
,
100
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment