Commit ea89879d authored by Christophe Gonzales's avatar Christophe Gonzales

clang reformating of the updated source files

parent f4fb7904
Pipeline #23242454 canceled with stages
in 79 minutes 32 seconds
......@@ -91,11 +91,11 @@ namespace gum {
const char* zeMsg,
const void* zePtr,
int zeSize) {
debug_mutex.lock ();
debug_mutex.lock();
__show_trace(zeKey, zeFile, zeLine, zeMsg, zePtr);
__creation()[zeKey]++;
__sizeof()[zeKey] = zeSize;
debug_mutex.unlock ();
debug_mutex.unlock();
}
// to handle static element of agrum library
......@@ -104,10 +104,10 @@ namespace gum {
long zeLine,
const char* zeMsg,
const void* zePtr) {
debug_mutex.lock ();
debug_mutex.lock();
__show_trace(zeKey, zeFile, zeLine, zeMsg, zePtr);
__creation()[zeKey]--;
debug_mutex.unlock ();
debug_mutex.unlock();
}
void __inc_deletion(const char* zeKey,
......@@ -115,10 +115,10 @@ namespace gum {
long zeLine,
const char* zeMsg,
const void* zePtr) {
debug_mutex.lock ();
debug_mutex.lock();
__show_trace(zeKey, zeFile, zeLine, zeMsg, zePtr);
__deletion()[zeKey]++;
debug_mutex.unlock ();
debug_mutex.unlock();
}
void __dumpObjects() {
......
......@@ -226,7 +226,7 @@ namespace gum {
* can contain the range of the observed values in the database. */
template < template < typename > class XALLOC >
DBTranslator4ContinuousVariable(
const IContinuousVariable& var,
const IContinuousVariable& var,
const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
const bool fit_range = false,
const allocator_type& alloc = allocator_type());
......@@ -246,9 +246,9 @@ namespace gum {
* parameter is on, the range of the variable is updated so that it
* can contain the range of the observed values in the database. */
DBTranslator4ContinuousVariable(
const IContinuousVariable& var,
const bool fit_range = false,
const allocator_type& alloc = allocator_type());
const IContinuousVariable& var,
const bool fit_range = false,
const allocator_type& alloc = allocator_type());
/// copy constructor
DBTranslator4ContinuousVariable(
......
......@@ -46,7 +46,7 @@ namespace gum {
alloc) :
DBTranslator< ALLOC >(
DBTranslatedValueType::CONTINUOUS, missing_symbols, fit_range, 1, alloc),
__variable("var", ""), __fit_range(fit_range) {
__variable("var", ""), __fit_range(fit_range) {
// Here, if fit_range is set to false, and the range of the
// random variable will remain (-inf,+inf). So all the missing symbols
// that are numbers should be discarded since they lie in the domain
......@@ -73,8 +73,8 @@ namespace gum {
__variable.setLowerBound(std::numeric_limits< float >::infinity());
// store a copy of the variable, that should be used by method variable ()
__real_variable = __variable.clone ();
__real_variable = __variable.clone();
GUM_CONSTRUCTOR(DBTranslator4ContinuousVariable);
}
......@@ -95,7 +95,7 @@ namespace gum {
__variable.setLowerBound(std::numeric_limits< float >::infinity());
// store a copy of the variable, that should be used by method variable ()
__real_variable = __variable.clone ();
__real_variable = __variable.clone();
GUM_CONSTRUCTOR(DBTranslator4ContinuousVariable);
}
......@@ -138,7 +138,7 @@ namespace gum {
}
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4ContinuousVariable);
}
......@@ -162,12 +162,12 @@ namespace gum {
__variable.setUpperBound(upper_bound);
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4ContinuousVariable);
}
/// default constructor with a IContinuous variable as translator
template < template < typename > class ALLOC >
template < template < typename > class XALLOC >
......@@ -181,8 +181,8 @@ namespace gum {
DBTranslatedValueType::CONTINUOUS, missing_symbols, fit_range, 1, alloc),
__variable(var.name(), var.description()), __fit_range(fit_range) {
// get the bounds of the range variable
const float lower_bound = var.lowerBoundAsDouble ();
const float upper_bound = var.upperBoundAsDouble ();
const float lower_bound = var.lowerBoundAsDouble();
const float upper_bound = var.upperBoundAsDouble();
__variable.setLowerBound(lower_bound);
__variable.setUpperBound(upper_bound);
......@@ -205,8 +205,8 @@ namespace gum {
}
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4ContinuousVariable);
}
......@@ -214,8 +214,8 @@ namespace gum {
/// default constructor with a IContinuous variable as translator
template < template < typename > class ALLOC >
DBTranslator4ContinuousVariable< ALLOC >::DBTranslator4ContinuousVariable(
const IContinuousVariable& var,
const bool fit_range,
const IContinuousVariable& var,
const bool fit_range,
const typename DBTranslator4ContinuousVariable< ALLOC >::allocator_type&
alloc) :
DBTranslator< ALLOC >(
......@@ -228,12 +228,12 @@ namespace gum {
__variable.setUpperBound(upper_bound);
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4ContinuousVariable);
}
/// copy constructor with a given allocator
template < template < typename > class ALLOC >
DBTranslator4ContinuousVariable< ALLOC >::DBTranslator4ContinuousVariable(
......@@ -246,7 +246,7 @@ namespace gum {
__nonfloat_missing_symbol(from.__nonfloat_missing_symbol),
__fit_range(from.__fit_range) {
// store a copy of the variable, that should be used by method variable ()
__real_variable = from.__real_variable->clone ();
__real_variable = from.__real_variable->clone();
GUM_CONS_CPY(DBTranslator4ContinuousVariable);
}
......@@ -316,8 +316,8 @@ namespace gum {
template < template < typename > class ALLOC >
INLINE DBTranslator4ContinuousVariable<
ALLOC >::~DBTranslator4ContinuousVariable() {
if ( __real_variable != nullptr ) delete __real_variable;
if (__real_variable != nullptr) delete __real_variable;
GUM_DESTRUCTOR(DBTranslator4ContinuousVariable);
}
......@@ -334,8 +334,8 @@ namespace gum {
__nonfloat_missing_symbol = from.__nonfloat_missing_symbol;
__fit_range = from.__fit_range;
if ( __real_variable != nullptr ) delete __real_variable;
__real_variable = from.__real_variable->clone ();
if (__real_variable != nullptr) delete __real_variable;
__real_variable = from.__real_variable->clone();
}
return *this;
......@@ -355,7 +355,7 @@ namespace gum {
__nonfloat_missing_symbol = std::move(from.__nonfloat_missing_symbol);
__fit_range = from.__fit_range;
if ( __real_variable != nullptr ) delete __real_variable;
if (__real_variable != nullptr) delete __real_variable;
__real_variable = from.__real_variable;
from.__real_variable = nullptr;
}
......@@ -537,9 +537,9 @@ namespace gum {
/// returns the variable stored into the translator
template < template < typename > class ALLOC >
INLINE const IContinuousVariable*
DBTranslator4ContinuousVariable< ALLOC >::variable() const {
__real_variable->setLowerBoundFromDouble ( __variable.lowerBound () );
__real_variable->setUpperBoundFromDouble ( __variable.upperBound () );
DBTranslator4ContinuousVariable< ALLOC >::variable() const {
__real_variable->setLowerBoundFromDouble(__variable.lowerBound());
__real_variable->setUpperBoundFromDouble(__variable.upperBound());
return __real_variable;
}
......
......@@ -184,7 +184,7 @@ namespace gum {
* account in the translation, not the missing value. */
template < template < typename > class XALLOC >
DBTranslator4DiscretizedVariable(
const IDiscretizedVariable& var,
const IDiscretizedVariable& var,
const std::vector< std::string, XALLOC< std::string > >& missing_symbols,
std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
const allocator_type& alloc = allocator_type());
......@@ -207,7 +207,7 @@ namespace gum {
const IDiscretizedVariable& var,
std::size_t max_dico_entries = std::numeric_limits< std::size_t >::max(),
const allocator_type& alloc = allocator_type());
/// copy constructor
DBTranslator4DiscretizedVariable(
const DBTranslator4DiscretizedVariable< ALLOC >& from);
......@@ -314,7 +314,7 @@ namespace gum {
/// returns the variable stored into the translator
virtual const IDiscretizedVariable* variable() const final;
/// @}
......
......@@ -98,7 +98,7 @@ namespace gum {
}
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4DiscretizedVariable);
}
......@@ -126,9 +126,9 @@ namespace gum {
}
// copy the ticks of var into our internal variable
const auto ticks = var.ticksAsDoubles ();
const auto ticks = var.ticksAsDoubles();
for (const auto tick : ticks) {
__variable.addTick( (float) tick );
__variable.addTick((float)tick);
}
// the the bounds of the discretized variable
......@@ -165,7 +165,7 @@ namespace gum {
}
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4DiscretizedVariable);
}
......@@ -202,7 +202,7 @@ namespace gum {
}
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4DiscretizedVariable);
}
......@@ -211,8 +211,8 @@ namespace gum {
/// default constructor with a IDiscretized variable as translator
template < template < typename > class ALLOC >
DBTranslator4DiscretizedVariable< ALLOC >::DBTranslator4DiscretizedVariable(
const IDiscretizedVariable& var,
std::size_t max_dico_entries,
const IDiscretizedVariable& var,
std::size_t max_dico_entries,
const typename DBTranslator4DiscretizedVariable< ALLOC >::allocator_type&
alloc) :
DBTranslator< ALLOC >(
......@@ -227,7 +227,7 @@ namespace gum {
// copy the ticks of var into our internal variable
const auto ticks = var.ticksAsDoubles();
for (const auto tick : ticks) {
__variable.addTick((float) tick);
__variable.addTick((float)tick);
}
// add the content of the variable into the back dictionary
......@@ -238,7 +238,7 @@ namespace gum {
}
// store a copy of the variable, that should be used by method variable ()
__real_variable = var.clone ();
__real_variable = var.clone();
GUM_CONSTRUCTOR(DBTranslator4DiscretizedVariable);
}
......@@ -250,11 +250,11 @@ namespace gum {
const DBTranslator4DiscretizedVariable< ALLOC >& from,
const typename DBTranslator4DiscretizedVariable< ALLOC >::allocator_type&
alloc) :
DBTranslator< ALLOC >(from, alloc),
__variable(from.__variable) {
DBTranslator< ALLOC >(from, alloc),
__variable(from.__variable) {
// store a copy of the variable, that should be used by method variable ()
__real_variable = from.__real_variable->clone ();
__real_variable = from.__real_variable->clone();
GUM_CONS_CPY(DBTranslator4DiscretizedVariable);
}
......@@ -277,7 +277,7 @@ namespace gum {
// moves the copy of the variable, that should be used by method variable ()
__real_variable = from.__real_variable;
from.__real_variable = nullptr;
GUM_CONS_MOV(DBTranslator4DiscretizedVariable);
}
......@@ -297,7 +297,7 @@ namespace gum {
const typename DBTranslator4DiscretizedVariable< ALLOC >::allocator_type&
alloc) const {
ALLOC< DBTranslator4DiscretizedVariable< ALLOC > > allocator(alloc);
DBTranslator4DiscretizedVariable< ALLOC >* translator =
DBTranslator4DiscretizedVariable< ALLOC >* translator =
allocator.allocate(1);
try {
allocator.construct(translator, *this, alloc);
......@@ -321,8 +321,8 @@ namespace gum {
template < template < typename > class ALLOC >
INLINE DBTranslator4DiscretizedVariable<
ALLOC >::~DBTranslator4DiscretizedVariable() {
if ( __real_variable != nullptr ) delete __real_variable;
if (__real_variable != nullptr) delete __real_variable;
GUM_DESTRUCTOR(DBTranslator4DiscretizedVariable);
}
......@@ -336,8 +336,8 @@ namespace gum {
DBTranslator< ALLOC >::operator=(from);
__variable = from.__variable;
if ( __real_variable != nullptr ) delete __real_variable;
__real_variable = from.__real_variable->clone ();
if (__real_variable != nullptr) delete __real_variable;
__real_variable = from.__real_variable->clone();
}
return *this;
......@@ -353,7 +353,7 @@ namespace gum {
DBTranslator< ALLOC >::operator=(std::move(from));
__variable = std::move(from.__variable);
if ( __real_variable != nullptr ) delete __real_variable;
if (__real_variable != nullptr) delete __real_variable;
__real_variable = from.__real_variable;
from.__real_variable = nullptr;
}
......
......@@ -276,8 +276,7 @@ namespace gum {
}
case VarType::Range: {
const RangeVariable& xvar =
static_cast< const RangeVariable& >(var);
const RangeVariable& xvar = static_cast< const RangeVariable& >(var);
DBTranslator4RangeVariable< ALLOC > translator(xvar, missing_symbols);
return insertTranslator(translator, column);
}
......@@ -301,7 +300,7 @@ namespace gum {
DBTranslatorSet< ALLOC >::insertTranslator(const Variable& var,
const std::size_t column) {
const std::vector< std::string, ALLOC< std::string > > missing;
return this->insertTranslator (var, column, missing);
return this->insertTranslator(var, column, missing);
}
......
......@@ -469,7 +469,7 @@ namespace gum {
allocator2.deallocate(__end_safe, 1);
throw;
}
} catch ( ... ) {
} catch (...) {
allocator1.destroy(__end);
allocator1.deallocate(__end, 1);
throw;
......
......@@ -244,7 +244,7 @@ namespace gum {
// insert the translator into the translator set
const std::size_t pos =
__translators.insertTranslator (var, input_column, missing_symbols);
__translators.insertTranslator(var, input_column, missing_symbols);
// insert the name of the translator's variable to the set of variable names
try {
......
......@@ -36,7 +36,7 @@ namespace gum {
// the object that casts correctly the discrete variable sequences
// within the hash table of instantiations
typename HashFuncCastKey< const DiscreteVariable* >::type
HashFunc< Instantiation >::__caster;
HashFunc< Instantiation >::__caster;
// Default constructor
Instantiation::Instantiation() : __master(nullptr), __overflow(false) {
......
......@@ -1241,9 +1241,8 @@ namespace gum {
* @ingroup hashfunctions_group
*/
template <>
//class HashFunc< Instantiation > : public HashFuncBase< Instantiation > {
class HashFunc< Instantiation > :
public HashFunc<Size> {
// class HashFunc< Instantiation > : public HashFuncBase< Instantiation > {
class HashFunc< Instantiation > : public HashFunc< Size > {
public:
/**
* @brief Computes the hashed value of a key.
......@@ -1252,7 +1251,7 @@ namespace gum {
*/
Size operator()(const Instantiation& key) const;
private:
private:
static typename HashFuncCastKey< const DiscreteVariable* >::type __caster;
};
} /* namespace gum */
......
......@@ -810,9 +810,9 @@ namespace gum {
Size h = 0;
for (const auto k :
key.variablesSequence()) // k are unique only by address (not by name)
h += __caster.castToSize(k) * (Size) key.val(*k);
h += __caster.castToSize(k) * (Size)key.val(*k);
return HashFunc<Size>::operator() ( h );
return HashFunc< Size >::operator()(h);
}
INLINE bool Instantiation::operator==(const Instantiation& other) const {
......
......@@ -20,6 +20,5 @@
#include <agrum/variables/IContinuousVariable.h>
#ifdef GUM_NO_INLINE
#include <agrum/variables/IContinuousVariable_inl.h>
# include <agrum/variables/IContinuousVariable_inl.h>
#endif /* GUM_NO_INLINE */
......@@ -41,15 +41,14 @@ namespace gum {
* GUM_SCALAR type
*/
class IContinuousVariable : public Variable {
public:
public:
// ############################################################################
/// @name Constructors / Destructors
// ############################################################################
/// @{
/// Default constructor
IContinuousVariable( const std::string& aName,
const std::string& aDesc );
IContinuousVariable(const std::string& aName, const std::string& aDesc);
/** Copy Constructor.
*
......@@ -57,10 +56,10 @@ namespace gum {
*
* @param from the variable we copy
*/
IContinuousVariable(const IContinuousVariable& from );
IContinuousVariable(const IContinuousVariable& from);
/// move constructor
IContinuousVariable( IContinuousVariable&& from);
IContinuousVariable(IContinuousVariable&& from);
/// destructor
virtual ~IContinuousVariable();
......@@ -85,33 +84,30 @@ namespace gum {
/// 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;
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 setUpperBoundFromDouble (const double new_bound) = 0;
/// @}
virtual void setUpperBoundFromDouble(const double new_bound) = 0;
/// @}
protected:
protected:
/// copy operator
IContinuousVariable& operator=(const IContinuousVariable& from );
IContinuousVariable& operator=(const IContinuousVariable& from);
/// move operator
IContinuousVariable& operator=( IContinuousVariable&& from );
IContinuousVariable& operator=(IContinuousVariable&& from);
};
} /* namespace gum */
#ifndef GUM_NO_INLINE
#include <agrum/variables/IContinuousVariable_inl.h>
# include <agrum/variables/IContinuousVariable_inl.h>
#endif /* GUM_NO_INLINE */
#endif /* GUM_I_CONTINUOUS_VARIABLE_H */
......@@ -25,51 +25,51 @@
*/
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#include <agrum/variables/IContinuousVariable.h>
# include <agrum/variables/IContinuousVariable.h>
namespace gum {
/// Default constructor
INLINE
IContinuousVariable::IContinuousVariable( const std::string& aName,
const std::string& aDesc )
: Variable ( aName, aDesc ) {}
IContinuousVariable::IContinuousVariable(const std::string& aName,
const std::string& aDesc) :
Variable(aName, aDesc) {}
/// Copy Constructor
INLINE
IContinuousVariable::IContinuousVariable(const IContinuousVariable& from )
: Variable ( from ) {}
IContinuousVariable::IContinuousVariable(const IContinuousVariable& from) :
Variable(from) {}
/// move constructor
INLINE
IContinuousVariable::IContinuousVariable( IContinuousVariable&& from)
: Variable ( std::move ( from ) ) {}
IContinuousVariable::IContinuousVariable(IContinuousVariable&& from) :
Variable(std::move(from)) {}
/// destructor
INLINE
IContinuousVariable::~IContinuousVariable() {}
/// copy operator
INLINE IContinuousVariable&
IContinuousVariable::operator=(const IContinuousVariable& from ) {
Variable::operator= ( from );
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 ) );
INLINE IContinuousVariable& IContinuousVariable::
operator=(IContinuousVariable&& from) {
Variable::operator=(std::move(from));
return *this;
}
} /* namespace gum */
......
......@@ -20,6 +20,5 @@
#include <agrum/variables/IDiscretizedVariable.h>
#ifdef GUM_NO_INLINE
#include <agrum/variables/IDiscretizedVariable_inl.h>
# include <agrum/variables/IDiscretizedVariable_inl.h>
#endif /* GUM_NO_INLINE */
......@@ -35,15 +35,14 @@ namespace gum {
* @brief A base class for discretized variables, independent of the ticks type
*/
class IDiscretizedVariable : public DiscreteVariable {
public:
public:
// ############################################################################
/// @name Constructors / Destructors
// ############################################################################
/// @{
/// Default constructor
IDiscretizedVariable( const std::string& aName,
const std::string& aDesc );
IDiscretizedVariable(const std::string& aName, const std::string& aDesc);
/** Copy Constructor.
*
......@@ -51,7 +50,7 @@ namespace gum {
*
* @param from the variable we copy
*/
IDiscretizedVariable(const IDiscretizedVariable& from );
IDiscretizedVariable(const IDiscretizedVariable& from);
/// destructor
virtual ~IDiscretizedVariable();
......@@ -68,24 +67,22 @@ namespace gum {
/// @{
/// return the list of ticks as a vector of doubles
virtual std::vector<double> ticksAsDoubles () const = 0;
virtual std::vector< double > ticksAsDoubles() const = 0;
/// @}
protected:
protected:
/// copy operator
IDiscretizedVariable& operator=(const IDiscretizedVariable& from );
IDiscretizedVariable& operator=(const IDiscretizedVariable& from);
};
} /* namespace gum */
#ifndef GUM_NO_INLINE
#include <agrum/variables/IDiscretizedVariable_inl.h>
# include <agrum/variables/IDiscretizedVariable_inl.h>
#endif /* GUM_NO_INLINE */
#endif /* GUM_I_DISCRETIZED_VARIABLE_H */
......@@ -22,20 +22,20 @@
namespace gum {
/// Default constructor
INLINE
IDiscretizedVariable::IDiscretizedVariable( const std::string& aName,
const std::string& aDesc )
: DiscreteVariable ( aName, aDesc ) {}
IDiscretizedVariable::IDiscretizedVariable(const std::string& aName,
const std::string& aDesc) :
DiscreteVariable(aName, aDesc) {}
/// Copy Constructor
INLINE
IDiscretizedVariable::IDiscretizedVariable(const IDiscretizedVariable& from )
: DiscreteVariable ( from ) {}
IDiscretizedVariable::IDiscretizedVariable(const IDiscretizedVariable& from) :
DiscreteVariable(from) {}
/// destructor
INLINE
IDiscretizedVariable::~IDiscretizedVariable() {}
......@@ -43,13 +43,13 @@ namespace gum {
/// copy assignment
INLINE