Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hfedcba committed Aug 12, 2017
2 parents fe101d1 + 2c9300d commit d5b94a5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion getVersion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ SCRIPTDIR="$( cd "$(dirname $0)" && pwd )"

REVISION_FILE=$SCRIPTDIR/revision.txt
REVISION=$(cat $REVISION_FILE)
echo 0.1.3-$REVISION
echo 0.1.4-$REVISION
14 changes: 7 additions & 7 deletions src/INode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ INode::~INode()
_subscribePeer = std::function<void(std::string, uint64_t, int32_t, std::string)>();
_unsubscribePeer = std::function<void(std::string, uint64_t, int32_t, std::string)>();
_output = std::function<void(std::string, uint32_t, PVariable)>();
_invoke = std::function<PVariable(std::string, PArray&)>();
_invokeNodeMethod = std::function<PVariable(std::string, std::string, PArray&)>();
_invoke = std::function<PVariable(std::string, PArray)>();
_invokeNodeMethod = std::function<PVariable(std::string, std::string, PArray)>();
_nodeEvent = std::function<void(std::string, std::string, PVariable)>();
_getNodeData = std::function<PVariable(std::string, std::string)>();
_setNodeData = std::function<void(std::string, std::string, PVariable)>();
Expand Down Expand Up @@ -85,21 +85,21 @@ void INode::output(uint32_t index, PVariable message)
if(_output) _output(_id, index, message);
}

PVariable INode::invoke(std::string methodName, PArray& parameters)
PVariable INode::invoke(std::string methodName, PArray parameters)
{
if(_invoke) return _invoke(methodName, parameters);
return Variable::createError(-32500, "No callback method set.");
}

PVariable INode::invokeNodeMethod(std::string nodeId, std::string methodName, PArray& parameters)
PVariable INode::invokeNodeMethod(std::string nodeId, std::string methodName, PArray parameters)
{
if(_invokeNodeMethod) return _invokeNodeMethod(nodeId, methodName, parameters);
return Variable::createError(-32500, "No callback method set.");
}

