Commit b79d7fa7 authored by Christophe Gonzales's avatar Christophe Gonzales

adding bastract classes for continuous and discretized variables

parent 85855161
Pipeline #23120244 passed with stages
in 68 minutes 53 seconds
/*************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* 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 2 of the License, 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <agrum/variables/IContinuousVariable.h>
#ifdef GUM_NO_INLINE
#include <agrum/variables/IContinuousVariable_inl.h>
#endif /* GUM_NO_INLINE */
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* 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 2 of the License, 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file
* @brief Header of IContinuousVariable.
*
* @author Christophe GONZALES and Pierre-Henri WUILLEMIN
*/
#ifndef GUM_I_CONTINUOUS_VARIABLE_H
#define GUM_I_CONTINUOUS_VARIABLE_H
#include <iostream>
#include <string>
#include <agrum/agrum.h>
#include <agrum/variables/variable.h>
namespace gum {
class IContinuousVariable : public Variable {
public:
// ############################################################################
/// @name Constructors / Destructors
// ############################################################################
/// @{
/// Default constructor
IContinuousVariable( const std::string& aName,
const std::string& aDesc );
/** Copy Constructor.
*
* If from has any listener, it will not be copied.
*
* @param from the variable we copy
*/
IContinuousVariable(const IContinuousVariable& from );
/// move constructor
IContinuousVariable( IContinuousVariable&& from);
/// destructor
virtual ~IContinuousVariable();
/// Copy Factory
virtual IContinuousVariable* clone() const = 0;
/// @}
// ############################################################################
/// @name Accessors / Modifiers
// ############################################################################
/// @{
/// returns the lower bound of the domain of the variable as a float
virtual float lowerBoundAsFloat() const = 0;
/// returns the lower bound of the domain of the variable as a double
virtual double lowerBoundAsDouble() const = 0;
/// returns the upper bound of the domain of the variable as a float
virtual float upperBoundAsFloat() const = 0;
/// returns the upper bound of the domain of the variable as a double
virtual double upperBoundAsDouble() const = 0;
/// updates the lower bound of the domain of the variable
/** @throw OutOfBounds is raised if the new bound is higher than the
* current upper bound. */
virtual void setLowerBoundFromFloat (const float new_bound) = 0;
/// updates the lower bound of the domain of the variable
/** @throw OutOfBounds is raised if the new bound is higher than the
* current upper bound. */
virtual void setLowerBoundFromDouble (const double new_bound) = 0;
/// updates the lower bound of the domain of the variable
/** @throw OutOfBounds is raised if the new bound is lower than the
* current lower bound */
virtual void setUpperBoundFromFloat (const float new_bound) = 0;
/// updates the lower bound of the domain of the variable
/** @throw OutOfBounds is raised if the new bound is lower than the
* current lower bound */
virtual void setUpperBoundFromDouble (const double new_bound) = 0;
/// @}
protected:
/// copy operator
IContinuousVariable& operator=(const IContinuousVariable& from );
/// move operator
IContinuousVariable& operator=( IContinuousVariable&& from );
};
} /* namespace gum */
#ifndef GUM_NO_INLINE
#include <agrum/variables/IContinuousVariable_inl.h>
#endif /* GUM_NO_INLINE */
#endif /* GUM_I_CONTINUOUS_VARIABLE_H */
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* 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 2 of the License, 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/**
* @file
* @brief Inline implementations of IContinuousVariable.
*
* @author Christophe GONZALES and Pierre-Henri WUILLEMIN
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#include <agrum/variables/IContinuousVariable.h>
namespace gum {
/// Default constructor
INLINE
IContinuousVariable::IContinuousVariable( const std::string& aName,
const std::string& aDesc )
: Variable ( aName, aDesc ) {}
/// Copy Constructor
INLINE
IContinuousVariable::IContinuousVariable(const IContinuousVariable& from )
: Variable ( from ) {}
/// move constructor
INLINE
IContinuousVariable::IContinuousVariable( IContinuousVariable&& from)
: Variable ( std::move ( from ) ) {}
/// destructor
INLINE
IContinuousVariable::~IContinuousVariable() {}
/// copy operator
INLINE IContinuousVariable&
IContinuousVariable::operator=(const IContinuousVariable& from ) {
Variable::operator= ( from );
return *this;
}
/// move operator
INLINE IContinuousVariable&
IContinuousVariable::operator=( IContinuousVariable&& from ) {
Variable::operator= ( std::move ( from ) );
return *this;
}
} /* namespace gum */
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/*************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* 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 2 of the License, 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <agrum/variables/IDiscretizedVariable.h>
#ifdef GUM_NO_INLINE
#include <agrum/variables/IDiscretizedVariable_inl.h>
#endif /* GUM_NO_INLINE */
/***************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* 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 2 of the License, 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef GUM_I_DISCRETIZED_VARIABLE_H
#define GUM_I_DISCRETIZED_VARIABLE_H
#include <iostream>
#include <vector>
#include <agrum/agrum.h>
#include <agrum/variables/discreteVariable.h>
namespace gum {
class IDiscretizedVariable : public DiscreteVariable {
public:
// ############################################################################
/// @name Constructors / Destructors
// ############################################################################
/// @{
/// Default constructor
IDiscretizedVariable( const std::string& aName,
const std::string& aDesc );
/** Copy Constructor.
*
* If from has any listener, it will not be copied.
*
* @param from the variable we copy
*/
IDiscretizedVariable(const IDiscretizedVariable& from );
/// destructor
virtual ~IDiscretizedVariable();
/// Copy Factory
virtual IDiscretizedVariable* clone() const = 0;
/// @}
// ############################################################################
/// @name Accessors / Modifiers
// ############################################################################
/// @{
/// return the list of ticks as a vector of floats
virtual std::vector<float> ticksAsFloats () const = 0;
/// return the list of ticks as a vector of doubles
virtual std::vector<double> ticksAsDoubles () const = 0;
/// @}
protected:
/// copy operator
IDiscretizedVariable& operator=(const IDiscretizedVariable& from );
};
} /* namespace gum */
#ifndef GUM_NO_INLINE
#include <agrum/variables/IDiscretizedVariable_inl.h>
#endif /* GUM_NO_INLINE */
#endif /* GUM_I_DISCRETIZED_VARIABLE_H */
/*************************************************************************
* Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
* {prenom.nom}_at_lip6.fr *
* *
* 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 2 of the License, 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., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace gum {
/// Default constructor
INLINE
IDiscretizedVariable::IDiscretizedVariable( const std::string& aName,
const std::string& aDesc )
: DiscreteVariable ( aName, aDesc ) {}
/// Copy Constructor
INLINE
IDiscretizedVariable::IDiscretizedVariable(const IDiscretizedVariable& from )
: DiscreteVariable ( from ) {}
/// destructor
INLINE
IDiscretizedVariable::~IDiscretizedVariable() {}
/// copy assignment
INLINE
IDiscretizedVariable&
IDiscretizedVariable::operator=(const IDiscretizedVariable& from ) {
DiscreteVariable::operator= ( from );
return *this;
}
} /* namespace gum */
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment