Commit c5b9a7f0 authored by Alois Schlögl's avatar Alois Schlögl

By using C++17 all dependencies on boost can be replaced.

parent 47077b26
......@@ -211,8 +211,8 @@ endif
CC ?= $(shell $(WXCONF) --cc)
CXX ?= $(shell $(WXCONF) --cxx)
CFLAGS = $(DEFINES) $(shell $(WXCONF) --cflags) -fstack-protector -O2
CPPFLAGS = $(DEFINES) $(shell $(WXCONF) --cppflags) -std=gnu++11 -fstack-protector -O2
CXXFLAGS = $(DEFINES) $(shell $(WXCONF) --cxxflags) -std=gnu++11 -fstack-protector -O2
CPPFLAGS = $(DEFINES) $(shell $(WXCONF) --cppflags) -std=gnu++17 -fstack-protector -O2
CXXFLAGS = $(DEFINES) $(shell $(WXCONF) --cxxflags) -std=gnu++17 -fstack-protector -O2
LIBS += $(shell $(WXCONF) --libs net,adv,aui,core,base)
......@@ -227,11 +227,6 @@ mandir = ${datarootdir}/man
PKGCONF ?= $(CROSS)pkg-config
ifeq (5,$(shell $(CXX) -v 2>&1 | awk '/gcc version / {print substr($$3,1,1)}' ))
# g++-5 changes default ABI, if WX was compiled with an earlier compiler
CXXFLAGS += -fabi-version=2
endif
CPPFLAGS += -I$(WXDIR)
## HDF5 related stuff ##
......@@ -261,7 +256,7 @@ else
LDFLAGS += -L/usr/lib/$(PLATFORM)
LIBS += -lhdf5_serial_hl -lhdf5_serial
else
LIBS += -lhdf5_hl -lhdf5
LIBS += -lhdf5_hl -lhdf5 -lz
endif
endif
endif
......@@ -283,9 +278,8 @@ LIBS += -lfftw3
ifeq (mingw,$(findstring mingw, $(WXCONF)))
LIBS += -lgfortran -lquadmath
LIBS += -liberty -liconv
endif
LIBS += -liconv -ltinyxml -lstdc++
LIBS += -ltinyxml -lstdc++
##############################################################
......
......@@ -14,7 +14,11 @@
#pragma once
#include <stdlib.h>
#include <boost/shared_array.hpp>
#if (__cplusplus < 201402L)
# include <boost/shared_array.hpp>
#else
# include <memory>
#endif
#if defined(__UNIX__) || defined(__STF__)
#define max(a,b) (((a) > (b)) ? (a) : (b))
......@@ -29,7 +33,11 @@ template<class ITEM>
class CArrayPtr
{
private: // Private data.
#if (__cplusplus < 201402L)
boost::shared_array<ITEM> m_pArray;
#else
std::shared_ptr<ITEM> m_pArray;
#endif
private: // Prevent copy constructors and operator=().
CArrayPtr(const CArrayPtr &);
......
......@@ -13,7 +13,11 @@
#define INC_FILEREADCACHE_HPP
#include "./../Common/FileIO.hpp"
#include <boost/shared_array.hpp>
#if (__cplusplus < 201402L)
# include <boost/shared_array.hpp>
#else
# include <memory>
#endif
//-----------------------------------------------------------------------------------------------
// CFileReadCache class definition
......@@ -27,7 +31,11 @@ private:
UINT m_uCacheSize;
UINT m_uCacheStart;
UINT m_uCacheCount;
#if (__cplusplus < 201402L)
boost::shared_array<BYTE> m_pItemCache;
#else
std::shared_ptr<BYTE> m_pItemCache;
#endif
private: // Unimplemented default member functions.
// Declare but don't define copy constructors to prevent use of defaults.
......
......@@ -16,6 +16,8 @@
#include "../axon/AxAbfFio32/filedesc.hpp"
#if (__cplusplus < 201103)
#include <boost/shared_ptr.hpp>
#else
#include <memory>
#endif
//===============================================================================================
......
......@@ -25,7 +25,12 @@
#define _STFIO_H_
#include <iostream>
#include <boost/function.hpp>
#if (__cplusplus < 201103)
# include <boost/function.hpp>
#else
# include <algorithm>
# include <functional>
#endif
#include <vector>
#include <deque>
#include <map>
......
......@@ -33,7 +33,15 @@
#include <vector>
#include <complex>
#include <deque>
#include <boost/function.hpp>
#if (__cplusplus < 201103)
# include <boost/function.hpp>
#else
# include <algorithm>
# include <cassert>
# include <functional>
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
......@@ -42,8 +50,8 @@
#ifdef _MSC_VER
#define INFINITY (DBL_MAX+DBL_MAX)
#ifndef NAN
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define NAN (*(const float *) __nan)
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define NAN (*(const float *) __nan)
#endif
#endif
......@@ -61,6 +69,8 @@ namespace stfnum {
* that takes a double (the x-value) and a vector of parameters and returns
* the function's result (the y-value).
*/
#if (__cplusplus < 201103)
typedef boost::function<double(double, const Vector_double&)> Func;
//! The jacobian of a stfnum::Func.
......@@ -69,6 +79,17 @@ typedef boost::function<Vector_double(double, const Vector_double&)> Jac;
//! Scaling function for fit parameters
typedef boost::function<double(double, double, double, double, double)> Scale;
#else
typedef std::function<double(double, const Vector_double&)> Func;
//! The jacobian of a stfnum::Func.
typedef std::function<Vector_double(double, const Vector_double&)> Jac;
//! Scaling function for fit parameters
typedef std::function<double(double, double, double, double, double)> Scale;
#endif
//! Dummy function, serves as a placeholder to initialize functions without a Jacobian.
Vector_double nojac( double x, const Vector_double& p);
......@@ -203,16 +224,29 @@ private:
std::vector< std::string > colLabels;
};
#if (__cplusplus < 201103)
//! Print the output of a fit into a stfnum::Table.
typedef boost::function<Table(const Vector_double&,const std::vector<stfnum::parInfo>,double)> Output;
//! Default fit output function, constructing a stfnum::Table from the parameters, their description and chisqr.
Table defaultOutput(const Vector_double& pars,
Table defaultOutput(const Vector_double& pars,
const std::vector<parInfo>& parsInfo,
double chisqr);
//! Initialising function for the parameters in stfnum::Func to start a fit.
typedef boost::function<void(const Vector_double&, double, double, double, double, double, Vector_double&)> Init;
#else
//! Print the output of a fit into a stfnum::Table.
typedef std::function<Table(const Vector_double&,const std::vector<stfnum::parInfo>,double)> Output;
//! Default fit output function, constructing a stfnum::Table from the parameters, their description and chisqr.
Table defaultOutput(const Vector_double& pars,
const std::vector<parInfo>& parsInfo,
double chisqr);
//! Initialising function for the parameters in stfnum::Func to start a fit.
typedef std::function<void(const Vector_double&, double, double, double, double, double, Vector_double&)> Init;
#endif
//! Function used for least-squares fitting.
/*! Objects of this class are used for fitting functions
......
......@@ -27,6 +27,9 @@
#ifndef _WINDOWS
#if (__cplusplus < 201103)
#include <boost/function.hpp>
#else
#include <algorithm>
#include <memory>
#endif
#endif
......
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