Hybrid Query Processing Engine for Coprocessing in Database Systems
HyPE
measurementpair_ringbuffer.hpp
Go to the documentation of this file.
00001 /***********************************************************************************************************
00002 Copyright (c) 2012, Sebastian Breß, Otto-von-Guericke University of Magdeburg, Germany. All rights reserved.
00003 
00004 This program and accompanying materials are made available under the terms of the 
00005 GNU LESSER GENERAL PUBLIC LICENSE - Version 3, http://www.gnu.org/licenses/lgpl-3.0.txt
00006 ***********************************************************************************************************/
00007 
00008 #pragma once
00009 
00010 //C++ includes
00011 #include <iostream>
00012 #include <string>
00013 #include <vector>
00014 #include <fstream>
00015 #include <sstream>
00016 #include <limits>
00017 #include <numeric>
00018 //TR1 includes
00019 #include <memory>
00020 //C includes
00021 #include <assert.h>
00022 //#include <stdafx.h>
00023 #include <math.h>
00024 
00025 //boost includes
00026 #include <boost/circular_buffer.hpp>
00027 #include <boost/tokenizer.hpp>
00028 #include <boost/filesystem.hpp>
00029 #include <boost/lexical_cast.hpp>
00030 
00031 //hype includes
00032 #include <core/time_measurement.hpp>
00033 #include <core/measurementpair.hpp>
00034 
00035 //Alglib
00036 //#include <interpolation.h>
00037 
00038 
00039 
00040 namespace hype{
00041    namespace core{
00042 
00043       //stores measurement pairs as columns, not as rows
00044       class MeasurementPairRingbuffer{
00045       public:
00046       MeasurementPairRingbuffer();
00047    
00048       MeasurementPairRingbuffer(size_t size);
00049 
00050       unsigned int size() const throw();
00051       
00052       bool store(std::ostream &out) const;
00053 
00054       void set_maximal_number_of_measurement_pairs(size_t size);
00055 
00056       bool addMeasurementPair(const MeasurementPair& mp);
00057 
00058       //not const functions, since ring buffer has to be linearized to return column
00059       const std::vector<EstimatedTime> getColumnEstimations();
00060 
00061       const std::vector<MeasuredTime> getColumnMeasurements();
00062 
00063       const std::vector<Tuple> getColumnFeatureValues();
00064       
00065       void clear() throw();
00066       
00067       private:
00068         boost::circular_buffer<Tuple> feature_values_;//(2000);
00069         boost::circular_buffer<MeasuredTime> measured_times_;//(2000);
00070         boost::circular_buffer<EstimatedTime> estimated_times_;//(2000);   
00071 
00072       };
00073 
00074    }; //end namespace core
00075 }; //end namespace hype
00076 
00077 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines