Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Search for

# BoundsCheck.h

    00001 /*
    00002  *             Copyright (C) 2005 Maarten Keijzer
    00003  *
    00004  *          This program is free software; you can redistribute it and/or modify
    00005  *          it under the terms of version 2 of the GNU General Public License as
    00006  *          published by the Free Software Foundation.
    00007  *
    00008  *          This program is distributed in the hope that it will be useful,
    00009  *          but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010  *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00011  *          GNU General Public License for more details.
    00012  *
    00013  *          You should have received a copy of the GNU General Public License
    00014  *          along with this program; if not, write to the Free Software
    00015  *          Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00016  */
    00017
    00018 #ifndef BOUNDS_CHECK_H_
    00019 #define BOUNDS_CHECK_H_
    00020
    00021 #include <string>
    00022
    00023 class IntervalBoundsCheckImpl;
    00024 class Sym;
    00025
    00026 class BoundsCheck {
    00027     public :
    00028         virtual ~BoundsCheck() {};
    00029         virtual bool in_bounds(const Sym&) const = 0;
    00030         virtual std::string get_bounds(const Sym&) const = 0;
    00031 };
    00032
    00033 // checks if a formula keeps within bounds using interval arithmetic
    00034 class IntervalBoundsCheck : public BoundsCheck {
    00035
    00036     IntervalBoundsCheckImpl* pimpl;
    00037
    00038     public:
    00039
    00040     IntervalBoundsCheck(const std::vector<double>& minima, const std::vector<double>& maxima);
    00041     ~IntervalBoundsCheck();
    00042     IntervalBoundsCheck(const IntervalBoundsCheck&);
    00043     IntervalBoundsCheck& operator=(const IntervalBoundsCheck&);
    00044
    00045     bool in_bounds(const Sym&) const;
    00046     std::string get_bounds(const Sym&) const;
    00047
    00048     std::pair<double, double> calc_bounds(const Sym&) const;
    00049 };
    00050
    00051 class NoBoundsCheck : public BoundsCheck {
    00052     bool in_bounds(const Sym&) const { return false; }
    00053     std::string get_bounds(const Sym&) const { return ""; }
    00054 };
    00055
    00056 #endif
    00057
    00058