Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dphan/extracting protocol format #42

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
fix function order
dorotaphanSiili committed Oct 25, 2023
commit d9100443aadcc3258d92b271abe8f11b1b641134
27 changes: 14 additions & 13 deletions src/olink/core/olinkcontent.h
Original file line number Diff line number Diff line change
@@ -85,19 +85,6 @@ OLinkContent propertyToContent(ValueType value)
return content;
}

// Use to write arguments for: notifySignal, invoke, even if there is a single argument
template<typename ... Parameters>
OLinkContent argumentsToContent(const Parameters& ...inputs)
{
OLinkContent content;
content.content = nlohmann::json::array();
auto inputs_size = sizeof...(inputs);
content.content.get_ptr<nlohmann::json::array_t*>()->reserve(inputs_size);
size_t current = 0;
fillContent(content.content, current, inputs...);
return content;
}

// last call of recursive fillContent(nlohmann::json::array& content_array, T const& first, Parameters const&... rest)
void OLINK_EXPORT fillContent(nlohmann::json& content_array, size_t current);

@@ -116,6 +103,20 @@ void readValue(const OLinkContent& content, ValueType& value)
value = content.content.get<ValueType>();
}

// Use to write arguments for: notifySignal, invoke, even if there is a single argument
template<typename ... Parameters>
OLinkContent argumentsToContent(const Parameters& ...inputs)
{
OLinkContent content;
content.content = nlohmann::json::array();
auto inputs_size = sizeof...(inputs);
content.content.get_ptr<nlohmann::json::array_t*>()->reserve(inputs_size);
size_t current = 0;
fillContent(content.content, current, inputs...);
return content;
}


// Use to read for arguments: notifySignal, invoke
struct OLinContentStreamReader
{