PVariable INode::invokeLocal(std::string methodName, PArray& parameters)
PVariable INode::invokeLocal(std::string methodName, PArray parameters)
{
std::map<std::string, std::function<PVariable(PArray& parameters)>>::iterator localMethodIterator = _localRpcMethods.find(methodName);
std::map<std::string, std::function<PVariable(PArray parameters)>>::iterator localMethodIterator = _localRpcMethods.find(methodName);
if(localMethodIterator == _localRpcMethods.end())
{
Output::printError("Warning: RPC method not found: " + methodName);
Expand All @@ -109,7 +109,7 @@ PVariable INode::invokeLocal(std::string methodName, PArray& parameters)
return localMethodIterator->second(parameters);
}

void INode::nodeEvent(std::string topic, PVariable& value)
void INode::nodeEvent(std::string topic, PVariable value)
{
if(_nodeEvent) _nodeEvent(_id, topic, value);
}
Expand Down
20 changes: 10 additions & 10 deletions src/INode.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class INode
/*
* Mustn't block.
*/
virtual void setNodeVariable(std::string& variable, PVariable& value) {}
virtual void setNodeVariable(std::string variable, PVariable value) {}

/*
* Mustn't block.
Expand All @@ -103,8 +103,8 @@ class INode
void setSubscribePeer(std::function<void(std::string, uint64_t, int32_t, std::string)> value) { _subscribePeer.swap(value); }
void setUnsubscribePeer(std::function<void(std::string, uint64_t, int32_t, std::string)> value) { _unsubscribePeer.swap(value); }
void setOutput(std::function<void(std::string, uint32_t, PVariable)> value) { _output.swap(value); }
void setInvoke(std::function<PVariable(std::string, PArray&)> value) { _invoke.swap(value); }
void setInvokeNodeMethod(std::function<PVariable(std::string, std::string, PArray&)> value) { _invokeNodeMethod.swap(value); }
void setInvoke(std::function<PVariable(std::string, PArray)> value) { _invoke.swap(value); }
void setInvokeNodeMethod(std::function<PVariable(std::string, std::string, PArray)> value) { _invokeNodeMethod.swap(value); }
void setNodeEvent(std::function<void(std::string, std::string, PVariable)> value) { _nodeEvent.swap(value); }
void setGetNodeData(std::function<PVariable(std::string, std::string)> value) { _getNodeData.swap(value); }
void setSetNodeData(std::function<void(std::string, std::string, PVariable)> value) { _setNodeData.swap(value); }
Expand All @@ -119,7 +119,7 @@ class INode
/*
* Executes local RPC method. Mustn't block.
*/
virtual PVariable invokeLocal(std::string methodName, PArray& parameters);
virtual PVariable invokeLocal(std::string methodName, PArray parameters);
protected:
std::string _path;
std::string _namespace;
Expand All @@ -131,15 +131,15 @@ class INode
/*
* Stores RPC methods for inter-node communication (intended for configuration nodes)
*/
std::map<std::string, std::function<PVariable(PArray& parameters)>> _localRpcMethods;
std::map<std::string, std::function<PVariable(PArray parameters)>> _localRpcMethods;

void log(int32_t logLevel, std::string message);
void subscribePeer(uint64_t peerId, int32_t channel = -1, std::string variable = "");
void unsubscribePeer(uint64_t peerId, int32_t channel = -1, std::string variable = "");
void output(uint32_t outputIndex, PVariable message);
PVariable invoke(std::string methodName, PArray& parameters);
PVariable invokeNodeMethod(std::string nodeId, std::string methodName, PArray& parameters);
void nodeEvent(std::string topic, PVariable& value);
PVariable invoke(std::string methodName, PArray parameters);
PVariable invokeNodeMethod(std::string nodeId, std::string methodName, PArray parameters);
void nodeEvent(std::string topic, PVariable value);
PVariable getNodeData(std::string key);
void setNodeData(std::string key, PVariable value);
PVariable getFlowData(std::string key);
Expand All @@ -155,8 +155,8 @@ class INode
std::function<void(std::string, uint64_t, int32_t, std::string)> _subscribePeer;
std::function<void(std::string, uint64_t, int32_t, std::string)> _unsubscribePeer;
std::function<void(std::string, uint32_t, PVariable)> _output;
std::function<PVariable(std::string, PArray&)> _invoke;
std::function<PVariable(std::string, std::string, PArray&)> _invokeNodeMethod;
std::function<PVariable(std::string, PArray)> _invoke;
std::function<PVariable(std::string, std::string, PArray)> _invokeNodeMethod;
std::function<void(std::string, std::string, PVariable)> _nodeEvent;
std::function<PVariable(std::string, std::string)> _getNodeData;
std::function<void(std::string, std::string, PVariable)> _setNodeData;
Expand Down
4 changes: 2 additions & 2 deletions src/RpcEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void RpcEncoder::encodeVariable(std::vector<char>& packet, std::shared_ptr<Varia
{
if(_forceInteger64)
{
variable->integerValue64 = variable->integerValue;
if(variable->integerValue64 == 0) variable->integerValue64 = variable->integerValue;
encodeInteger64(packet, variable);
}
else encodeInteger(packet, variable);
Expand Down Expand Up @@ -349,7 +349,7 @@ void RpcEncoder::encodeVariable(std::vector<uint8_t>& packet, std::shared_ptr<Va
{
if(_forceInteger64)
{
variable->integerValue64 = variable->integerValue;
if(variable->integerValue64 == 0) variable->integerValue64 = variable->integerValue;
encodeInteger64(packet, variable);
}
else encodeInteger(packet, variable);
Expand Down

0 comments on commit d5b94a5

Please sign in to comment.