[DEV] update new ememory::SharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-15 21:22:11 +02:00
parent 39ee4f0343
commit 7a9ef2f4f7
10 changed files with 15 additions and 16 deletions

View File

@ -336,7 +336,6 @@ namespace appl {
APPL_WARNING("delete PictureService ...");
}
public:
std::vector<std::string> getAlbums() {
return m_user->getAlbums();
}

View File

@ -109,7 +109,7 @@ void appl::ClientInterface::onClientData(const ememory::SharedPtr<zeus::Buffer>&
answerProtocolError(transactionId, "missing parameter: 'call' / wrong type 'call'");
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();
switch (m_state) {
case appl::ClientInterface::state::disconnect:

View File

@ -67,14 +67,14 @@ namespace appl {
void appl::GateWay::newService(enet::Tcp _connection) {
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();
m_serviceList.push_back(tmp);
}
void appl::GateWay::newClient(enet::Tcp _connection) {
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++);
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),
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) {
m_interfaceClientServer = std::make_shared<appl::TcpServerInput>(this, false);
m_interfaceServiceServer = std::make_shared<appl::TcpServerInput>(this, true);
m_interfaceClientServer = ememory::makeShared<appl::TcpServerInput>(this, false);
m_interfaceServiceServer = ememory::makeShared<appl::TcpServerInput>(this, true);
}
appl::GateWay::~GateWay() {

View File

@ -75,7 +75,7 @@ void appl::ServiceInterface::onServiceData(const ememory::SharedPtr<zeus::Buffer
return;
}
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();
if (callFunction == "connect-service") {
if (m_name != "") {

View File

@ -74,7 +74,7 @@ void zeus::Buffer::appendBuffer(const ememory::SharedPtr<zeus::Buffer>& _obj) {
return;
}
setPartFinish(_obj->getPartFinish());
appendBufferData(std::static_pointer_cast<zeus::BufferData>(_obj));
appendBufferData(ememory::staticPointerCast<zeus::BufferData>(_obj));
}
bool zeus::Buffer::writeOn(enet::WebSocket& _interface) {

View File

@ -44,7 +44,7 @@ bool zeus::Client::connectTo(const std::string& _address) {
ZEUS_DEBUG("connect [START]");
disconnect();
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) {
ZEUS_ERROR("Allocate connection error");
return false;

View File

@ -18,7 +18,7 @@ zeus::FutureBase::FutureBase() {
}
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) {
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) {
m_data = std::make_shared<zeus::FutureData>();
m_data = ememory::makeShared<zeus::FutureData>();
if (m_data == nullptr) {
return;
}

View File

@ -85,7 +85,7 @@ void zeus::Service::connect(const std::string& _serviceName, uint32_t _numberRet
ZEUS_DEBUG("connect [STOP] ==> can not connect");
return;
}
m_interfaceClient = std::make_shared<zeus::WebServer>();
m_interfaceClient = ememory::makeShared<zeus::WebServer>();
if (m_interfaceClient == nullptr) {
ZEUS_ERROR("Can not allocate interface ...");
return;
@ -141,7 +141,7 @@ void zeus::Service::callBinary(const ememory::SharedPtr<zeus::Buffer>& _obj) {
return;
}
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();
std::string callFunction = callObj->getCall();
if (callFunction[0] == '_') {

View File

@ -301,8 +301,8 @@ namespace zeus {
ZEUS_DEBUG("connect: " << _clientId << " to '" << _userName << "'");
ZEUS_DEBUG(" client name='" << _clientName << "'");
ZEUS_DEBUG(" groups=" << etk::to_string(_groups));
ememory::SharedPtr<ClientProperty> tmpProperty = std::make_shared<ClientProperty>(_clientName, _groups);
ememory::SharedPtr<ZEUS_TYPE_SERVICE> tmpSrv = std::make_shared<ZEUS_TYPE_SERVICE>(m_getUserInterface.getUser(_userName), tmpProperty);
ememory::SharedPtr<ClientProperty> tmpProperty = ememory::makeShared<ClientProperty>(_clientName, _groups);
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)));
// enable list of function availlable:
for (auto &it : m_listFunction) {

View File

@ -8,7 +8,7 @@
#include <zeus/BufferAnswer.h>
#include <enet/WebSocket.h>
#include <thread>
#include <memory>
#include <ememory/memory.h>
#include <zeus/AbstractFunction.h>
#include <zeus/FutureBase.h>