start moving to binarystream
This commit is contained in:
@@ -68,4 +68,13 @@ public:
|
||||
PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::TypeInfo & v);
|
||||
PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::TypeInfo & v);
|
||||
|
||||
BINARY_STREAM_STORE (PIIntrospectionContainers::TypeInfo) {
|
||||
s << PIByteArray::RawData(&v, sizeof(PIIntrospectionContainers::_Type)) << v.name;
|
||||
return s;
|
||||
}
|
||||
BINARY_STREAM_RESTORE(PIIntrospectionContainers::TypeInfo) {
|
||||
s >> PIByteArray::RawData(&v, sizeof(PIIntrospectionContainers::_Type)) >> v.name;
|
||||
return s;
|
||||
}
|
||||
|
||||
#endif // PIINTROSPECTION_CONTAINERS_P_H
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "piintrospection_containers_p.h"
|
||||
#include "piintrospection_threads.h"
|
||||
#include "piintrospection_threads_p.h"
|
||||
#include "pichunkstream.h"
|
||||
#include "pisystemmonitor.h"
|
||||
|
||||
|
||||
@@ -100,4 +101,72 @@ PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ProcessIn
|
||||
PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v);
|
||||
PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v);
|
||||
|
||||
|
||||
BINARY_STREAM_STORE (PIIntrospection::RequiredInfo) {
|
||||
PIChunkStream cs;
|
||||
cs.add(1, v.types);
|
||||
s << cs.data();
|
||||
return s;
|
||||
}
|
||||
BINARY_STREAM_RESTORE(PIIntrospection::RequiredInfo) {
|
||||
PIByteArray csba; s >> csba;
|
||||
PIChunkStream cs(csba);
|
||||
while (!cs.atEnd()) {
|
||||
switch (cs.read()) {
|
||||
case 1: cs.get(v.types); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
BINARY_STREAM_STORE (PIIntrospection::ProcessInfo) {
|
||||
PIChunkStream cs;
|
||||
cs.add(1, v.architecture).add(2, v.execCommand).add(3, v.execDateTime).add(4, v.hostname).add(5, v.OS_name)
|
||||
.add(6, v.OS_version).add(7, v.processorsCount).add(8, v.user).add(9, v.build_options);
|
||||
s << cs.data();
|
||||
return s;
|
||||
}
|
||||
BINARY_STREAM_RESTORE(PIIntrospection::ProcessInfo) {
|
||||
PIByteArray csba; s >> csba;
|
||||
PIChunkStream cs(csba);
|
||||
while (!cs.atEnd()) {
|
||||
switch (cs.read()) {
|
||||
case 1: cs.get(v.architecture); break;
|
||||
case 2: cs.get(v.execCommand); break;
|
||||
case 3: cs.get(v.execDateTime); break;
|
||||
case 4: cs.get(v.hostname); break;
|
||||
case 5: cs.get(v.OS_name); break;
|
||||
case 6: cs.get(v.OS_version); break;
|
||||
case 7: cs.get(v.processorsCount); break;
|
||||
case 8: cs.get(v.user); break;
|
||||
case 9: cs.get(v.build_options); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
BINARY_STREAM_STORE (PIIntrospection::ObjectInfo) {
|
||||
PIChunkStream cs;
|
||||
cs.add(1, v.classname).add(2, v.name).add(3, v.parents).add(4, v.properties).add(5, v.queued_events);
|
||||
s << cs.data();
|
||||
return s;
|
||||
}
|
||||
BINARY_STREAM_RESTORE(PIIntrospection::ObjectInfo) {
|
||||
PIByteArray csba; s >> csba;
|
||||
PIChunkStream cs(csba);
|
||||
while (!cs.atEnd()) {
|
||||
switch (cs.read()) {
|
||||
case 1: cs.get(v.classname); break;
|
||||
case 2: cs.get(v.name); break;
|
||||
case 3: cs.get(v.parents); break;
|
||||
case 4: cs.get(v.properties); break;
|
||||
case 5: cs.get(v.queued_events); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
#endif // PIINTROSPECTION_SERVER_P_H
|
||||
|
||||
@@ -60,4 +60,13 @@ public:
|
||||
PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIIntrospectionThreads::ThreadInfo & v);
|
||||
PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo & v);
|
||||
|
||||
BINARY_STREAM_STORE(PIIntrospectionThreads::ThreadInfo) {
|
||||
s << v.classname << v.name << v.id << v.state << v.priority << v.delay << v.run_us << v.run_count;
|
||||
return s;
|
||||
}
|
||||
BINARY_STREAM_RESTORE(PIIntrospectionThreads::ThreadInfo) {
|
||||
s >> v.classname >> v.name >> v.id >> v.state >> v.priority >> v.delay >> v.run_us >> v.run_count;
|
||||
return s;
|
||||
}
|
||||
|
||||
#endif // PIINTROSPECTION_THREADS_P_H
|
||||
|
||||
Reference in New Issue
Block a user