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

 

         

histogram.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This copy of Orca is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010  
00011 #ifndef HISTOGRAM_H
00012 #define HISTOGRAM_H
00013 
00014 #include <string>
00015 #include <vector>
00016 
00017 namespace delaymon
00018 {
00019 
00020 // not thread-safe
00021 class Histogram
00022 {
00023 public:
00024     // start, end, stride in [ms]
00025     // stride must be positive
00026     // histogram must have at least 1 bin
00027     Histogram( int startEdge, int endEdge, int stride, const std::string& fileprefix );
00028     ~Histogram();
00029 
00030     void addValue( int );
00031 
00032     const std::vector<int>& counters() const { return counters_; };
00033 
00034     // -inf and +inf are not included even though those values are counted
00035     std::vector<int> edges() const;
00036 
00037     std::string toString() const;
00038 
00039 private:
00040     // the bins are defined as follows:
00041     //  [-inf, start)
00042     //  [start, start+stride)
00043     //  [start+strid, start+2*stride)
00044     //  ...
00045     //  [start+N-1*stride, start+N*stride)
00046     //  [start+N*stride, +inf)
00047     //
00048     // where (start+N*stride) <= end
00049     std::vector<int> counters_;
00050     int start_;
00051     int end_;
00052     int stride_;
00053 
00054     int bin( int value );
00055 
00056     std::ofstream *file_;
00057 };
00058 
00059 } // namespace
00060 
00061 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5