Finished time and script keyframe types into separate read & parse steps

This commit is contained in:
GPayne
2019-10-23 18:02:20 -06:00
parent 27ef369338
commit a549993727
3 changed files with 203 additions and 102 deletions
@@ -246,6 +246,56 @@ public:
static void readCameraKeyframeAscii(timestamps& times,
datamessagestructures::CameraKeyframe& kf, std::string filenameRead, int lineN);
/**
* Reads a time keyframe from a binary format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a time keyframe which contains time details
* \param file an ifstream reference to the playback file being read
* \param lineN keyframe number in playback file where this keyframe resides
*/
static void SessionRecording::readTimeKeyframeBinary(timestamps& times,
datamessagestructures::TimeKeyframe& kf, std::ifstream& file, int lineN);
/**
* Reads a time keyframe from an ascii format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a time keyframe which contains time details
* \param filenameRead a string containing the playback filename
* \param lineN line number in playback file where this keyframe resides
*/
static void SessionRecording::readTimeKeyframeAscii(timestamps& times,
datamessagestructures::TimeKeyframe& kf, std::string filenameRead, int lineN);
/**
* Reads a script keyframe from a binary format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a script keyframe which contains the size of the script
* (in chars) and the text itself
* \param file an ifstream reference to the playback file being read
* \param lineN keyframe number in playback file where this keyframe resides
*/
static void SessionRecording::readScriptKeyframeBinary(timestamps& times,
datamessagestructures::ScriptMessage& kf, std::ifstream& file, int lineN);
/**
* Reads a script keyframe from an ascii format playback file, and populates input
* references with the parameters of the keyframe.
*
* \param times reference to a timestamps structure which contains recorded times
* \param kf reference to a script keyframe which contains the size of the script
* (in chars) and the text itself
* \param filenameRead a string containing the playback filename
* \param lineN line number in playback file where this keyframe resides
*/
static void SessionRecording::readScriptKeyframeAscii(timestamps& times,
datamessagestructures::ScriptMessage& kf, std::string filenameRead, int lineN);
private:
enum class RecordedType {
Camera = 0,
@@ -290,6 +290,16 @@ struct TimeKeyframe {
sizeof(TimeKeyframe)
);
};
void read(std::istringstream* iss) {
std::string paused, jump;
iss >> _dt
>> paused
>> jump;
_paused = (paused == "P");
_requiresTimeJump = (jump == "J");
};
};
struct TimeTimeline {
@@ -404,6 +414,20 @@ struct ScriptMessage {
_script.erase();
_script = temp.data();
};
void read(std::istringstream* iss) {
int numScriptLines;
iss >> numScriptLines;
std::string tmpReadbackScript;
_script.erase();
for (unsigned int i = 0; i < numScriptLines; ++i) {
std::getline(iss, tmpReadbackScript);
_script.append(tmpReadbackScript);
if (i < (numScriptLines - 1)) {
_script.append("\n");
}
}
};
};
} // namespace openspace::messagestructures