From d13a2398784a0a70e6990fe4b2f6619e66980136 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 6 Dec 2016 21:14:11 +0100 Subject: [PATCH] [DEV] nearly finish the send and get file --- lutinMacro_zeus.py | 2 +- test/client/appl/main.cpp | 12 +++-- tools/service-picture/appl/main.cpp | 28 ++++++++++- zeus/AbstractFunctionTypeClass.hpp | 8 ++-- zeus/AbstractFunctionTypeDirect.hpp | 8 ++-- zeus/Buffer.cpp | 19 ++++---- zeus/Buffer.hpp | 8 ++-- zeus/BufferAnswer.cpp | 4 +- zeus/BufferAnswer.hpp | 12 ++--- zeus/BufferCall.cpp | 4 +- zeus/BufferCall.hpp | 5 +- zeus/BufferCtrl.cpp | 4 +- zeus/BufferCtrl.hpp | 5 +- zeus/BufferData.cpp | 4 +- zeus/BufferData.hpp | 5 +- zeus/BufferParameter.cpp | 5 ++ zeus/BufferParameter.hpp | 18 ++++--- zeus/BufferParameter_addParameter.cpp | 3 +- zeus/BufferParameter_getParameter.cpp | 52 ++++++++++---------- zeus/Client.cpp | 2 +- zeus/Client.hpp | 2 +- zeus/FileImpl.cpp | 27 +++++++++-- zeus/FileImpl.hpp | 6 ++- zeus/Future.cpp | 9 +--- zeus/Future.hpp | 6 --- zeus/ObjectRemote.hpp | 2 +- zeus/Raw.cpp | 57 ++++++++++++++++++++++ zeus/Raw.hpp | 42 ++++------------- zeus/WebServer.cpp | 68 +++++---------------------- zeus/WebServer.hpp | 12 +++-- zeus/zeus-File.obj.zeus.idl | 4 +- 31 files changed, 244 insertions(+), 199 deletions(-) diff --git a/lutinMacro_zeus.py b/lutinMacro_zeus.py index 0cdee42..d56bdae 100644 --- a/lutinMacro_zeus.py +++ b/lutinMacro_zeus.py @@ -463,7 +463,7 @@ class ServiceDefinition: """ out += " addType(data, createType<" + class_name + ">());\n" """ - out += " addTypeObject(data, \"" + class_name + "\");\n" + out += " addTypeObject(data, \"obj:" + class_name + "\");\n" out += " int32_t currentOffset = data.size();\n" out += " int32_t startOffset = data.size();\n" out += " data.resize(data.size()+4);\n" diff --git a/test/client/appl/main.cpp b/test/client/appl/main.cpp index e609e64..cc44306 100644 --- a/test/client/appl/main.cpp +++ b/test/client/appl/main.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include @@ -23,6 +24,7 @@ int main(int _argc, const char *_argv[]) { etk::init(_argc, _argv); + elog::init(_argc, _argv); zeus::init(_argc, _argv); zeus::Client client1; for (int32_t iii=0; iii<_argc ; ++iii) { @@ -92,7 +94,7 @@ int main(int _argc, const char *_argv[]) { } */ - if (true) { + if (false) { APPL_INFO(" ----------------------------------"); APPL_INFO(" -- Get service system-user"); APPL_INFO(" ----------------------------------"); @@ -143,6 +145,7 @@ int main(int _argc, const char *_argv[]) { if (true) { zeus::service::ProxyPicture remoteServicePicture = client1.getService("picture"); if (remoteServicePicture.exist() == true) { + #if 0 zeus::Future> retCall = remoteServicePicture.getAlbums().wait(); APPL_INFO(" album list: "); for (auto &it : retCall.get()) { @@ -166,7 +169,7 @@ int main(int _argc, const char *_argv[]) { APPL_INFO(" - " << it3); // TODO : This is really bad : Do it better ... zeus::Future> retListImage = remoteServicePicture.getAlbumListPicture(it3).wait(); - zeus::ProxyFile tmpFile = zeus::ObjectRemote(retListImage.get(client1.m_interfaceWeb)); + zeus::ProxyFile tmpFile = zeus::ObjectRemote(retListImage.get()); APPL_INFO(" mine-type: " << tmpFile.getMineType().wait().get()); APPL_INFO(" size: " << tmpFile.size().wait().get()); APPL_INFO(" receive in =" << int64_t(retListImage.getTransmitionTime().count()/1000)/1000.0 << " ms"); @@ -184,15 +187,16 @@ int main(int _argc, const char *_argv[]) { } } } + #endif #if 1 echrono::Steady start = echrono::Steady::now(); //zeus::File tmp("./testzz.png"); // TODO : Read file size before .. int32_t size = 1024; ememory::SharedPtr tmp = zeus::File::create("./tmpResult.bmp"); - zeus::FutureBase retSendImage = remoteServicePicture.addFile(tmp).wait(); + auto retSendImage = remoteServicePicture.addFile(tmp).wait(); echrono::Steady stop = echrono::Steady::now(); - APPL_WARNING(" IO*=" << (stop-start)); + APPL_WARNING(" IO*=" << (stop-start) << " " << retSendImage.get()); double megaParSec = double(size)/(double((stop-start).count())/1000000000.0); APPL_WARNING(" speed=" << int64_t(megaParSec/1024.0)/1024.0 << " Mo/s"); #endif diff --git a/tools/service-picture/appl/main.cpp b/tools/service-picture/appl/main.cpp index 40ea2e4..bd1b6db 100644 --- a/tools/service-picture/appl/main.cpp +++ b/tools/service-picture/appl/main.cpp @@ -189,8 +189,11 @@ namespace appl { } std::string addFile(zeus::ProxyFile _dataFile) { std::unique_lock lock(g_mutex); + APPL_ERROR("Call add file ... "); // TODO : Check right ... uint64_t id = createFileID(); + APPL_ERROR("New ID : " << id); + /* auto fut = _dataFile.getPart(0, 6400); fut.andThen([](zeus::FutureBase _data){ zeus::Future data(_data); @@ -198,6 +201,29 @@ namespace appl { APPL_ERROR("Get data In andThen " << ppp.size()); return true; }); + */ + auto futType = _dataFile.getMineType(); + auto futName = _dataFile.getName(); + auto futSize = _dataFile.getSize(); + futType.wait(); + APPL_ERROR("mine-type : " << futType.get()); + futName.wait(); + APPL_ERROR("name : " << futName.get()); + futSize.wait(); + APPL_ERROR("size : " << futSize.get()); + int64_t retSize = futSize.get(); + int64_t offset = 0; + while (retSize > 0) { + int32_t nbElement = 4096; + if (retSize Receive FILE " << _dataFile.getMineType() << " size=" << _dataFile.getData().size()); std::stringstream val; @@ -208,7 +234,7 @@ namespace appl { _dataFile.storeIn(g_basePath + filename); m_listFile.insert(std::make_pair(id, filename)); */ - return etk::to_string(id);//zeus::FileServer(); + return etk::to_string(id); } /* // Return a global UTC time diff --git a/zeus/AbstractFunctionTypeClass.hpp b/zeus/AbstractFunctionTypeClass.hpp index 87297f4..48a9e3a 100644 --- a/zeus/AbstractFunctionTypeClass.hpp +++ b/zeus/AbstractFunctionTypeClass.hpp @@ -32,10 +32,10 @@ namespace zeus { // clang generate a basic warning: // warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced] int32_t idParam = 0; - ret = (*_pointer.*_func)(_obj->getParameter(idParam++)...); + ret = (*_pointer.*_func)(_obj->getParameter(_interfaceClient, idParam++)...); } else { int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1; - ret = (*_pointer.*_func)(_obj->getParameter(idParam--)...); + ret = (*_pointer.*_func)(_obj->getParameter(_interfaceClient, idParam--)...); } if (_interfaceClient == nullptr) { ZEUS_ERROR("Nullptr for _interfaceWeb"); @@ -65,10 +65,10 @@ namespace zeus { // clang generate a basic warning: // warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced] int32_t idParam = 0; - (*_pointer.*_func)(_obj->getParameter(idParam++)...); + (*_pointer.*_func)(_obj->getParameter(_interfaceClient, idParam++)...); } else { int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1; - (*_pointer.*_func)(_obj->getParameter(idParam--)...); + (*_pointer.*_func)(_obj->getParameter(_interfaceClient, idParam--)...); } if (_interfaceClient == nullptr) { ZEUS_ERROR("Nullptr for _interfaceWeb"); diff --git a/zeus/AbstractFunctionTypeDirect.hpp b/zeus/AbstractFunctionTypeDirect.hpp index e7fc400..887a124 100644 --- a/zeus/AbstractFunctionTypeDirect.hpp +++ b/zeus/AbstractFunctionTypeDirect.hpp @@ -27,10 +27,10 @@ namespace zeus { // clang generate a basic warning: // warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced] int32_t idParam = 0; - ret = _func(_obj->getParameter(idParam++)...); + ret = _func(_obj->getParameter(_interfaceClient, idParam++)...); } else { int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1; - ret = _func(_obj->getParameter(idParam--)...); + ret = _func(_obj->getParameter(_interfaceClient, idParam--)...); } if (_interfaceClient == nullptr) { ZEUS_ERROR("Nullptr for _interfaceWeb"); @@ -58,10 +58,10 @@ namespace zeus { // clang generate a basic warning: // warning: multiple unsequenced modifications to 'idParam' [-Wunsequenced] int32_t idParam = 0; - _func(_obj->getParameter(idParam++)...); + _func(_obj->getParameter(_interfaceClient, idParam++)...); } else { int32_t idParam = int32_t(sizeof...(ZEUS_TYPES))-1; - _func(_obj->getParameter(idParam--)...); + _func(_obj->getParameter(_interfaceClient, idParam--)...); } if (_interfaceClient == nullptr) { ZEUS_ERROR("Nullptr for _interfaceWeb"); diff --git a/zeus/Buffer.cpp b/zeus/Buffer.cpp index 92a3fd6..3803534 100644 --- a/zeus/Buffer.cpp +++ b/zeus/Buffer.cpp @@ -16,6 +16,8 @@ #include #include #include +#include + namespace etk { template<> std::string to_string(const enum zeus::Buffer::typeMessage& _value) { @@ -59,7 +61,8 @@ static enum zeus::Buffer::typeMessage getTypeType(uint16_t _value) { return zeus::Buffer::typeMessage::unknow; } -zeus::Buffer::Buffer() { +zeus::Buffer::Buffer(ememory::SharedPtr _iface): + m_iface(_iface) { clear(); } @@ -230,11 +233,11 @@ enum zeus::Buffer::typeMessage zeus::Buffer::getType() const { // ------------------------------------------------------------------------------------ // -- Factory // ------------------------------------------------------------------------------------ -ememory::SharedPtr zeus::Buffer::create() { - return ememory::SharedPtr(new zeus::Buffer); +ememory::SharedPtr zeus::Buffer::create(ememory::SharedPtr _iface) { + return ememory::SharedPtr(new zeus::Buffer(_iface)); } -ememory::SharedPtr zeus::Buffer::create(const std::vector& _buffer) { +ememory::SharedPtr zeus::Buffer::create(ememory::SharedPtr _iface, const std::vector& _buffer) { headerBin header; if (_buffer.size() < sizeof(headerBin)) { ZEUS_ERROR("wrong size of the buffer"); @@ -246,7 +249,7 @@ ememory::SharedPtr zeus::Buffer::create(const std::vector case zeus::Buffer::typeMessage::unknow: return nullptr; case zeus::Buffer::typeMessage::ctrl: { - ememory::SharedPtr value = zeus::BufferCtrl::create(); + ememory::SharedPtr value = zeus::BufferCtrl::create(_iface); if (value == nullptr) { return nullptr; } @@ -262,7 +265,7 @@ ememory::SharedPtr zeus::Buffer::create(const std::vector } break; case zeus::Buffer::typeMessage::call: { - ememory::SharedPtr value = zeus::BufferCall::create(); + ememory::SharedPtr value = zeus::BufferCall::create(_iface); if (value == nullptr) { return nullptr; } @@ -278,7 +281,7 @@ ememory::SharedPtr zeus::Buffer::create(const std::vector } break; case zeus::Buffer::typeMessage::answer: { - ememory::SharedPtr value = zeus::BufferAnswer::create(); + ememory::SharedPtr value = zeus::BufferAnswer::create(_iface); if (value == nullptr) { return nullptr; } @@ -294,7 +297,7 @@ ememory::SharedPtr zeus::Buffer::create(const std::vector } break; case zeus::Buffer::typeMessage::data: { - ememory::SharedPtr value = zeus::BufferData::create(); + ememory::SharedPtr value = zeus::BufferData::create(_iface); if (value == nullptr) { return nullptr; } diff --git a/zeus/Buffer.hpp b/zeus/Buffer.hpp index 1fd938b..320cd4c 100644 --- a/zeus/Buffer.hpp +++ b/zeus/Buffer.hpp @@ -104,11 +104,13 @@ namespace zeus { */ class Buffer { friend std::ostream& operator<<(std::ostream&, zeus::Buffer*); + protected: + ememory::SharedPtr m_iface; protected: /** * @brief basic constructor (hidden to force the use of ememory::SharedPtr) @ref zeus::Buffer::create */ - Buffer(); + Buffer(ememory::SharedPtr _iface); public: /** * Virtualize the buffer class @@ -118,13 +120,13 @@ namespace zeus { * @brief Create a shared pointer on the buffer * @return Allocated Buffer. */ - static ememory::SharedPtr create(); + static ememory::SharedPtr create(ememory::SharedPtr _iface); /** * @brief Create a shared pointer on the buffer * @param[in] _buffer Buffer on the data * @return Allocated Buffer. */ - static ememory::SharedPtr create(const std::vector& _buffer); + static ememory::SharedPtr create(ememory::SharedPtr _iface, const std::vector& _buffer); protected: uint32_t m_interfaceID; //!< For debug ==> unterface ID ... headerBin m_header; //!< header of the protocol diff --git a/zeus/BufferAnswer.cpp b/zeus/BufferAnswer.cpp index f34a034..4602aa6 100644 --- a/zeus/BufferAnswer.cpp +++ b/zeus/BufferAnswer.cpp @@ -80,7 +80,7 @@ void zeus::BufferAnswer::appendBufferData(ememory::SharedPtr _ // -- Factory // ------------------------------------------------------------------------------------ -ememory::SharedPtr zeus::BufferAnswer::create() { - return ememory::SharedPtr(new zeus::BufferAnswer); +ememory::SharedPtr zeus::BufferAnswer::create(ememory::SharedPtr _iface) { + return ememory::SharedPtr(new zeus::BufferAnswer(_iface)); } diff --git a/zeus/BufferAnswer.hpp b/zeus/BufferAnswer.hpp index bbcaf98..3ca00b8 100644 --- a/zeus/BufferAnswer.hpp +++ b/zeus/BufferAnswer.hpp @@ -21,7 +21,8 @@ namespace zeus { /** * @brief basic constructor (hidden to force the use of ememory::SharedPtr) @ref zeus::BufferAnswer::create */ - BufferAnswer() { + BufferAnswer(ememory::SharedPtr _iface): + zeus::BufferParameter(_iface) { m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::answer); }; void composeWith(const uint8_t* _buffer, uint32_t _lenght) override; @@ -33,7 +34,7 @@ namespace zeus { * @brief Create a shared pointer on the BufferAnswer * @return Allocated Buffer. */ - static ememory::SharedPtr create(); + static ememory::SharedPtr create(ememory::SharedPtr _iface); public: enum zeus::Buffer::typeMessage getType() const override { return zeus::Buffer::typeMessage::answer; @@ -50,14 +51,9 @@ namespace zeus { * @brief get the answer value * @param[in] Data of the answer */ - // TODO : Do it better check error ... ==> can be good ... template ZEUS_TYPE_DATA getAnswer() const { - return getParameter(0); - } - template - ZEUS_TYPE_DATA getAnswer(const ememory::SharedPtr& _iface) const { - return getParameter(_iface, 0); + return getParameter(m_iface, 0); } /** * @brief Ann an error on the message answer diff --git a/zeus/BufferCall.cpp b/zeus/BufferCall.cpp index 4aa76f5..b642513 100644 --- a/zeus/BufferCall.cpp +++ b/zeus/BufferCall.cpp @@ -64,6 +64,6 @@ void zeus::BufferCall::appendBufferData(ememory::SharedPtr _ob // ------------------------------------------------------------------------------------ -ememory::SharedPtr zeus::BufferCall::create() { - return ememory::SharedPtr(new zeus::BufferCall); +ememory::SharedPtr zeus::BufferCall::create(ememory::SharedPtr _iface) { + return ememory::SharedPtr(new zeus::BufferCall(_iface)); } diff --git a/zeus/BufferCall.hpp b/zeus/BufferCall.hpp index 01525fe..9b80c17 100644 --- a/zeus/BufferCall.hpp +++ b/zeus/BufferCall.hpp @@ -20,7 +20,8 @@ namespace zeus { /** * @brief basic constructor (hidden to force the use of ememory::SharedPtr) @ref zeus::BufferCall::create */ - BufferCall() { + BufferCall(ememory::SharedPtr _iface): + zeus::BufferParameter(_iface) { m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::call); }; void composeWith(const uint8_t* _buffer, uint32_t _lenght) override; @@ -32,7 +33,7 @@ namespace zeus { * @brief Create a shared pointer on the BufferCall * @return Allocated Buffer. */ - static ememory::SharedPtr create(); + static ememory::SharedPtr create(ememory::SharedPtr _iface); public: enum zeus::Buffer::typeMessage getType() const override { return zeus::Buffer::typeMessage::call; diff --git a/zeus/BufferCtrl.cpp b/zeus/BufferCtrl.cpp index 0b0c29a..f3dcfb8 100644 --- a/zeus/BufferCtrl.cpp +++ b/zeus/BufferCtrl.cpp @@ -52,6 +52,6 @@ void zeus::BufferCtrl::appendBufferData(ememory::SharedPtr _ob // ------------------------------------------------------------------------------------ -ememory::SharedPtr zeus::BufferCtrl::create() { - return ememory::SharedPtr(new zeus::BufferCtrl); +ememory::SharedPtr zeus::BufferCtrl::create(ememory::SharedPtr _iface) { + return ememory::SharedPtr(new zeus::BufferCtrl(_iface)); } diff --git a/zeus/BufferCtrl.hpp b/zeus/BufferCtrl.hpp index 4955c7b..6c1e41f 100644 --- a/zeus/BufferCtrl.hpp +++ b/zeus/BufferCtrl.hpp @@ -19,7 +19,8 @@ namespace zeus { /** * @brief basic constructor (hidden to force the use of ememory::SharedPtr) @ref zeus::BufferCall::create */ - BufferCtrl() { + BufferCtrl(ememory::SharedPtr _iface): + zeus::Buffer(_iface) { m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::ctrl); }; void composeWith(const uint8_t* _buffer, uint32_t _lenght) override; @@ -31,7 +32,7 @@ namespace zeus { * @brief Create a shared pointer on the BufferCall * @return Allocated Buffer. */ - static ememory::SharedPtr create(); + static ememory::SharedPtr create(ememory::SharedPtr _iface); public: enum zeus::Buffer::typeMessage getType() const override { return zeus::Buffer::typeMessage::ctrl; diff --git a/zeus/BufferData.cpp b/zeus/BufferData.cpp index 7b2e489..781e7c8 100644 --- a/zeus/BufferData.cpp +++ b/zeus/BufferData.cpp @@ -62,6 +62,6 @@ void zeus::BufferData::composeWith(const uint8_t* _buffer, uint32_t _lenght) { // -- Factory // ------------------------------------------------------------------------------------ -ememory::SharedPtr zeus::BufferData::create() { - return ememory::SharedPtr(new zeus::BufferData); +ememory::SharedPtr zeus::BufferData::create(ememory::SharedPtr _iface) { + return ememory::SharedPtr(new zeus::BufferData(_iface)); } diff --git a/zeus/BufferData.hpp b/zeus/BufferData.hpp index acc161a..9ce3f61 100644 --- a/zeus/BufferData.hpp +++ b/zeus/BufferData.hpp @@ -22,7 +22,8 @@ namespace zeus { /** * @brief basic constructor (hidden to force the use of ememory::SharedPtr) @ref zeus::BufferData::create */ - BufferData(): + BufferData(ememory::SharedPtr _iface): + zeus::Buffer(_iface), m_partId(0) { m_header.flags = ZEUS_BUFFER_FLAG_FINISH + uint8_t(zeus::Buffer::typeMessage::data); }; @@ -35,7 +36,7 @@ namespace zeus { * @brief Create a shared pointer on the BufferData * @return Allocated Buffer. */ - static ememory::SharedPtr create(); + static ememory::SharedPtr create(ememory::SharedPtr _iface); public: enum zeus::Buffer::typeMessage getType() const override { return zeus::Buffer::typeMessage::data; diff --git a/zeus/BufferParameter.cpp b/zeus/BufferParameter.cpp index 5200454..dc43148 100644 --- a/zeus/BufferParameter.cpp +++ b/zeus/BufferParameter.cpp @@ -12,6 +12,11 @@ #include #include +zeus::BufferParameter::BufferParameter(ememory::SharedPtr _iface): + Buffer(_iface) { + +} + bool zeus::BufferParameter::writeOn(enet::WebSocket& _interface) { uint8_t* data = nullptr; uint32_t dataSize = 0; diff --git a/zeus/BufferParameter.hpp b/zeus/BufferParameter.hpp index 3595eed..980a7dd 100644 --- a/zeus/BufferParameter.hpp +++ b/zeus/BufferParameter.hpp @@ -16,20 +16,24 @@ namespace zeus { protected: mutable std::vector>> m_parameter; //!< list of the parameter (offset of start data and buffer of data (subprotocol...) public: + BufferParameter(ememory::SharedPtr _iface); /** * @brief Template to get a parameter with a specific type * @param[in] _id Number of the parameter - * @return Converted type of the parameter (or empty value) - */ - template - ZEUS_TYPE_DATA getParameter(int32_t _id) const; - /** - * @brief Template to get a parameter with a specific type - * @param[in] _id Number of the parameter + * @param[in] _iface IO Web interface * @return Converted type of the parameter (or empty value) */ template ZEUS_TYPE_DATA getParameter(const ememory::SharedPtr& _iface, int32_t _id) const; + /** + * @brief Template to get a parameter with a specific type + * @param[in] _id Number of the parameter + * @return Converted type of the parameter (or empty value) + */ + template + ZEUS_TYPE_DATA getParameter(int32_t _id) const { + return getParameter(m_iface, _id); + } /** * @brief Get the type of a parameter. * @param[in] _id Number of the parameter diff --git a/zeus/BufferParameter_addParameter.cpp b/zeus/BufferParameter_addParameter.cpp index c52f606..4dd0d6d 100644 --- a/zeus/BufferParameter_addParameter.cpp +++ b/zeus/BufferParameter_addParameter.cpp @@ -324,12 +324,13 @@ namespace zeus { ~SendData() { } + // TODO : Set it with a sharedPtr instaed of pointer ... bool operator() (zeus::WebServer* _interface, uint32_t _source, uint32_t _destination, uint32_t _transactionId, uint32_t _partId) { - ememory::SharedPtr answer = zeus::BufferData::create(); + ememory::SharedPtr answer = zeus::BufferData::create(_interface->sharedFromThis()); answer->setTransactionId(_transactionId); answer->setSource(_source); answer->setDestination(_destination); diff --git a/zeus/BufferParameter_getParameter.cpp b/zeus/BufferParameter_getParameter.cpp index 5abf041..976b511 100644 --- a/zeus/BufferParameter_getParameter.cpp +++ b/zeus/BufferParameter_getParameter.cpp @@ -14,7 +14,7 @@ #include namespace zeus { template<> - bool BufferParameter::getParameter(int32_t _id) const { + bool BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -31,7 +31,7 @@ namespace zeus { } template<> - std::string BufferParameter::getParameter(int32_t _id) const { + std::string BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { std::string out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -43,7 +43,7 @@ namespace zeus { template<> - uint8_t BufferParameter::getParameter(int32_t _id) const { + uint8_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -83,7 +83,7 @@ namespace zeus { return 0; } template<> - uint16_t BufferParameter::getParameter(int32_t _id) const { + uint16_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -124,7 +124,7 @@ namespace zeus { } template<> - uint32_t BufferParameter::getParameter(int32_t _id) const { + uint32_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -165,7 +165,7 @@ namespace zeus { } template<> - uint64_t BufferParameter::getParameter(int32_t _id) const { + uint64_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -208,12 +208,12 @@ namespace zeus { #if defined(__TARGET_OS__MacOs) \ || defined(__TARGET_OS__IOs) template<> - size_t BufferParameter::getParameter(int32_t _id) const { + size_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { return getParameter(_id); } #endif template<> - int8_t BufferParameter::getParameter(int32_t _id) const { + int8_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -254,7 +254,7 @@ namespace zeus { } template<> - int16_t BufferParameter::getParameter(int32_t _id) const { + int16_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -295,7 +295,7 @@ namespace zeus { } template<> - int32_t BufferParameter::getParameter(int32_t _id) const { + int32_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -336,7 +336,7 @@ namespace zeus { } template<> - int64_t BufferParameter::getParameter(int32_t _id) const { + int64_t BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -377,7 +377,7 @@ namespace zeus { } template<> - float BufferParameter::getParameter(int32_t _id) const { + float BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -417,7 +417,7 @@ namespace zeus { return 0.0f; } template<> - double BufferParameter::getParameter(int32_t _id) const { + double BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); @@ -481,7 +481,7 @@ namespace zeus { template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -571,7 +571,7 @@ namespace zeus { return out; } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -662,7 +662,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -753,7 +753,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -844,7 +844,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -935,7 +935,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1026,7 +1026,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1117,7 +1117,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1208,7 +1208,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1299,7 +1299,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1390,7 +1390,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1412,7 +1412,7 @@ namespace zeus { } template<> - std::vector BufferParameter::getParameter>(int32_t _id) const { + std::vector BufferParameter::getParameter>(const ememory::SharedPtr& _iface, int32_t _id) const { std::vector out; zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); @@ -1473,7 +1473,7 @@ namespace zeus { } */ template<> - zeus::Raw BufferParameter::getParameter(int32_t _id) const { + zeus::Raw BufferParameter::getParameter(const ememory::SharedPtr& _iface, int32_t _id) const { zeus::ParamType type = getParameterType(_id); const uint8_t* pointer = getParameterPointer(_id); uint32_t dataSize = getParameterSize(_id); diff --git a/zeus/Client.cpp b/zeus/Client.cpp index 0e1005c..bd7d6e9 100644 --- a/zeus/Client.cpp +++ b/zeus/Client.cpp @@ -148,7 +148,7 @@ zeus::ObjectRemote zeus::Client::getService(const std::string& _name) { ZEUS_WARNING("Can not unlink with the service id: '" << _name << "' ==> link error"); return zeus::ObjectRemote(); } - return zeus::ObjectRemote(ret.get(m_interfaceWeb)); + return zeus::ObjectRemote(ret.get()); } void zeus::Client::onPropertyChangeIp() { diff --git a/zeus/Client.hpp b/zeus/Client.hpp index 215b593..d5c40bf 100644 --- a/zeus/Client.hpp +++ b/zeus/Client.hpp @@ -116,7 +116,7 @@ namespace zeus { const std::string& _functionName, _ARGS&&... _args) { if (m_interfaceWeb == nullptr) { - ememory::SharedPtr ret = zeus::BufferAnswer::create(); + ememory::SharedPtr ret = zeus::BufferAnswer::create(nullptr); // TODO : This is really a bad case ... ret->addError("NULLPTR", "call " + _functionName + " with no interface open"); return zeus::FutureBase(0, ret); } diff --git a/zeus/FileImpl.cpp b/zeus/FileImpl.cpp index 41c7288..b07f18f 100644 --- a/zeus/FileImpl.cpp +++ b/zeus/FileImpl.cpp @@ -5,6 +5,7 @@ */ #include +#include #include "debug.hpp" namespace zeus { @@ -21,27 +22,43 @@ namespace zeus { zeus::FileImpl::FileImpl(std::string _filename) : m_filename(_filename), m_node(_filename) { + m_size = m_node.fileSize(); m_node.fileOpenRead(); + std::string extention = std::string(_filename.begin()+_filename.size() -3, _filename.end()); + m_mineType = zeus::getMineType(extention); } zeus::FileImpl::~FileImpl() { m_node.fileClose(); } -uint64_t zeus::FileImpl::size() { - return 4092; +uint64_t zeus::FileImpl::getSize() { + return m_size; } -std::string zeus::FileImpl::name() { +std::string zeus::FileImpl::getName() { return m_filename; } std::string zeus::FileImpl::getMineType() { - return "audio/x-matroska"; + return m_mineType; } zeus::Raw zeus::FileImpl::getPart(uint64_t _start, uint64_t _stop) { - return zeus::Raw(4092); + if ((_stop - _start) > 25*1024*1024) { + ZEUS_ERROR("REQUEST more that 25 Mo in a part file ..."); + // TODO : throw an error ... + return zeus::Raw(); + } + zeus::Raw tmp(_stop - _start); + if (m_node.fileSeek(_start, etk::seekNode_start) == false) { + ZEUS_ERROR("REQUEST seek error ..."); + // TODO : throw an error ... + return zeus::Raw(); + } + int64_t sizeCopy = m_node.fileRead(tmp.writeData(), 1, _stop-_start); + // TODO : Check if copy is correct ... + return std::move(tmp); } diff --git a/zeus/FileImpl.hpp b/zeus/FileImpl.hpp index dfaf1e0..791cefe 100644 --- a/zeus/FileImpl.hpp +++ b/zeus/FileImpl.hpp @@ -13,11 +13,13 @@ namespace zeus { private: std::string m_filename; etk::FSNode m_node; + size_t m_size; + std::string m_mineType; public: FileImpl(std::string _filename); ~FileImpl(); - uint64_t size() override; - std::string name() override; + uint64_t getSize() override; + std::string getName() override; std::string getMineType() override; zeus::Raw getPart(uint64_t _start, uint64_t _stop) override; diff --git a/zeus/Future.cpp b/zeus/Future.cpp index 57dadb0..9b8a866 100644 --- a/zeus/Future.cpp +++ b/zeus/Future.cpp @@ -335,13 +335,8 @@ namespace zeus { } return static_cast(m_data->m_returnData.get())->getAnswer(); } -} - -// NamespaceSpace for Object and services - -namespace zeus { template<> - ememory::SharedPtr zeus::Future>::get(const ememory::SharedPtr& _iface) { + ememory::SharedPtr zeus::Future>::get() { ememory::SharedPtr out; if ( m_data == nullptr || m_data->m_returnData == nullptr) { @@ -351,7 +346,7 @@ namespace zeus { ZEUS_WARNING("No Return value ..."); return out; } - out = static_cast(m_data->m_returnData.get())->getAnswer>(_iface); + out = static_cast(m_data->m_returnData.get())->getAnswer>(); return out; } } diff --git a/zeus/Future.hpp b/zeus/Future.hpp index 05a7567..713ba2e 100644 --- a/zeus/Future.hpp +++ b/zeus/Future.hpp @@ -38,12 +38,6 @@ namespace zeus { * @return requested value */ ZEUS_RETURN get(); - /** - * @brief Get the value Requested with the type expecially for object and services - * @return requested value - */ - ZEUS_RETURN get(const ememory::SharedPtr& _iface); - const Future& wait() const { zeus::FutureBase::wait(); return *this; diff --git a/zeus/ObjectRemote.hpp b/zeus/ObjectRemote.hpp index bd5f4ae..77a7186 100644 --- a/zeus/ObjectRemote.hpp +++ b/zeus/ObjectRemote.hpp @@ -99,7 +99,7 @@ namespace zeus { zeus::FutureBase call(const std::string& _functionName, _ARGS&&... _args) { if ( m_interface == nullptr || m_interface->m_interfaceWeb == nullptr) { - ememory::SharedPtr ret = zeus::BufferAnswer::create(); + ememory::SharedPtr ret = zeus::BufferAnswer::create(nullptr); // TODO : This is a real bad case ... if (ret != nullptr) { ret->addError("NULLPTR", "call " + _functionName + " with no interface open"); } diff --git a/zeus/Raw.cpp b/zeus/Raw.cpp index e69de29..8f1aaae 100644 --- a/zeus/Raw.cpp +++ b/zeus/Raw.cpp @@ -0,0 +1,57 @@ +/** @file + * @author Edouard DUPIN + * @copyright 2016, Edouard DUPIN, all right reserved + * @license APACHE v2.0 (see license file) + */ + +#include +#include "debug.hpp" + + +zeus::Raw::Raw() : + m_size(0), + m_dataExternal(nullptr), + m_dataInternal() { + +} + +zeus::Raw::Raw(uint32_t _size) : + m_size(_size), + m_dataExternal(nullptr), + m_dataInternal() { + m_dataInternal.resize(_size); +} + +zeus::Raw::Raw(uint32_t _size, const uint8_t* _data) : + m_size(_size), + m_dataExternal(_data), + m_dataInternal() { + +} + +zeus::Raw::~Raw() { + +} + + +uint32_t zeus::Raw::size() const { + return m_size; +} + +const uint8_t* zeus::Raw::data() const { + if (m_dataExternal != nullptr) { + return m_dataExternal; + } + return &m_dataInternal[0]; +} + +uint8_t* zeus::Raw::writeData() { + if (m_dataExternal != nullptr) { + ZEUS_ERROR("Try to write on Data that is not allowed ..."); + return nullptr; + } + return &m_dataInternal[0]; +} + + + diff --git a/zeus/Raw.hpp b/zeus/Raw.hpp index 3ca4c61..64b0d27 100644 --- a/zeus/Raw.hpp +++ b/zeus/Raw.hpp @@ -15,52 +15,26 @@ namespace zeus { private: uint32_t m_size; const uint8_t* m_dataExternal; - uint8_t* m_dataInternal; + std::vector m_dataInternal; public: /** * @brief generic constructor */ - Raw() : - m_size(0), - m_dataExternal(nullptr), - m_dataInternal(nullptr) { - - } + Raw(); /** * @brief generic constructor */ - Raw(uint32_t _size) : - m_size(_size), - m_dataExternal(nullptr), - m_dataInternal(new uint8_t[_size]) { - - } + Raw(uint32_t _size); - Raw(uint32_t _size, const uint8_t* _data) : - m_size(_size), - m_dataExternal(_data), - m_dataInternal(nullptr) { - - } + Raw(uint32_t _size, const uint8_t* _data); - ~Raw() { - if (m_dataInternal != nullptr) { - delete[] m_dataInternal; - m_dataInternal = nullptr; - } - } + ~Raw(); - uint32_t size() const { - return m_size; - } + uint32_t size() const; - const uint8_t* data() const { - if (m_dataExternal != nullptr) { - return m_dataExternal; - } - return m_dataInternal; - } + const uint8_t* data() const; + uint8_t* writeData(); }; } diff --git a/zeus/WebServer.cpp b/zeus/WebServer.cpp index 4da13ca..4b490df 100644 --- a/zeus/WebServer.cpp +++ b/zeus/WebServer.cpp @@ -11,8 +11,8 @@ #include -ememory::SharedPtr zeus::createBaseCall(uint64_t _transactionId, const uint32_t& _source, const uint32_t& _destination, const std::string& _functionName) { - ememory::SharedPtr obj = zeus::BufferCall::create(); +ememory::SharedPtr zeus::createBaseCall(const ememory::SharedPtr& _iface, uint64_t _transactionId, const uint32_t& _source, const uint32_t& _destination, const std::string& _functionName) { + ememory::SharedPtr obj = zeus::BufferCall::create(_iface); if (obj == nullptr) { return nullptr; } @@ -146,6 +146,7 @@ class SendAsyncBinary { m_partId(1) { } + // TODO : Use shared ptr instaed of pointer .... bool operator() (zeus::WebServer* _interface){ auto it = m_async.begin(); while (it != m_async.end()) { @@ -159,7 +160,7 @@ class SendAsyncBinary { m_partId++; } if (m_async.size() == 0) { - ememory::SharedPtr obj = zeus::BufferData::create(); + ememory::SharedPtr obj = zeus::BufferData::create(_interface->sharedFromThis()); if (obj == nullptr) { return true; } @@ -224,7 +225,7 @@ void zeus::WebServer::onReceiveData(std::vector& _frame, bool _isBinary disconnect(true); return; } - ememory::SharedPtr dataRaw = zeus::Buffer::create(_frame); + ememory::SharedPtr dataRaw = zeus::Buffer::create(sharedFromThis(), _frame); if (dataRaw == nullptr) { ZEUS_ERROR("Buffer Allocation ERROR ... "); disconnect(true); @@ -250,7 +251,8 @@ void zeus::WebServer::newBuffer(ememory::SharedPtr _buffer) { // Try to find in the current call that has been done to add data in an answer : zeus::FutureBase future; uint64_t tid = _buffer->getTransactionId(); - { + // TODO : Check the UDI reaaly utility ... + if (_buffer->getType() == zeus::Buffer::typeMessage::answer) { std::unique_lock lock(m_pendingCallMutex); auto it = m_pendingCall.begin(); while (it != m_pendingCall.end()) { @@ -278,6 +280,7 @@ void zeus::WebServer::newBuffer(ememory::SharedPtr _buffer) { m_processingPool.async( [=](){ ememory::SharedPtr tmpObj = it; + ZEUS_INFO("PROCESS : " << _buffer); tmpObj->receive(_buffer); }, dest @@ -298,6 +301,7 @@ void zeus::WebServer::newBuffer(ememory::SharedPtr _buffer) { m_processingPool.async( [=](){ zeus::FutureBase fut = future; + ZEUS_INFO("PROCESS FUTURE : " << _buffer); // add data ... bool ret = fut.appendData(_buffer); if (ret == true) { @@ -364,7 +368,7 @@ zeus::FutureBase zeus::WebServer::callBinary(uint64_t _transactionId, const uint32_t& _destination) { if (isActive() == false) { ZEUS_ERROR("Send [STOP] ==> not connected (no TCP)"); - ememory::SharedPtr obj = zeus::BufferAnswer::create(); + ememory::SharedPtr obj = zeus::BufferAnswer::create(sharedFromThis()); obj->addError("NOT-CONNECTED", "Client interface not connected (no TCP)"); return zeus::FutureBase(_transactionId, obj); } @@ -376,56 +380,10 @@ zeus::FutureBase zeus::WebServer::callBinary(uint64_t _transactionId, writeBinary(_obj); return tmpFuture; } -/* -zeus::FutureBase zeus::WebServer::callForward(uint16_t _srcObjectId, - ememory::SharedPtr _buffer, - uint64_t _singleReferenceId) { - //zeus::FutureBase ret = callBinary(id, _Buffer, async, _callback); - //ret.setSynchronous(); - - if (isActive() == false) { - auto obj = zeus::BufferAnswer::create(); - obj->addError("NOT-CONNECTED", "Client interface not connected (no TCP)"); - return zeus::FutureBase(0, obj); - } - uint64_t id = getId(); - _buffer->setTransactionId(id); - _buffer->setClientId(_srcObjectId); - zeus::FutureBase tmpFuture(id); - tmpFuture.setSynchronous(); - { - std::unique_lock lock(m_pendingCallMutex); - m_pendingCall.push_back(std::make_pair(_singleReferenceId, tmpFuture)); - } - writeBinary(_buffer); - return tmpFuture; -} - -void zeus::WebServer::callForwardMultiple(uint16_t _srcObjectId, - ememory::SharedPtr _buffer, - uint64_t _singleReferenceId){ - if (_buffer == nullptr) { - return; - } - // subMessage ... ==> try to forward message: - std::unique_lock lock(m_pendingCallMutex); - for (auto &itCall : m_pendingCall) { - ZEUS_INFO(" compare : " << itCall.first << " =?= " << _singleReferenceId); - if (itCall.first == _singleReferenceId) { - // Find element ==> transmit it ... - _buffer->setTransactionId(itCall.second.getTransactionId()); - _buffer->setClientId(_srcObjectId); - writeBinary(_buffer); - return; - } - } - ZEUS_ERROR("Can not transfer part of a message ..."); -} -*/ /* void zeus::WebServer::sendCtrl(uint32_t _source, uint32_t _destination, const std::string& _ctrlValue) { - auto ctrl = zeus::BufferCtrl::create(); + auto ctrl = zeus::BufferCtrl::create(sharedFromThis()); if (ctrl == nullptr) { return; } @@ -438,7 +396,7 @@ void zeus::WebServer::sendCtrl(uint32_t _source, uint32_t _destination, const st */ void zeus::WebServer::answerError(uint32_t _clientTransactionId, uint32_t _source, uint32_t _destination, const std::string& _errorValue, const std::string& _errorHelp) { - auto answer = zeus::BufferAnswer::create(); + auto answer = zeus::BufferAnswer::create(sharedFromThis()); if (answer == nullptr) { return; } @@ -451,7 +409,7 @@ void zeus::WebServer::answerError(uint32_t _clientTransactionId, uint32_t _sourc void zeus::WebServer::answerVoid(uint32_t _clientTransactionId, uint32_t _source, uint32_t _destination) { - auto answer = zeus::BufferAnswer::create(); + auto answer = zeus::BufferAnswer::create(sharedFromThis()); if (answer == nullptr) { return; } diff --git a/zeus/WebServer.hpp b/zeus/WebServer.hpp index aad3c87..9463043 100644 --- a/zeus/WebServer.hpp +++ b/zeus/WebServer.hpp @@ -30,7 +30,11 @@ namespace zeus { * @param[in] * @return */ - ememory::SharedPtr createBaseCall(uint64_t _transactionId, const uint32_t& _source, const uint32_t& _destination, const std::string& _functionName); + ememory::SharedPtr createBaseCall(const ememory::SharedPtr& _iface, + uint64_t _transactionId, + const uint32_t& _source, + const uint32_t& _destination, + const std::string& _functionName); /** * @brief * @param[in] @@ -76,7 +80,7 @@ namespace zeus { */ template ememory::SharedPtr createCall(const ememory::SharedPtr& _iface, uint64_t _transactionId, const uint32_t& _source, const uint32_t& _destination, const std::string& _functionName, _ARGS&&... _args) { - ememory::SharedPtr callElem = createBaseCall(_transactionId, _source, _destination, _functionName); + ememory::SharedPtr callElem = createBaseCall(_iface, _transactionId, _source, _destination, _functionName); if (callElem == nullptr) { return nullptr; } @@ -158,7 +162,7 @@ namespace zeus { * @param[in] * @return */ - WebServer(); + WebServer(); // TODO : Set it in a factory to force the use of sharedPtr /** * @brief * @param[in] @@ -325,7 +329,7 @@ namespace zeus { */ template void answerValue(uint32_t _clientTransactionId, uint32_t _source, uint32_t _destination, ZEUS_ARG _value) { - ememory::SharedPtr answer = zeus::BufferAnswer::create(); + ememory::SharedPtr answer = zeus::BufferAnswer::create(sharedFromThis()); answer->setTransactionId(_clientTransactionId); answer->setSource(_source); answer->setDestination(_destination); diff --git a/zeus/zeus-File.obj.zeus.idl b/zeus/zeus-File.obj.zeus.idl index 7c298b1..b880fbb 100644 --- a/zeus/zeus-File.obj.zeus.idl +++ b/zeus/zeus-File.obj.zeus.idl @@ -5,11 +5,11 @@ #brief:Get size of the file #return:current size of the file -uint64 size() +uint64 getSize() #brief:Get the name of the file #return:Full name of the file (sha512) -string name() +string getName() #brief:Get the file "mine-type" #return:string of the mine-type