/******************************************************************************* * Copyright (c) 2015-2016 ONERA. * Ce logiciel est la propriété de l’ONERA (the French Aerospace Lab). * Tous droits réservés. * * Ce programme et les éléments qui l'accompagnent sont mis à disposition * aux conditions définies par le contrat de licence logiciel CeCILL-C soumise * au droit français et respectant les principes de diffusion des logiciels libres. * Vous pouvez utiliser, modifier et/ou redistribuer ce programme * sous les conditions de la licence CeCILL-C (http://www.cecill.info). * This software is property of ONERA (the French Aerospace Lab). * All rights reserved. * * This program and the accompanying materials are made available under * the terms of the CeCILL-C license under French law and * abiding by the rules of distribution of free software. * You can use, modify and/ or redistribute the software under the terms of * the CeCILL-C license (http://www.cecill.info). * * Contributeurs/contributors: * Guillaume Infantes (ONERA - Centre de Toulouse) - initial API and implementation * *******************************************************************************/ #include "RangeDomain.hh" #include "Values.hh" #include #include namespace epoch { namespace altarica { RangeDomain::RangeDomain(int inf, int sup): inf_(inf), sup_(sup) { arity_ = sup-inf+1; } unsigned int RangeDomain::index(std::string arg) const { return (atoi(arg.c_str())); } std::string RangeDomain::text(unsigned int index) const { std::string s; s += index; return s; } Value * RangeDomain::toValue() const { return new ValueInt(this); } int RangeDomain::getMin() const { return inf_; } int RangeDomain::getMax() const { return sup_; } // Value * RangeDomain::getFixedValue(int i) { // return new FixedInt(i); // } Value * RangeDomain::getValue(int i) { ValueInt * oi = new ValueInt(); oi->setValue(i); return oi; } std::string RangeDomain::toString() const { std::stringstream ss; // std::string s; ss<< "["; ss<