[DEV] update sharedPtr
This commit is contained in:
parent
7a9ef2f4f7
commit
8fb622717b
@ -124,8 +124,8 @@ namespace zeus {
|
|||||||
* @param[in] _obj Call object
|
* @param[in] _obj Call object
|
||||||
* @param[in] _class Pointer on the object that might be call (note: brut cast)
|
* @param[in] _class Pointer on the object that might be call (note: brut cast)
|
||||||
*/
|
*/
|
||||||
virtual void execute(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
virtual void execute(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferCall>& _obj,
|
ememory::SharedPtr<zeus::BufferCall> _obj,
|
||||||
void* _class=nullptr) = 0;
|
void* _class=nullptr) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@ namespace zeus {
|
|||||||
* @param[in] _func pointer on the function to call
|
* @param[in] _func pointer on the function to call
|
||||||
*/
|
*/
|
||||||
template <class ZEUS_CLASS_TYPE, class ZEUS_RETURN, class... ZEUS_TYPES>
|
template <class ZEUS_CLASS_TYPE, class ZEUS_RETURN, class... ZEUS_TYPES>
|
||||||
void executeClassCall(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
void executeClassCall(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferParameter>& _obj,
|
ememory::SharedPtr<zeus::BufferParameter> _obj,
|
||||||
ZEUS_CLASS_TYPE* _pointer,
|
ZEUS_CLASS_TYPE* _pointer,
|
||||||
ZEUS_RETURN (ZEUS_CLASS_TYPE::*_func)(ZEUS_TYPES...)) {
|
ZEUS_RETURN (ZEUS_CLASS_TYPE::*_func)(ZEUS_TYPES...)) {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
@ -53,8 +53,8 @@ namespace zeus {
|
|||||||
* @param[in] _func pointer on the function to call
|
* @param[in] _func pointer on the function to call
|
||||||
*/
|
*/
|
||||||
template <class ZEUS_CLASS_TYPE, class... ZEUS_TYPES>
|
template <class ZEUS_CLASS_TYPE, class... ZEUS_TYPES>
|
||||||
void executeClassCall(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
void executeClassCall(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferParameter>& _obj,
|
ememory::SharedPtr<zeus::BufferParameter> _obj,
|
||||||
ZEUS_CLASS_TYPE* _pointer,
|
ZEUS_CLASS_TYPE* _pointer,
|
||||||
void (ZEUS_CLASS_TYPE::*_func)(ZEUS_TYPES...)) {
|
void (ZEUS_CLASS_TYPE::*_func)(ZEUS_TYPES...)) {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
@ -107,8 +107,8 @@ namespace zeus {
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
void execute(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
void execute(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferCall>& _obj,
|
ememory::SharedPtr<zeus::BufferCall> _obj,
|
||||||
void* _class) override {
|
void* _class) override {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
@ -16,8 +16,8 @@ namespace zeus {
|
|||||||
* @param[in] _func pointer on the function to call
|
* @param[in] _func pointer on the function to call
|
||||||
*/
|
*/
|
||||||
template <class ZEUS_RETURN, class... ZEUS_TYPES>
|
template <class ZEUS_RETURN, class... ZEUS_TYPES>
|
||||||
void executeCall(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
void executeCall(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferParameter>& _obj,
|
ememory::SharedPtr<zeus::BufferParameter> _obj,
|
||||||
ZEUS_RETURN (*_func)(ZEUS_TYPES...)) {
|
ZEUS_RETURN (*_func)(ZEUS_TYPES...)) {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
@ -45,8 +45,8 @@ namespace zeus {
|
|||||||
* @param[in] _func pointer on the function to call
|
* @param[in] _func pointer on the function to call
|
||||||
*/
|
*/
|
||||||
template <class... ZEUS_TYPES>
|
template <class... ZEUS_TYPES>
|
||||||
void executeCall(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
void executeCall(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferParameter>& _obj,
|
ememory::SharedPtr<zeus::BufferParameter> _obj,
|
||||||
void (*_func)(ZEUS_TYPES...)) {
|
void (*_func)(ZEUS_TYPES...)) {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
@ -98,8 +98,8 @@ namespace zeus {
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
void execute(const ememory::SharedPtr<zeus::WebServer>& _interfaceClient,
|
void execute(ememory::SharedPtr<zeus::WebServer> _interfaceClient,
|
||||||
const ememory::SharedPtr<zeus::BufferCall>& _obj,
|
ememory::SharedPtr<zeus::BufferCall> _obj,
|
||||||
void* _class) override {
|
void* _class) override {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
@ -58,11 +58,11 @@ zeus::Buffer::Buffer() {
|
|||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::Buffer::appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) {
|
void zeus::Buffer::appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) {
|
||||||
ZEUS_ERROR("Can not append datas ... Not managed");
|
ZEUS_ERROR("Can not append datas ... Not managed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::Buffer::appendBuffer(const ememory::SharedPtr<zeus::Buffer>& _obj) {
|
void zeus::Buffer::appendBuffer(ememory::SharedPtr<zeus::Buffer> _obj) {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ void zeus::Buffer::clear() {
|
|||||||
m_header.flags = ZEUS_BUFFER_FLAG_FINISH;
|
m_header.flags = ZEUS_BUFFER_FLAG_FINISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& zeus::operator <<(std::ostream& _os, zeus::Buffer* _obj) {
|
std::ostream& zeus::operator <<(std::ostream& _os, ememory::SharedPtr<zeus::Buffer> _obj) {
|
||||||
_os << "zeus::Buffer: ";
|
_os << "zeus::Buffer: ";
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
_os << "nullptr";
|
_os << "nullptr";
|
||||||
|
@ -152,8 +152,8 @@ namespace zeus {
|
|||||||
* @brief When multiple frame buffer, they need to concatenate the data... call this function with the new data to append it ...
|
* @brief When multiple frame buffer, they need to concatenate the data... call this function with the new data to append it ...
|
||||||
* @param[in] _obj Buffer to add
|
* @param[in] _obj Buffer to add
|
||||||
*/
|
*/
|
||||||
void appendBuffer(const ememory::SharedPtr<zeus::Buffer>& _obj);
|
void appendBuffer(ememory::SharedPtr<zeus::Buffer> _obj);
|
||||||
virtual void appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj);
|
virtual void appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief When receive new data form websocket, it might be added by this input (set all the frame ...)
|
* @brief When receive new data form websocket, it might be added by this input (set all the frame ...)
|
||||||
@ -247,7 +247,7 @@ namespace zeus {
|
|||||||
* @value[in] _obj Buffer to display
|
* @value[in] _obj Buffer to display
|
||||||
* @return a reference of the stream
|
* @return a reference of the stream
|
||||||
*/
|
*/
|
||||||
std::ostream& operator <<(std::ostream& _os, zeus::Buffer* _obj);
|
std::ostream& operator <<(std::ostream& _os, ememory::SharedPtr<zeus::Buffer> _obj);
|
||||||
|
|
||||||
// internal:
|
// internal:
|
||||||
/**
|
/**
|
||||||
|
@ -22,15 +22,15 @@ void zeus::BufferAnswer::generateDisplay(std::ostream& _os) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zeus::BufferAnswer::hasError() {
|
bool zeus::BufferAnswer::hasError() const {
|
||||||
return m_errorType.size() != 0;
|
return m_errorType.size() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& zeus::BufferAnswer::getError() {
|
const std::string& zeus::BufferAnswer::getError() const {
|
||||||
return m_errorType;
|
return m_errorType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& zeus::BufferAnswer::getErrorHelp() {
|
const std::string& zeus::BufferAnswer::getErrorHelp() const {
|
||||||
return m_errorHelp;
|
return m_errorHelp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void zeus::BufferAnswer::composeWith(const uint8_t* _buffer, uint32_t _lenght) {
|
|||||||
BufferParameter::composeWith(&_buffer[pos], _lenght-pos);
|
BufferParameter::composeWith(&_buffer[pos], _lenght-pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::BufferAnswer::appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) {
|
void zeus::BufferAnswer::appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) {
|
||||||
parameterAppendBufferData(_obj);
|
parameterAppendBufferData(_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace zeus {
|
|||||||
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::answer);
|
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::answer);
|
||||||
};
|
};
|
||||||
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
||||||
void appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) override;
|
void appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) override;
|
||||||
bool writeOn(enet::WebSocket& _interface) override;
|
bool writeOn(enet::WebSocket& _interface) override;
|
||||||
void generateDisplay(std::ostream& _os) const override;
|
void generateDisplay(std::ostream& _os) const override;
|
||||||
public:
|
public:
|
||||||
@ -65,16 +65,16 @@ namespace zeus {
|
|||||||
* @brief Check if the answer have an error
|
* @brief Check if the answer have an error
|
||||||
* @return status of the error.
|
* @return status of the error.
|
||||||
*/
|
*/
|
||||||
bool hasError();
|
bool hasError() const;
|
||||||
/**
|
/**
|
||||||
* @brief get the error value (if exist)
|
* @brief get the error value (if exist)
|
||||||
* @return string of the error
|
* @return string of the error
|
||||||
*/
|
*/
|
||||||
const std::string& getError();
|
const std::string& getError() const;
|
||||||
/**
|
/**
|
||||||
* @brief get the error help (if exist)
|
* @brief get the error help (if exist)
|
||||||
* @return string of the error help
|
* @return string of the error help
|
||||||
*/
|
*/
|
||||||
const std::string& getErrorHelp();
|
const std::string& getErrorHelp() const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ void zeus::BufferCall::composeWith(const uint8_t* _buffer, uint32_t _lenght) {
|
|||||||
BufferParameter::composeWith(&_buffer[pos], _lenght-pos);
|
BufferParameter::composeWith(&_buffer[pos], _lenght-pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::BufferCall::appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) {
|
void zeus::BufferCall::appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) {
|
||||||
parameterAppendBufferData(_obj);
|
parameterAppendBufferData(_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace zeus {
|
|||||||
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::call);
|
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::call);
|
||||||
};
|
};
|
||||||
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
||||||
void appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) override;
|
void appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) override;
|
||||||
bool writeOn(enet::WebSocket& _interface) override;
|
bool writeOn(enet::WebSocket& _interface) override;
|
||||||
void generateDisplay(std::ostream& _os) const override;
|
void generateDisplay(std::ostream& _os) const override;
|
||||||
public:
|
public:
|
||||||
|
@ -27,7 +27,7 @@ namespace zeus {
|
|||||||
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::data);
|
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::data);
|
||||||
};
|
};
|
||||||
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
||||||
// TODO :... void appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) override;
|
// TODO :... void appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) override;
|
||||||
bool writeOn(enet::WebSocket& _interface) override;
|
bool writeOn(enet::WebSocket& _interface) override;
|
||||||
void generateDisplay(std::ostream& _os) const override;
|
void generateDisplay(std::ostream& _os) const override;
|
||||||
public:
|
public:
|
||||||
|
@ -22,7 +22,7 @@ namespace zeus {
|
|||||||
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::event);
|
m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::event);
|
||||||
};
|
};
|
||||||
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
void composeWith(const uint8_t* _buffer, uint32_t _lenght) override;
|
||||||
void appendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) override;
|
void appendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) override;
|
||||||
public:
|
public:
|
||||||
/ **
|
/ **
|
||||||
* @brief Create a shared pointer on the BufferEvent
|
* @brief Create a shared pointer on the BufferEvent
|
||||||
|
@ -156,7 +156,7 @@ std::string zeus::BufferParameter::simpleStringParam(uint32_t _id) const {
|
|||||||
return paramType.getName();
|
return paramType.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::BufferParameter::parameterAppendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj) {
|
void zeus::BufferParameter::parameterAppendBufferData(ememory::SharedPtr<zeus::BufferData> _obj) {
|
||||||
// At this point we just add data at the parameter value:
|
// At this point we just add data at the parameter value:
|
||||||
uint16_t parameterID = _obj->getParameterId();
|
uint16_t parameterID = _obj->getParameterId();
|
||||||
|
|
||||||
|
@ -74,6 +74,6 @@ namespace zeus {
|
|||||||
void addParameter(const ZEUS_TYPE_DATA& _value) {
|
void addParameter(const ZEUS_TYPE_DATA& _value) {
|
||||||
addParameter(m_parameter.size(), _value);
|
addParameter(m_parameter.size(), _value);
|
||||||
}
|
}
|
||||||
void parameterAppendBufferData(const ememory::SharedPtr<zeus::BufferData>& _obj);
|
void parameterAppendBufferData(ememory::SharedPtr<zeus::BufferData> _obj);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ zeus::Client::~Client() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::Client::onClientData(const ememory::SharedPtr<zeus::Buffer>& _value) {
|
void zeus::Client::onClientData(ememory::SharedPtr<zeus::Buffer> _value) {
|
||||||
if (_value == nullptr) {
|
if (_value == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace zeus {
|
|||||||
* @brief When receive data from the websocket ... call this ...
|
* @brief When receive data from the websocket ... call this ...
|
||||||
* @param[in] _value New input buffer
|
* @param[in] _value New input buffer
|
||||||
*/
|
*/
|
||||||
void onClientData(const ememory::SharedPtr<zeus::Buffer>& _value);
|
void onClientData(ememory::SharedPtr<zeus::Buffer> _value);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Create a call on the interface gateway
|
* @brief Create a call on the interface gateway
|
||||||
|
@ -36,7 +36,7 @@ ememory::SharedPtr<zeus::Buffer> zeus::FutureBase::getRaw() {
|
|||||||
return m_data->m_returnData;
|
return m_data->m_returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
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, ememory::SharedPtr<zeus::Buffer> _returnData, zeus::FutureData::ObserverFinish _callback, uint32_t _clientId) {
|
||||||
m_data = ememory::makeShared<zeus::FutureData>();
|
m_data = ememory::makeShared<zeus::FutureData>();
|
||||||
if (m_data == nullptr) {
|
if (m_data == nullptr) {
|
||||||
return;
|
return;
|
||||||
@ -69,7 +69,7 @@ zeus::FutureBase zeus::FutureBase::operator= (const zeus::FutureBase& _base) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zeus::FutureBase::appendData(const ememory::SharedPtr<zeus::Buffer>& _value) {
|
bool zeus::FutureBase::appendData(ememory::SharedPtr<zeus::Buffer> _value) {
|
||||||
if (m_data == nullptr) {
|
if (m_data == nullptr) {
|
||||||
ZEUS_ERROR(" Not a valid future ...");
|
ZEUS_ERROR(" Not a valid future ...");
|
||||||
return true;
|
return true;
|
||||||
@ -129,7 +129,7 @@ bool zeus::FutureBase::hasError() const {
|
|||||||
if (m_data->m_returnData->getType() != zeus::Buffer::typeMessage::answer) {
|
if (m_data->m_returnData->getType() != zeus::Buffer::typeMessage::answer) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return static_cast<zeus::BufferAnswer*>(m_data->m_returnData.get())->hasError();
|
return static_cast<const zeus::BufferAnswer*>(m_data->m_returnData.get())->hasError();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string zeus::FutureBase::getErrorType() const {
|
std::string zeus::FutureBase::getErrorType() const {
|
||||||
@ -140,7 +140,7 @@ std::string zeus::FutureBase::getErrorType() const {
|
|||||||
if (m_data->m_returnData->getType() != zeus::Buffer::typeMessage::answer) {
|
if (m_data->m_returnData->getType() != zeus::Buffer::typeMessage::answer) {
|
||||||
return "NOT_ANSWER_MESSAGE";
|
return "NOT_ANSWER_MESSAGE";
|
||||||
}
|
}
|
||||||
return static_cast<zeus::BufferAnswer*>(m_data->m_returnData.get())->getError();
|
return static_cast<const zeus::BufferAnswer*>(m_data->m_returnData.get())->getError();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string zeus::FutureBase::getErrorHelp() const {
|
std::string zeus::FutureBase::getErrorHelp() const {
|
||||||
@ -151,7 +151,7 @@ std::string zeus::FutureBase::getErrorHelp() const {
|
|||||||
if (m_data->m_returnData->getType() != zeus::Buffer::typeMessage::answer) {
|
if (m_data->m_returnData->getType() != zeus::Buffer::typeMessage::answer) {
|
||||||
return "This answer is not a anwser type";
|
return "This answer is not a anwser type";
|
||||||
}
|
}
|
||||||
return static_cast<zeus::BufferAnswer*>(m_data->m_returnData.get())->getErrorHelp();
|
return static_cast<const zeus::BufferAnswer*>(m_data->m_returnData.get())->getErrorHelp();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool zeus::FutureBase::isValid() const {
|
bool zeus::FutureBase::isValid() const {
|
||||||
|
@ -39,7 +39,7 @@ namespace zeus {
|
|||||||
* @param[in] _callback Observer pointer
|
* @param[in] _callback Observer pointer
|
||||||
* @param[in] _clientId Client/sevice Id waiting answer
|
* @param[in] _clientId Client/sevice Id waiting answer
|
||||||
*/
|
*/
|
||||||
FutureBase(uint32_t _transactionId, const ememory::SharedPtr<zeus::Buffer>& _returnData, zeus::FutureData::ObserverFinish _callback=nullptr, uint32_t _clientId=0);
|
FutureBase(uint32_t _transactionId, ememory::SharedPtr<zeus::Buffer> _returnData, zeus::FutureData::ObserverFinish _callback=nullptr, uint32_t _clientId=0);
|
||||||
/**
|
/**
|
||||||
* @brief Asignement operator with an other future
|
* @brief Asignement operator with an other future
|
||||||
* @param[in] _base Generic base Future
|
* @param[in] _base Generic base Future
|
||||||
@ -51,7 +51,7 @@ namespace zeus {
|
|||||||
* @param[in] _returnValue Returned buffer
|
* @param[in] _returnValue Returned buffer
|
||||||
* @return return true if an error occured
|
* @return return true if an error occured
|
||||||
*/
|
*/
|
||||||
bool appendData(const ememory::SharedPtr<zeus::Buffer>& _returnValue);
|
bool appendData(ememory::SharedPtr<zeus::Buffer> _returnValue);
|
||||||
/**
|
/**
|
||||||
* @brief Set the future syncronous
|
* @brief Set the future syncronous
|
||||||
* @note this mean that the system call the observer every time a packet arrive in the Future
|
* @note this mean that the system call the observer every time a packet arrive in the Future
|
||||||
|
@ -31,7 +31,7 @@ std::vector<std::string> zeus::Service::getExtention() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void zeus::Service::onClientData(const ememory::SharedPtr<zeus::Buffer>& _value) {
|
void zeus::Service::onClientData(ememory::SharedPtr<zeus::Buffer> _value) {
|
||||||
if (_value == nullptr) {
|
if (_value == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ void zeus::Service::pingIsAlive() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::Service::callBinary(const ememory::SharedPtr<zeus::Buffer>& _obj) {
|
void zeus::Service::callBinary(ememory::SharedPtr<zeus::Buffer> _obj) {
|
||||||
if (_obj == nullptr) {
|
if (_obj == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ namespace zeus {
|
|||||||
* @param[in]
|
* @param[in]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void onClientData(const ememory::SharedPtr<zeus::Buffer>& _value);
|
void onClientData(ememory::SharedPtr<zeus::Buffer> _value);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -184,13 +184,13 @@ namespace zeus {
|
|||||||
* @param[in]
|
* @param[in]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void callBinary(const ememory::SharedPtr<zeus::Buffer>& _obj);
|
void callBinary(ememory::SharedPtr<zeus::Buffer> _obj);
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* @param[in]
|
* @param[in]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual void callBinary2(const std::string& _call, const ememory::SharedPtr<zeus::BufferCall>& _obj) = 0;
|
virtual void callBinary2(const std::string& _call, ememory::SharedPtr<zeus::BufferCall> _obj) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* @param[in]
|
* @param[in]
|
||||||
@ -361,7 +361,7 @@ namespace zeus {
|
|||||||
* @param[in]
|
* @param[in]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void callBinary2(const std::string& _call, const ememory::SharedPtr<zeus::BufferCall>& _obj) {
|
void callBinary2(const std::string& _call, ememory::SharedPtr<zeus::BufferCall> _obj) {
|
||||||
auto it = m_interface.find(_obj->getClientId());
|
auto it = m_interface.find(_obj->getClientId());
|
||||||
if (it == m_interface.end()) {
|
if (it == m_interface.end()) {
|
||||||
m_interfaceClient->answerError(_obj->getTransactionId(), "CLIENT-UNKNOW", "", _obj->getClientId());
|
m_interfaceClient->answerError(_obj->getTransactionId(), "CLIENT-UNKNOW", "", _obj->getClientId());
|
||||||
|
@ -21,7 +21,7 @@ ememory::SharedPtr<zeus::BufferCall> zeus::createBaseCall(uint64_t _transactionI
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::createParam(int32_t _paramId, const ememory::SharedPtr<zeus::BufferCall>& _obj) {
|
void zeus::createParam(int32_t _paramId, ememory::SharedPtr<zeus::BufferCall> _obj) {
|
||||||
// Finish recursive parse ...
|
// Finish recursive parse ...
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ class SendAsyncBinary {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t zeus::WebServer::writeBinary(const ememory::SharedPtr<zeus::Buffer>& _obj) {
|
int32_t zeus::WebServer::writeBinary(ememory::SharedPtr<zeus::Buffer> _obj) {
|
||||||
if (m_connection.isAlive() == false) {
|
if (m_connection.isAlive() == false) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ void zeus::WebServer::ping() {
|
|||||||
m_connection.controlPing();
|
m_connection.controlPing();
|
||||||
}
|
}
|
||||||
|
|
||||||
void zeus::WebServer::newBuffer(const ememory::SharedPtr<zeus::Buffer>& _buffer) {
|
void zeus::WebServer::newBuffer(ememory::SharedPtr<zeus::Buffer> _buffer) {
|
||||||
ZEUS_VERBOSE("Receive :" << _buffer);
|
ZEUS_VERBOSE("Receive :" << _buffer);
|
||||||
zeus::FutureBase future;
|
zeus::FutureBase future;
|
||||||
uint64_t tid = _buffer->getTransactionId();
|
uint64_t tid = _buffer->getTransactionId();
|
||||||
@ -301,7 +301,7 @@ void zeus::WebServer::threadAsyncCallback() {
|
|||||||
|
|
||||||
|
|
||||||
zeus::FutureBase zeus::WebServer::callBinary(uint64_t _transactionId,
|
zeus::FutureBase zeus::WebServer::callBinary(uint64_t _transactionId,
|
||||||
const ememory::SharedPtr<zeus::Buffer>& _obj,
|
ememory::SharedPtr<zeus::Buffer> _obj,
|
||||||
zeus::FutureData::ObserverFinish _callback,
|
zeus::FutureData::ObserverFinish _callback,
|
||||||
const uint32_t& _serviceId) {
|
const uint32_t& _serviceId) {
|
||||||
if (isActive() == false) {
|
if (isActive() == false) {
|
||||||
@ -320,7 +320,7 @@ zeus::FutureBase zeus::WebServer::callBinary(uint64_t _transactionId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
zeus::FutureBase zeus::WebServer::callForward(uint32_t _clientId,
|
zeus::FutureBase zeus::WebServer::callForward(uint32_t _clientId,
|
||||||
const ememory::SharedPtr<zeus::Buffer>& _buffer,
|
ememory::SharedPtr<zeus::Buffer> _buffer,
|
||||||
uint64_t _singleReferenceId,
|
uint64_t _singleReferenceId,
|
||||||
zeus::FutureData::ObserverFinish _callback) {
|
zeus::FutureData::ObserverFinish _callback) {
|
||||||
//zeus::FutureBase ret = callBinary(id, _Buffer, async, _callback);
|
//zeus::FutureBase ret = callBinary(id, _Buffer, async, _callback);
|
||||||
@ -345,7 +345,7 @@ zeus::FutureBase zeus::WebServer::callForward(uint32_t _clientId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void zeus::WebServer::callForwardMultiple(uint32_t _clientId,
|
void zeus::WebServer::callForwardMultiple(uint32_t _clientId,
|
||||||
const ememory::SharedPtr<zeus::Buffer>& _buffer,
|
ememory::SharedPtr<zeus::Buffer> _buffer,
|
||||||
uint64_t _singleReferenceId){
|
uint64_t _singleReferenceId){
|
||||||
if (_buffer == nullptr) {
|
if (_buffer == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
@ -25,7 +25,7 @@ namespace zeus {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void createParam(int32_t _paramId,
|
void createParam(int32_t _paramId,
|
||||||
const ememory::SharedPtr<zeus::BufferCall>& _obj);
|
ememory::SharedPtr<zeus::BufferCall> _obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -34,7 +34,7 @@ namespace zeus {
|
|||||||
*/
|
*/
|
||||||
template<class ZEUS_TYPE, class... _ARGS>
|
template<class ZEUS_TYPE, class... _ARGS>
|
||||||
void createParam(int32_t _paramId,
|
void createParam(int32_t _paramId,
|
||||||
const ememory::SharedPtr<zeus::BufferCall>& _obj,
|
ememory::SharedPtr<zeus::BufferCall> _obj,
|
||||||
const ZEUS_TYPE& _param,
|
const ZEUS_TYPE& _param,
|
||||||
_ARGS&&... _args) {
|
_ARGS&&... _args) {
|
||||||
_obj->addParameter<ZEUS_TYPE>(_param);
|
_obj->addParameter<ZEUS_TYPE>(_param);
|
||||||
@ -49,7 +49,7 @@ namespace zeus {
|
|||||||
// convert const char in std::string ...
|
// convert const char in std::string ...
|
||||||
template<class... _ARGS>
|
template<class... _ARGS>
|
||||||
void createParam(int32_t _paramId,
|
void createParam(int32_t _paramId,
|
||||||
const ememory::SharedPtr<zeus::BufferCall>& _obj,
|
ememory::SharedPtr<zeus::BufferCall> _obj,
|
||||||
const char* _param,
|
const char* _param,
|
||||||
_ARGS&&... _args) {
|
_ARGS&&... _args) {
|
||||||
createParam(_paramId, _obj, std::string(_param), std::forward<_ARGS>(_args)...);
|
createParam(_paramId, _obj, std::string(_param), std::forward<_ARGS>(_args)...);
|
||||||
@ -97,7 +97,7 @@ namespace zeus {
|
|||||||
std::mutex m_pendingCallMutex;
|
std::mutex m_pendingCallMutex;
|
||||||
std::vector<std::pair<uint64_t, zeus::FutureBase>> m_pendingCall;
|
std::vector<std::pair<uint64_t, zeus::FutureBase>> m_pendingCall;
|
||||||
public:
|
public:
|
||||||
using Observer = std::function<void(const ememory::SharedPtr<zeus::Buffer>&)>; //!< Define an Observer: function pointer
|
using Observer = std::function<void(ememory::SharedPtr<zeus::Buffer>)>; //!< Define an Observer: function pointer
|
||||||
Observer m_observerElement;
|
Observer m_observerElement;
|
||||||
/**
|
/**
|
||||||
* @brief Connect an function member on the signal with the shared_ptr object.
|
* @brief Connect an function member on the signal with the shared_ptr object.
|
||||||
@ -105,8 +105,8 @@ namespace zeus {
|
|||||||
* @param[in] _func Function to call.
|
* @param[in] _func Function to call.
|
||||||
*/
|
*/
|
||||||
template<class CLASS_TYPE>
|
template<class CLASS_TYPE>
|
||||||
void connect(CLASS_TYPE* _class, void (CLASS_TYPE::*_func)(const ememory::SharedPtr<zeus::Buffer>&)) {
|
void connect(CLASS_TYPE* _class, void (CLASS_TYPE::*_func)(ememory::SharedPtr<zeus::Buffer>)) {
|
||||||
m_observerElement = [=](const ememory::SharedPtr<zeus::Buffer>& _value){
|
m_observerElement = [=](ememory::SharedPtr<zeus::Buffer> _value){
|
||||||
(*_class.*_func)(_value);
|
(*_class.*_func)(_value);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ namespace zeus {
|
|||||||
* @param[in]
|
* @param[in]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int32_t writeBinary(const ememory::SharedPtr<zeus::Buffer>& _data);
|
int32_t writeBinary(ememory::SharedPtr<zeus::Buffer> _data);
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
* @param[in]
|
* @param[in]
|
||||||
@ -188,7 +188,7 @@ namespace zeus {
|
|||||||
* @param[in]
|
* @param[in]
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void newBuffer(const ememory::SharedPtr<zeus::Buffer>& _buffer);
|
void newBuffer(ememory::SharedPtr<zeus::Buffer> _buffer);
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -234,7 +234,7 @@ namespace zeus {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
zeus::FutureBase callBinary(uint64_t _transactionId,
|
zeus::FutureBase callBinary(uint64_t _transactionId,
|
||||||
const ememory::SharedPtr<zeus::Buffer>& _obj,
|
ememory::SharedPtr<zeus::Buffer> _obj,
|
||||||
zeus::FutureData::ObserverFinish _callback=nullptr,
|
zeus::FutureData::ObserverFinish _callback=nullptr,
|
||||||
const uint32_t& _service=0);
|
const uint32_t& _service=0);
|
||||||
public: // section call direct
|
public: // section call direct
|
||||||
@ -313,7 +313,7 @@ namespace zeus {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
zeus::FutureBase callForward(uint32_t _clientId,
|
zeus::FutureBase callForward(uint32_t _clientId,
|
||||||
const ememory::SharedPtr<zeus::Buffer>& _Buffer,
|
ememory::SharedPtr<zeus::Buffer> _Buffer,
|
||||||
uint64_t _singleReferenceId,
|
uint64_t _singleReferenceId,
|
||||||
zeus::FutureData::ObserverFinish _callback);
|
zeus::FutureData::ObserverFinish _callback);
|
||||||
/**
|
/**
|
||||||
@ -322,7 +322,7 @@ namespace zeus {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void callForwardMultiple(uint32_t _clientId,
|
void callForwardMultiple(uint32_t _clientId,
|
||||||
const ememory::SharedPtr<zeus::Buffer>& _Buffer,
|
ememory::SharedPtr<zeus::Buffer> _Buffer,
|
||||||
uint64_t _singleReferenceId);
|
uint64_t _singleReferenceId);
|
||||||
public: // answers ...
|
public: // answers ...
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user