[DEV] update new ememory::SharedPtr
This commit is contained in:
parent
39ee4f0343
commit
7a9ef2f4f7
@ -336,7 +336,6 @@ namespace appl {
|
|||||||
APPL_WARNING("delete PictureService ...");
|
APPL_WARNING("delete PictureService ...");
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
std::vector<std::string> getAlbums() {
|
std::vector<std::string> getAlbums() {
|
||||||
return m_user->getAlbums();
|
return m_user->getAlbums();
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ void appl::ClientInterface::onClientData(const ememory::SharedPtr<zeus::Buffer>&
|
|||||||
answerProtocolError(transactionId, "missing parameter: 'call' / wrong type 'call'");
|
answerProtocolError(transactionId, "missing parameter: 'call' / wrong type 'call'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ememory::SharedPtr<zeus::BufferCall> callObj = std::static_pointer_cast<zeus::BufferCall>(_value);
|
ememory::SharedPtr<zeus::BufferCall> callObj = ememory::staticPointerCast<zeus::BufferCall>(_value);
|
||||||
std::string callFunction = callObj->getCall();
|
std::string callFunction = callObj->getCall();
|
||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
case appl::ClientInterface::state::disconnect:
|
case appl::ClientInterface::state::disconnect:
|
||||||
|
@ -67,14 +67,14 @@ namespace appl {
|
|||||||
|
|
||||||
void appl::GateWay::newService(enet::Tcp _connection) {
|
void appl::GateWay::newService(enet::Tcp _connection) {
|
||||||
ZEUS_WARNING("New TCP connection (service)");
|
ZEUS_WARNING("New TCP connection (service)");
|
||||||
ememory::SharedPtr<appl::ServiceInterface> tmp = std::make_shared<appl::ServiceInterface>(std::move(_connection), this);
|
ememory::SharedPtr<appl::ServiceInterface> tmp = ememory::makeShared<appl::ServiceInterface>(std::move(_connection), this);
|
||||||
tmp->start();
|
tmp->start();
|
||||||
m_serviceList.push_back(tmp);
|
m_serviceList.push_back(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::GateWay::newClient(enet::Tcp _connection) {
|
void appl::GateWay::newClient(enet::Tcp _connection) {
|
||||||
ZEUS_WARNING("New TCP connection (client)");
|
ZEUS_WARNING("New TCP connection (client)");
|
||||||
ememory::SharedPtr<appl::ClientInterface> tmp = std::make_shared<appl::ClientInterface>(std::move(_connection), this);
|
ememory::SharedPtr<appl::ClientInterface> tmp = ememory::makeShared<appl::ClientInterface>(std::move(_connection), this);
|
||||||
tmp->start(m_clientUID++, m_clientUID++);
|
tmp->start(m_clientUID++, m_clientUID++);
|
||||||
m_clientList.push_back(tmp);
|
m_clientList.push_back(tmp);
|
||||||
}
|
}
|
||||||
@ -87,8 +87,8 @@ appl::GateWay::GateWay() :
|
|||||||
propertyServiceIp(this, "service-ip", "127.0.0.1", "Ip to listen client", &appl::GateWay::onPropertyChangeServiceIp),
|
propertyServiceIp(this, "service-ip", "127.0.0.1", "Ip to listen client", &appl::GateWay::onPropertyChangeServiceIp),
|
||||||
propertyServicePort(this, "service-port", 1982, "Port to listen client", &appl::GateWay::onPropertyChangeServicePort),
|
propertyServicePort(this, "service-port", 1982, "Port to listen client", &appl::GateWay::onPropertyChangeServicePort),
|
||||||
propertyServiceMax(this, "service-max", 80, "Maximum of client at the same time", &appl::GateWay::onPropertyChangeServiceMax) {
|
propertyServiceMax(this, "service-max", 80, "Maximum of client at the same time", &appl::GateWay::onPropertyChangeServiceMax) {
|
||||||
m_interfaceClientServer = std::make_shared<appl::TcpServerInput>(this, false);
|
m_interfaceClientServer = ememory::makeShared<appl::TcpServerInput>(this, false);
|
||||||
m_interfaceServiceServer = std::make_shared<appl::TcpServerInput>(this, true);
|
m_interfaceServiceServer = ememory::makeShared<appl::TcpServerInput>(this, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
appl::GateWay::~GateWay() {
|
appl::GateWay::~GateWay() {
|
||||||
|
@ -75,7 +75,7 @@ void appl::ServiceInterface::onServiceData(const ememory::SharedPtr<zeus::Buffer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_value->getType() == zeus::Buffer::typeMessage::call) {
|
if (_value->getType() == zeus::Buffer::typeMessage::call) {
|
||||||
ememory::SharedPtr<zeus::BufferCall> callObj = std::static_pointer_cast<zeus::BufferCall>(_value);
|
ememory::SharedPtr<zeus::BufferCall> callObj = ememory::staticPointerCast<zeus::BufferCall>(_value);
|
||||||
std::string callFunction = callObj->getCall();
|
std::string callFunction = callObj->getCall();
|
||||||
if (callFunction == "connect-service") {
|
if (callFunction == "connect-service") {
|
||||||
if (m_name != "") {
|
if (m_name != "") {
|
||||||
|
@ -74,7 +74,7 @@ void zeus::Buffer::appendBuffer(const ememory::SharedPtr<zeus::Buffer>& _obj) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setPartFinish(_obj->getPartFinish());
|
setPartFinish(_obj->getPartFinish());
|
||||||
appendBufferData(std::static_pointer_cast<zeus::BufferData>(_obj));
|
appendBufferData(ememory::staticPointerCast<zeus::BufferData>(_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zeus::Buffer::writeOn(enet::WebSocket& _interface) {
|
bool zeus::Buffer::writeOn(enet::WebSocket& _interface) {
|
||||||
|
@ -44,7 +44,7 @@ bool zeus::Client::connectTo(const std::string& _address) {
|
|||||||
ZEUS_DEBUG("connect [START]");
|
ZEUS_DEBUG("connect [START]");
|
||||||
disconnect();
|
disconnect();
|
||||||
enet::Tcp connection = std::move(enet::connectTcpClient(*propertyIp, *propertyPort));
|
enet::Tcp connection = std::move(enet::connectTcpClient(*propertyIp, *propertyPort));
|
||||||
m_interfaceClient = std::make_shared<zeus::WebServer>();
|
m_interfaceClient = ememory::makeShared<zeus::WebServer>();
|
||||||
if (m_interfaceClient == nullptr) {
|
if (m_interfaceClient == nullptr) {
|
||||||
ZEUS_ERROR("Allocate connection error");
|
ZEUS_ERROR("Allocate connection error");
|
||||||
return false;
|
return false;
|
||||||
|
@ -18,7 +18,7 @@ zeus::FutureBase::FutureBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zeus::FutureBase::FutureBase(uint32_t _transactionId, zeus::FutureData::ObserverFinish _callback, uint32_t _clientId) {
|
zeus::FutureBase::FutureBase(uint32_t _transactionId, zeus::FutureData::ObserverFinish _callback, uint32_t _clientId) {
|
||||||
m_data = std::make_shared<zeus::FutureData>();
|
m_data = ememory::makeShared<zeus::FutureData>();
|
||||||
if (m_data == nullptr) {
|
if (m_data == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ ememory::SharedPtr<zeus::Buffer> zeus::FutureBase::getRaw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zeus::FutureBase::FutureBase(uint32_t _transactionId, const ememory::SharedPtr<zeus::Buffer>& _returnData, zeus::FutureData::ObserverFinish _callback, uint32_t _clientId) {
|
zeus::FutureBase::FutureBase(uint32_t _transactionId, const ememory::SharedPtr<zeus::Buffer>& _returnData, zeus::FutureData::ObserverFinish _callback, uint32_t _clientId) {
|
||||||
m_data = std::make_shared<zeus::FutureData>();
|
m_data = ememory::makeShared<zeus::FutureData>();
|
||||||
if (m_data == nullptr) {
|
if (m_data == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ void zeus::Service::connect(const std::string& _serviceName, uint32_t _numberRet
|
|||||||
ZEUS_DEBUG("connect [STOP] ==> can not connect");
|
ZEUS_DEBUG("connect [STOP] ==> can not connect");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_interfaceClient = std::make_shared<zeus::WebServer>();
|
m_interfaceClient = ememory::makeShared<zeus::WebServer>();
|
||||||
if (m_interfaceClient == nullptr) {
|
if (m_interfaceClient == nullptr) {
|
||||||
ZEUS_ERROR("Can not allocate interface ...");
|
ZEUS_ERROR("Can not allocate interface ...");
|
||||||
return;
|
return;
|
||||||
@ -141,7 +141,7 @@ void zeus::Service::callBinary(const ememory::SharedPtr<zeus::Buffer>& _obj) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_obj->getType() == zeus::Buffer::typeMessage::call) {
|
if (_obj->getType() == zeus::Buffer::typeMessage::call) {
|
||||||
ememory::SharedPtr<zeus::BufferCall> callObj = std::static_pointer_cast<zeus::BufferCall>(_obj);
|
ememory::SharedPtr<zeus::BufferCall> callObj = ememory::staticPointerCast<zeus::BufferCall>(_obj);
|
||||||
uint32_t clientId = callObj->getClientId();
|
uint32_t clientId = callObj->getClientId();
|
||||||
std::string callFunction = callObj->getCall();
|
std::string callFunction = callObj->getCall();
|
||||||
if (callFunction[0] == '_') {
|
if (callFunction[0] == '_') {
|
||||||
|
@ -301,8 +301,8 @@ namespace zeus {
|
|||||||
ZEUS_DEBUG("connect: " << _clientId << " to '" << _userName << "'");
|
ZEUS_DEBUG("connect: " << _clientId << " to '" << _userName << "'");
|
||||||
ZEUS_DEBUG(" client name='" << _clientName << "'");
|
ZEUS_DEBUG(" client name='" << _clientName << "'");
|
||||||
ZEUS_DEBUG(" groups=" << etk::to_string(_groups));
|
ZEUS_DEBUG(" groups=" << etk::to_string(_groups));
|
||||||
ememory::SharedPtr<ClientProperty> tmpProperty = std::make_shared<ClientProperty>(_clientName, _groups);
|
ememory::SharedPtr<ClientProperty> tmpProperty = ememory::makeShared<ClientProperty>(_clientName, _groups);
|
||||||
ememory::SharedPtr<ZEUS_TYPE_SERVICE> tmpSrv = std::make_shared<ZEUS_TYPE_SERVICE>(m_getUserInterface.getUser(_userName), tmpProperty);
|
ememory::SharedPtr<ZEUS_TYPE_SERVICE> tmpSrv = ememory::makeShared<ZEUS_TYPE_SERVICE>(m_getUserInterface.getUser(_userName), tmpProperty);
|
||||||
m_interface.insert(std::make_pair(_clientId, std::make_pair(tmpProperty, tmpSrv)));
|
m_interface.insert(std::make_pair(_clientId, std::make_pair(tmpProperty, tmpSrv)));
|
||||||
// enable list of function availlable:
|
// enable list of function availlable:
|
||||||
for (auto &it : m_listFunction) {
|
for (auto &it : m_listFunction) {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <zeus/BufferAnswer.h>
|
#include <zeus/BufferAnswer.h>
|
||||||
#include <enet/WebSocket.h>
|
#include <enet/WebSocket.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <memory>
|
#include <ememory/memory.h>
|
||||||
#include <zeus/AbstractFunction.h>
|
#include <zeus/AbstractFunction.h>
|
||||||
#include <zeus/FutureBase.h>
|
#include <zeus/FutureBase.h>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user