Commit 390454b9 authored by Yoann Pigné's avatar Yoann Pigné

update C++ implementation to take into account bugfix #56 in gs-core

parent 7b1cf84d
......@@ -37,7 +37,7 @@ int main (int argc, char const *argv[])
void e(){
string source_id="C++_netstream_test";
long time_id=0L;
NetStreamSender stream("default","10.91.100.76",2001,false);
NetStreamSender stream("default","localhost",2001,false);
string n1("node");
while(1) {
//stream.changeNodeAttribute(n1,att,old,n);
......@@ -55,6 +55,8 @@ void example(){
NetStreamSender stream("default","localhost",2001,false);
string style("node{fill-mode:plain;fill-color:#567;size:6px;}");
stream.addGraphAttribute(source_id, time_id++, "stylesheet", style);
stream.addGraphAttribute(source_id, time_id++, "test", "test");
stream.changeGraphAttribute(source_id, time_id++, "test", "test",false);
stream.addGraphAttribute(source_id, time_id++, "ui.antialias", true);
stream.addGraphAttribute(source_id, time_id++, "layout.stabilization-limit", 0);
for (int i = 0; i < 500; i++) {
......
......@@ -124,15 +124,16 @@ public:
_sendEvent(event);
}
template <typename T>
void changeGraphAttribute(const string & source_id, long time_id, const string & attribute, const T oldValue, const T newValue){
template <typename T1, typename T2>
void changeGraphAttribute(const string & source_id, long time_id, const string & attribute, const T1 & oldValue, const T2 & newValue){
NetStreamStorage event = NetStreamStorage();
event.writeByte(EVENT_CHG_GRAPH_ATTR);
event.writeString(source_id);
event.writeLong(time_id);
event.writeString(attribute);
event.writeByte(getType(newValue));
event.writeByte(getType(oldValue));
encode(event, oldValue);
event.writeByte(getType(newValue));
encode(event, newValue);
_sendEvent(event);
}
......@@ -152,16 +153,17 @@ public:
_sendEvent(event);
}
template <typename T>
void changeNodeAttribute(const string & source_id, long time_id, const string & node_id, const string & attribute, const T & oldValue, const T & newValue){
template <typename T1, typename T2>
void changeNodeAttribute(const string & source_id, long time_id, const string & node_id, const string & attribute, const T1 & oldValue, const T2 & newValue){
NetStreamStorage event = NetStreamStorage();
event.writeByte(EVENT_CHG_NODE_ATTR);
event.writeString(source_id);
event.writeLong(time_id);
event.writeString(node_id);
event.writeString(attribute);
event.writeByte(getType(newValue));
event.writeByte(getType(oldValue));
encode(event, oldValue);
event.writeByte(getType(newValue));
encode(event, newValue);
_sendEvent(event);
}
......@@ -182,16 +184,17 @@ public:
}
template <typename T>
void changeEdgeAttribute(const string & source_id, long time_id, const string & edge_id, const string & attribute, const T & oldValue, const T & newValue){
template <typename T1, typename T2>
void changeEdgeAttribute(const string & source_id, long time_id, const string & edge_id, const string & attribute, const T1 & oldValue, const T2 & newValue){
NetStreamStorage event = NetStreamStorage();
event.writeByte(EVENT_CHG_EDGE_ATTR);
event.writeString(source_id);
event.writeLong(time_id);
event.writeString(edge_id);
event.writeString(attribute);
event.writeByte(getType(newValue));
event.writeByte(getType(oldValue));
encode(event, oldValue);
event.writeByte(getType(newValue));
encode(event, newValue);
_sendEvent(event);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment