Fix clang warnings

This commit is contained in:
Simon Giraudot 2017-08-25 15:09:51 +02:00
parent aac29a8949
commit 0880106e1f
4 changed files with 32 additions and 86 deletions

View File

@ -52,13 +52,14 @@ include_directories( BEFORE ../../include )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "example_classification.cpp" )
create_single_source_cgal_program( "example_generation_and_training.cpp" )
create_single_source_cgal_program( "example_feature.cpp" )
set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates)
create_single_source_cgal_program( "example_classification.cpp" CXX_FEATURES ${needed_cxx_features} )
create_single_source_cgal_program( "example_generation_and_training.cpp" CXX_FEATURES ${needed_cxx_features} )
create_single_source_cgal_program( "example_feature.cpp" CXX_FEATURES ${needed_cxx_features} )
if( OpenCV_FOUND )
include_directories( ${OpenCV_INCLUDE_DIRS} )
create_single_source_cgal_program( "example_random_forest.cpp" )
create_single_source_cgal_program( "example_random_forest.cpp" CXX_FEATURES ${needed_cxx_features} )
target_link_libraries( example_random_forest ${OpenCV_LIBS} )
else()
message(STATUS "OpenCV not found, random forest example won't be compiled.")

View File

@ -20,6 +20,15 @@
#ifndef CGAL_CLASSIFICATION_H
#define CGAL_CLASSIFICATION_H
#if defined(CGAL_CLASSIFICATION_VERBOSE)
#define CGAL_CLASSIFICATION_SILENT false
#else
#define CGAL_CLASSIFICATION_SILENT true
#endif
#define CGAL_CLASSIFICATION_CERR \
if(CGAL_CLASSIFICATION_SILENT) {} else std::cerr
#include <CGAL/Classification/classify.h>
#include <CGAL/Classification/Sum_of_weighted_features_classifier.h>

View File

@ -74,7 +74,6 @@ public:
\return a handle to the newly added feature.
*/
#if (!defined(CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES) && !defined(CGAL_CFG_NO_CPP0X_RVALUE_REFERENCE)) || DOXYGEN_RUNNING
template <typename Feature, typename ... T>
Feature_handle add (T&& ... t)
{
@ -84,53 +83,6 @@ public:
mutex_unlock();
return fh;
}
#else
template <typename Feature, typename T1>
Feature_handle add (T1& t1)
{
Feature_handle fh (new Feature(t1));
mutex_lock();
m_features.push_back (fh);
mutex_unlock();
return fh;
}
template <typename Feature, typename T1, typename T2>
Feature_handle add (T1& t1, T2& t2)
{
Feature_handle fh (new Feature(t1, t2));
mutex_lock();
m_features.push_back (fh);
mutex_unlock();
return fh;
}
template <typename Feature, typename T1, typename T2, typename T3>
Feature_handle add (T1& t1, T2& t2, T3& t3)
{
Feature_handle fh (new Feature(t1, t2, t3));
mutex_lock();
m_features.push_back (fh);
mutex_unlock();
return fh;
}
template <typename Feature, typename T1, typename T2, typename T3, typename T4>
Feature_handle add (T1& t1, T2& t2, T3& t3, T4& t4)
{
Feature_handle fh (new Feature(t1, t2, t3, t4));
mutex_lock();
m_features.push_back (fh);
mutex_unlock();
return fh;
}
template <typename Feature, typename T1, typename T2, typename T3, typename T4, typename T5>
Feature_handle add (T1& t1, T2& t2, T3& t3, T4& t4, T5& t5)
{
Feature_handle fh (new Feature(t1, t2, t3, t4, t5));
mutex_lock();
m_features.push_back (fh);
mutex_unlock();
return fh;
}
#endif
/*!
\brief Removes a feature.

View File

@ -38,19 +38,15 @@
#include <tbb/mutex.h>
#endif // CGAL_LINKED_WITH_TBB
//#define CGAL_CLASSIFICATION_VERBOSE
#if defined(CGAL_CLASSIFICATION_VERBOSE)
#define CGAL_CLASSIFICATION_CERR std::cerr
#if defined(CGAL_CLASSTRAINING_VERBOSE)
#define CGAL_CLASSTRAINING_SILENT false
#else
#define CGAL_CLASSIFICATION_CERR std::ostream(0)
#define CGAL_CLASSTRAINING_SILENT true
#endif
//#define CGAL_CLASSTRAINING_VERBOSE
#if defined(CGAL_CLASSTRAINING_VERBOSE)
#define CGAL_CLASSTRAINING_CERR std::cerr
#else
#define CGAL_CLASSTRAINING_CERR std::ostream(0)
#endif
#define CGAL_CLASSTRAINING_CERR \
if(CGAL_CLASSIFICATION_SILENT) {} else std::cerr
namespace CGAL {
@ -150,6 +146,18 @@ private:
};
#endif // CGAL_LINKED_WITH_TBB
struct Feature_training
{
std::size_t i;
float wmin;
float wmax;
float factor;
bool operator<(const Feature_training& other) const
{
return (wmin / wmax) < (other.wmin / other.wmax);
}
};
const Label_set& m_labels;
const Feature_set& m_features;
@ -316,18 +324,6 @@ public:
std::vector<float> best_weights (m_features.size(), 1.);
struct Feature_training
{
std::size_t i;
float wmin;
float wmax;
float factor;
bool operator<(const Feature_training& other) const
{
return (wmin / wmax) < (other.wmin / other.wmax);
}
};
std::vector<Feature_training> feature_train;
std::size_t nb_trials = 100;
float wmin = 1e-5f, wmax = 1e5f;
@ -507,18 +503,6 @@ public:
std::vector<float> best_weights (m_features.size(), 1.);
struct Feature_training
{
std::size_t i;
float wmin;
float wmax;
float factor;
bool operator<(const Feature_training& other) const
{
return (wmin / wmax) < (other.wmin / other.wmax);
}
};
std::vector<Feature_training> feature_train;
std::size_t nb_trials = 100;
float wmin = 1e-5, wmax = 1e5;