INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

logcompressor.h

00001 #ifndef HYDROICEUTIL_LOGCOMPRESSOR_H
00002 #define HYDROICEUTIL_LOGCOMPRESSOR_H
00003 
00004 #include <hydroiceutil/detail/syslogger.h>
00005 #include <gbxsickacfr/gbxiceutilacfr/timer.h>
00006 
00007 namespace hydroiceutil {
00008 
00009 namespace detail {
00010 
00011 //
00012 // @brief Watches for repeated messages, tells when to compress with e.g. "Last message repeated 543 times".
00013 //
00014 // @author Alex Brooks
00015 //
00016 class LogCompressor
00017 {
00018 
00019 public: 
00020 
00021     //
00022     // We recommend "Last message repeated XXX times" when either:
00023     //   - We've been silent for more than maxSilenceSec seconds, or
00024     //   - We've accumulated maxRepeatCount repeats.
00025     //
00026     LogCompressor( int maxRepeatCount, double maxSilenceSec );
00027 
00028     // Tells us what to write when a new message is generated.
00029     // It's possible for _both_ shouldWriteInFull and shouldWriteRepeatMessage to be set,
00030     // if there's a backlog of repeated messages when a new message is generated.
00031     //
00032     // If shouldWriteRepeatMessage is set, both numRepeats and
00033     // repeatedMessage will also be set.
00034     //
00035     void newMsgGenerated( const std::string &msg,
00036                           bool              &shouldWriteInFull,
00037                           bool              &shouldWriteRepeatMessage,
00038                           int               &numRepeats,
00039                           std::string       &repeatedMessage );
00040 
00041 private: 
00042 
00043     gbxiceutilacfr::Timer lastWriteTimer_;
00044     std::string           lastMessage_;
00045     int                   repeatCount_;
00046 
00047     const int    maxRepeatCount_;
00048     const double maxSilenceSec_;
00049 };
00050 
00051 }
00052 }
00053 
00054 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5