LogNode.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_LogNode_h_
00003 #define INCLUDED_LogNode_h_
00004
00005 #include "Behaviors/StateNode.h"
00006 #include "Shared/plist.h"
00007 #include <fstream>
00008
00009
00010 class LogNode : public virtual plist::Dictionary, public StateNode {
00011
00012
00013
00014
00015 public:
00016
00017 LogNode()
00018 : plist::Dictionary(), StateNode(),
00019 basepath(""), basename("log"), incrementNameIfExists(true),
00020 logSensors(true), logImages(true), initial(true), compression("png"),
00021 indexFile(), path(), startTime(), fileCount(), imageStartFrame(), sensorStartFrame()
00022 {}
00023
00024
00025 LogNode(const std::string& nm)
00026 : plist::Dictionary(), StateNode(nm),
00027 basepath(""), basename("log"), incrementNameIfExists(true),
00028 logSensors(true), logImages(true), initial(true), compression("png"),
00029 indexFile(), path(), startTime(), fileCount(), imageStartFrame(), sensorStartFrame()
00030 {}
00031
00032
00033
00034
00035
00036 public:
00037 plist::Primitive<std::string> basepath;
00038 plist::Primitive<std::string> basename;
00039 plist::Primitive<bool> incrementNameIfExists;
00040 plist::Primitive<bool> logSensors;
00041 plist::Primitive<bool> logImages;
00042 plist::Primitive<bool> initial;
00043 plist::Primitive<std::string> compression;
00044
00045 protected:
00046 std::ofstream indexFile;
00047 std::string path;
00048 unsigned int startTime;
00049 unsigned int fileCount;
00050 unsigned int imageStartFrame;
00051 unsigned int sensorStartFrame;
00052
00053
00054
00055
00056
00057 public:
00058 virtual void postStart();
00059 virtual void doEvent();
00060 virtual void stop();
00061
00062 virtual void writeImage(unsigned int time, class FilterBankGenerator& fbk, bool isPNG);
00063 virtual void writeSensor(unsigned int time);
00064
00065 static std::string getClassDescription() { return "On activation, start logging data to disk as a series of image and/or sensor files"; }
00066 virtual std::string getDescription() const { return getClassDescription(); }
00067
00068
00069
00070
00071
00072 private:
00073
00074
00075
00076
00077
00078 LogNode(const LogNode&);
00079 LogNode& operator=(const LogNode&);
00080 };
00081
00082
00083
00084
00085
00086
00087 #endif