Here is an example of how to use stream readers.
Here is an example of how to use stream readers.
MyClass::doStep(const TimeSpec& ts)
{
switch(getAndCheckState(ts)) {
case HoldCurrent:
break;
case Advance:
try {
StreamReaderLatest<MyInput> read_input(input);
cout << "Input was written for " << read_input.timeSpec()
<< endl;
cout << "Input data, variable1=" << read_input.data().variable1
<< " variable2=" << read_input.data().variable2 << endl;
}
catch (Exception& e) {
cout << "In MyClass::doStep,\n"
<< "Exception 1 accessing input channel\n"
<< e.what() << endl;
}
try {
StreamReader<AnotherInput> read_other(other, ts);
cout << "other data " << read_other.data() << endl;
}
catch (Exception& e) {
cout << "In MyClass::doStep,\n"
<< "Exception 2 accessing input channel\n"
<< e.what() << endl;
}
break;
}
}