Hybrid Query Processing Engine for Coprocessing in Database Systems
HyPE
operation.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 #include <string>
00011 #include <map>
00012 #include <vector>
00013 #include <memory>
00014 
00015 #include <core/algorithm.hpp>
00016 #include <core/optimization_criterion.hpp>
00017 
00018 
00019 namespace hype{
00020    namespace core{
00021 
00038       class Operation{
00039 
00040          public:
00041             typedef std::map<std::string,std::tr1::shared_ptr<Algorithm> > MapNameToAlgorithm;
00042 
00043             Operation(const std::string& name);
00044 
00045             ~Operation();
00046 
00047             //void addAlgorithm(std::string name);
00048 
00049             bool addAlgorithm(const std::string& name_of_algorithm, 
00050                               DeviceSpecification comp_dev,
00051                               const std::string& name_of_statistical_method, 
00052                               const std::string& name_of_recomputation_strategy);
00053 
00054             void removeAlgorithm(const std::string& name);
00055 
00056             //const std::vector< std::tr1::shared_ptr<Algorithm> >
00057             const SchedulingDecision getOptimalAlgorithm(const Tuple& input_values, DeviceTypeConstraint dev_constr = ANY_DEVICE);
00058 
00060             bool hasAlgorithm(const std::string& name_of_algorithm);
00061 
00062             const AlgorithmPtr getAlgorithm(const std::string& name_of_algorithm);
00063 
00064             bool setNewOptimizationCriterion(const std::string& name_of_optimization_criterion);
00065 
00066             bool addObservation(const std::string& name_of_algorithm, const MeasurementPair& mp);
00067 
00068             const std::vector<AlgorithmPtr> getAlgorithms();
00069 
00070             const std::map<double,std::string> getEstimatedExecutionTimesforAlgorithms(const Tuple& input_values);
00071 
00072             const std::string getName() const throw();
00073 
00074             void incrementNumberOfRightDecisions() throw();
00075             void incrementNumberOfTotalDecisions() throw();
00076 
00077             uint64_t getNextTimestamp() throw();
00078             uint64_t getCurrentTimestamp() const throw();
00079 
00080 
00081 
00082          private:
00083             //std::map<std::string,std::tr1::shared_ptr<Algorithm> > map_algorithmname_to_pointer_;
00084             MapNameToAlgorithm map_algorithmname_to_pointer_;
00085             std::tr1::shared_ptr<OptimizationCriterion_Internal> ptr_to_optimization_criterion_;
00086             //std::tr1::shared_ptr<OptimizationCriterion> optimization_criterion_;
00087             std::string name_;
00088             unsigned int number_of_right_decisions_;
00089             unsigned int number_of_total_decisions_;
00090             uint64_t logical_time_;
00091       };
00092 
00093       
00094    }; //end namespace core
00095 }; //end namespace hype
00096 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines