#ifndef __OPERAND_DISTRIBUTION_HPP_ #define __OPERAND_DISTRIBUTION_HPP_ /* "Species" - a CoreWars evolver. Copyright (C) 2003 'Varfar' * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation; either version 1, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ /* to implement a generator: * 1) derive publically from COperand * 1) give it an identifier in the EImpl enumeration * 2) make the constructor set the _type member * 3) make COperand factories understand this new implementation and how to identify it * 4) implement the read_ini/write_ini functionality */ #include "operand.hpp" #include "distribution.hpp" class COperandDistribution: public COperand, protected CDistribution { public: COperandDistribution(const field_t coresize); /* constructor creates default values */ // actual query point virtual void rnd(insn_t &instruction,const Field field); // and saving virtual void write_ini(std::ostream &os); virtual void write_override_ini(std::ostream &os,const COperand *parent); protected: // from COperand virtual void read_ini_impl(INIFile &ini); virtual COperand *read_override_ini_impl(INIFile &ini); /* loads freq values; if any freq values are specified, then a copy of this freq will be made; all unspecified values in the new class will be "inherited" from this one, and any specified values will be overriden. If nothing is specified, then this will be returned */ private: COperandDistribution(const CDistribution ©); static CDistribution *ImplFactory(const CDistribution ©); }; #endif // ifndef __OPERAND_DISTRIBUTION_HPP_