Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

LogNode.h

Go to the documentation of this file.
00001 //-*-c++-*-
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 //! On activation, start logging data to disk as a series of image and/or sensor files
00010 class LogNode : public virtual plist::Dictionary, public StateNode {
00011 
00012   // **************************** //
00013   // ******* CONSTRUCTORS ******* //
00014   // **************************** //
00015 public:
00016   //! default constructor, use type name as instance name
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   //! constructor, take an instance name
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   // ********* MEMBERS ********** //
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   // ********* METHODS ********** //
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   // ********** OTHER *********** //
00071   // **************************** //
00072 private:
00073   // Providing declarations for these functions will avoid a compiler warning if
00074   // you have any class members which are pointers.  However, as it is, an error
00075   // will result if you inadvertantly cause a call to either (which is probably
00076   // a good thing, unless you really intended to copy/assign a behavior, in
00077   // which case simply provide implementations for the functions)
00078   LogNode(const LogNode&); //!< don't call (copy constructor)
00079   LogNode& operator=(const LogNode&); //!< don't call (assignment operator)
00080 };
00081 
00082 /*! @file
00083  * @brief Defines LogNode, which logs data to disk as a series of image and/or sensor files
00084  * @author Ethan Tira-Thompson (ejt) (Creator)
00085  */
00086 
00087 #endif

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:44 2016 by Doxygen 1.6.3