version 3.16.0
new PISystemTime::Frequency type
This commit is contained in:
@@ -9,8 +9,14 @@ struct S {
|
||||
};
|
||||
|
||||
// Operators
|
||||
PIByteArray & operator <<(PIByteArray & b, const S & s) {b << s.i << s.f << s.s; return b;}
|
||||
PIByteArray & operator >>(PIByteArray & b, S & s) {b >> s.i >> s.f >> s.s; return b;}
|
||||
PIByteArray & operator<<(PIByteArray & b, const S & s) {
|
||||
b << s.i << s.f << s.s;
|
||||
return b;
|
||||
}
|
||||
PIByteArray & operator>>(PIByteArray & b, S & s) {
|
||||
b >> s.i >> s.f >> s.s;
|
||||
return b;
|
||||
}
|
||||
//! [struct]
|
||||
//! [write]
|
||||
// Write chunk stream
|
||||
@@ -22,10 +28,7 @@ PIVector<float> f;
|
||||
f << -1. << 2.5 << 11.;
|
||||
// write some data to empty stream
|
||||
PIChunkStream cs;
|
||||
cs << cs.chunk(1, int(10))
|
||||
<< cs.chunk(2, PIString("text"))
|
||||
<< cs.chunk(4, f)
|
||||
<< cs.chunk(3, s);
|
||||
cs << cs.chunk(1, int(10)) << cs.chunk(2, PIString("text")) << cs.chunk(4, f) << cs.chunk(3, s);
|
||||
// now you can take cs.data() and send or place it somewhere ...
|
||||
//! [write]
|
||||
//! [read]
|
||||
@@ -42,14 +45,14 @@ while (!cs2.atEnd()) {
|
||||
case 1: i = cs2.getData<int>(); break;
|
||||
case 2: str = cs2.getData<PIString>(); break;
|
||||
case 3: s = cs2.getData<S>(); break;
|
||||
case 4: f = cs2.getData<PIVector<float> >(); break;
|
||||
case 4: f = cs2.getData<PIVector<float>>(); break;
|
||||
}
|
||||
}
|
||||
piCout << i << str << f << s.i << s.f << s.s;
|
||||
//! [read]
|
||||
|
||||
//! [write_new]
|
||||
PIByteArray & operator <<(PIByteArray & s, const S & value) {
|
||||
PIByteArray & operator<<(PIByteArray & s, const S & value) {
|
||||
PIChunkStream cs;
|
||||
cs.add(1, value.i).add(2, value.f).add(3, value.s);
|
||||
s << cs.data();
|
||||
@@ -57,11 +60,11 @@ PIByteArray & operator <<(PIByteArray & s, const S & value) {
|
||||
}
|
||||
//! [write_new]
|
||||
//! [read_new]
|
||||
PIByteArray & operator >>(PIByteArray & s, S & value) {
|
||||
PIByteArray & operator>>(PIByteArray & s, S & value) {
|
||||
PIChunkStream cs;
|
||||
if (!cs.extract(s)) return s;
|
||||
cs.readAll();
|
||||
cs.get(1, value.i).get(2, value.f).get(3, value.s);
|
||||
return b;
|
||||
return s;
|
||||
}
|
||||
//! [read_new]
|
||||
|
||||
Reference in New Issue
Block a user