00001 /* 00002 * Copyright (C) 2005 Roland Philippsen <roland dot philippsen at gmx net> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00017 * USA 00018 */ 00019 00020 00021 #ifndef ESTAR_RISKMAP_HPP 00022 #define ESTAR_RISKMAP_HPP 00023 00024 00025 namespace estar { 00026 00027 00031 class RiskMap 00032 { 00033 public: 00034 virtual ~ RiskMap() { } 00035 virtual double RiskToMeta(double risk) const = 0; 00036 virtual double MetaToRisk(double meta) const = 0; 00037 }; 00038 00039 00042 class DummyRiskMap 00043 : public RiskMap 00044 { 00045 public: 00046 DummyRiskMap(double risk, double meta) 00047 : dummy_risk(risk), dummy_meta(meta) { } 00048 virtual double RiskToMeta(double risk) const { return dummy_meta; }; 00049 virtual double MetaToRisk(double meta) const { return dummy_risk; }; 00050 const double dummy_risk, dummy_meta; 00051 }; 00052 00053 00056 class InvertRiskMap 00057 : public RiskMap 00058 { 00059 public: 00060 virtual double RiskToMeta(double risk) const { return 1 - risk; }; 00061 virtual double MetaToRisk(double meta) const { return 1 - meta; }; 00062 }; 00063 00064 } 00065 00066 #endif // ESTAR_RISKMAP_HPP