summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-01 17:18:24 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-08-01 17:18:24 +0200
commit31edd6a85f52c855d54594dc9f8ceda694d3ebea (patch)
tree60ad2c84d28a495082e0b083e072a934bc142634
parent1c25545bb03ea074b5871be3234bf0d1be20a6a3 (diff)
downloaddabmod-31edd6a85f52c855d54594dc9f8ceda694d3ebea.tar.gz
dabmod-31edd6a85f52c855d54594dc9f8ceda694d3ebea.tar.bz2
dabmod-31edd6a85f52c855d54594dc9f8ceda694d3ebea.zip
Switch to C++11, remove boost::shared_ptr
-rw-r--r--configure.ac10
-rw-r--r--src/DabMod.cpp5
-rw-r--r--src/DabModulator.cpp6
-rw-r--r--src/DabModulator.h2
-rw-r--r--src/EtiReader.cpp5
-rw-r--r--src/EtiReader.h6
-rw-r--r--src/FIRFilter.cpp13
-rw-r--r--src/FIRFilter.h6
-rw-r--r--src/Flowgraph.cpp4
-rw-r--r--src/Flowgraph.h29
-rw-r--r--src/FrameMultiplexer.cpp7
-rw-r--r--src/FrameMultiplexer.h6
-rw-r--r--src/InputReader.h6
-rw-r--r--src/InputZeroMQReader.cpp7
-rw-r--r--src/OutputUHD.cpp3
-rw-r--r--src/OutputUHD.h8
-rw-r--r--src/RemoteControl.h2
-rw-r--r--src/TimestampDecoder.cpp6
-rw-r--r--src/TimestampDecoder.h4
19 files changed, 64 insertions, 71 deletions
diff --git a/configure.ac b/configure.ac
index 0de0b22..21e5a44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,8 @@ AC_PROG_INSTALL
AC_PROG_CPP
AC_PROG_MKDIR_P
+AX_CXX_COMPILE_STDCXX_11(noext,mandatory)
+
EXTRA=""
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Enable debugger symbols])],
@@ -94,8 +96,8 @@ AS_IF([test "x$enable_zeromq" = "xyes"],
[AC_DEFINE(HAVE_ZEROMQ, [1], [Define if ZeroMQ is enabled]) ,
AC_CHECK_LIB(zmq, zmq_init, ZMQ_LIBS="-lzmq" ,[AC_MSG_ERROR([ZeroMQ libzmq is required])])])
AS_IF([test "x$enable_debug" = "xno"],
- [OPTIM="-O2" DEBUG="" EXTRA="$EXTRA -DNDEBUG"],
- [OPTIM="-O0" DEBUG="-ggdb" EXTRA="$EXTRA"])
+ [EXTRA="$EXTRA -DNDEBUG"],
+ [EXTRA="$EXTRA"])
AS_IF([test "x$enable_prof" != "xno"],
[EXTRA="$EXTRA -pg"])
@@ -114,8 +116,8 @@ AS_IF([test "x$enable_fftw" = "xyes"],
AX_PTHREAD([], AC_MSG_ERROR([requires pthread]))
-AC_SUBST([CFLAGS], ["$OPTIM $DEBUG $EXTRA $FFTW_CFLAGS $PTHREAD_CFLAGS"])
-AC_SUBST([CXXFLAGS], ["$OPTIM $DEBUG $EXTRA $FFTW_CFLAGS $PTHREAD_CFLAGS"])
+AC_SUBST([CFLAGS], ["$EXTRA $FFTW_CFLAGS $PTHREAD_CFLAGS"])
+AC_SUBST([CXXFLAGS], ["$CXXFLAGS $EXTRA $FFTW_CFLAGS $PTHREAD_CFLAGS"])
AC_SUBST([LIBS], ["$FFTW_LIBS $PTHREAD_LIBS $ZMQ_LIBS"])
# Checks for UHD.
diff --git a/src/DabMod.cpp b/src/DabMod.cpp
index 95fa603..6d67dc4 100644
--- a/src/DabMod.cpp
+++ b/src/DabMod.cpp
@@ -46,8 +46,7 @@
#include "FIRFilter.h"
#include "RemoteControl.h"
-#include <boost/shared_ptr.hpp>
-#include <boost/make_shared.hpp>
+#include <memory>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <complex>
@@ -75,7 +74,7 @@
typedef std::complex<float> complexf;
-using namespace boost;
+using namespace std;
volatile sig_atomic_t running = 1;
diff --git a/src/DabModulator.cpp b/src/DabModulator.cpp
index 8a52401..92f0acb 100644
--- a/src/DabModulator.cpp
+++ b/src/DabModulator.cpp
@@ -26,7 +26,7 @@
*/
#include <string>
-#include <boost/make_shared.hpp>
+#include <memory>
#include "DabModulator.h"
#include "PcDebug.h"
@@ -54,8 +54,6 @@
#include "RemoteControl.h"
#include "Log.h"
-using namespace boost;
-
DabModulator::DabModulator(
double tist_offset_s, unsigned tist_delay_stages,
RemoteControllers* rcs,
@@ -143,6 +141,8 @@ void DabModulator::setMode(unsigned mode)
int DabModulator::process(Buffer* const dataIn, Buffer* dataOut)
{
+ using namespace std;
+
PDEBUG("DabModulator::process(dataIn: %p, dataOut: %p)\n",
dataIn, dataOut);
diff --git a/src/DabModulator.h b/src/DabModulator.h
index cee066a..9150f5c 100644
--- a/src/DabModulator.h
+++ b/src/DabModulator.h
@@ -34,7 +34,7 @@
#include <sys/types.h>
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include "ModCodec.h"
#include "EtiReader.h"
diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp
index f584275..500101b 100644
--- a/src/EtiReader.cpp
+++ b/src/EtiReader.cpp
@@ -30,11 +30,12 @@
#include "TimestampDecoder.h"
#include <stdexcept>
+#include <memory>
#include <sys/types.h>
#include <string.h>
#include <arpa/inet.h>
-using namespace boost;
+using namespace std;
enum ETI_READER_STATE {
EtiReaderStateNbFrame,
@@ -101,7 +102,7 @@ unsigned EtiReader::getFp()
}
-const std::vector<boost::shared_ptr<SubchannelSource> >& EtiReader::getSubchannels()
+const std::vector<std::shared_ptr<SubchannelSource> >& EtiReader::getSubchannels()
{
return mySources;
}
diff --git a/src/EtiReader.h b/src/EtiReader.h
index 84ad9b4..a8fc8f0 100644
--- a/src/EtiReader.h
+++ b/src/EtiReader.h
@@ -39,9 +39,9 @@
#include "TimestampDecoder.h"
#include <vector>
+#include <memory>
#include <stdint.h>
#include <sys/types.h>
-#include <boost/shared_ptr.hpp>
class EtiReader
@@ -58,7 +58,7 @@ public:
FicSource* getFic();
unsigned getMode();
unsigned getFp();
- const std::vector<boost::shared_ptr<SubchannelSource> >& getSubchannels();
+ const std::vector<std::shared_ptr<SubchannelSource> >& getSubchannels();
int process(const Buffer* dataIn);
void calculateTimestamp(struct frame_timestamp& ts)
@@ -84,7 +84,7 @@ protected:
eti_EOF eti_eof;
eti_TIST eti_tist;
FicSource* myFicSource;
- std::vector<boost::shared_ptr<SubchannelSource> > mySources;
+ std::vector<std::shared_ptr<SubchannelSource> > mySources;
TimestampDecoder myTimestampDecoder;
private:
diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp
index b1ce618..9ef49c5 100644
--- a/src/FIRFilter.cpp
+++ b/src/FIRFilter.cpp
@@ -35,8 +35,7 @@
#include <iostream>
#include <fstream>
-
-#include <boost/make_shared.hpp>
+#include <memory>
#ifdef __AVX__
# include <immintrin.h>
@@ -60,10 +59,10 @@ void FIRFilterWorker::process(struct FIRFilterWorkerData *fwd)
// the incoming buffer
while(running) {
- boost::shared_ptr<Buffer> dataIn;
+ std::shared_ptr<Buffer> dataIn;
fwd->input_queue.wait_and_pop(dataIn);
- boost::shared_ptr<Buffer> dataOut = boost::make_shared<Buffer>();
+ std::shared_ptr<Buffer> dataOut = make_shared<Buffer>();
dataOut->setLength(dataIn->getLength());
PDEBUG("FIRFilterWorker: dataIn->getLength() %zu\n", dataIn->getLength());
@@ -393,13 +392,13 @@ int FIRFilter::process(Buffer* const dataIn, Buffer* dataOut)
// This thread creates the dataIn buffer, and deletes
// the outgoing buffer
- boost::shared_ptr<Buffer> inbuffer =
- boost::make_shared<Buffer>(dataIn->getLength(), dataIn->getData());
+ std::shared_ptr<Buffer> inbuffer =
+ make_shared<Buffer>(dataIn->getLength(), dataIn->getData());
firwd.input_queue.push(inbuffer);
if (number_of_runs > 2) {
- boost::shared_ptr<Buffer> outbuffer;
+ std::shared_ptr<Buffer> outbuffer;
firwd.output_queue.wait_and_pop(outbuffer);
dataOut->setData(outbuffer->getData(), outbuffer->getLength());
diff --git a/src/FIRFilter.h b/src/FIRFilter.h
index 751be91..28b2f4a 100644
--- a/src/FIRFilter.h
+++ b/src/FIRFilter.h
@@ -30,7 +30,6 @@
#endif
#include <boost/thread.hpp>
-#include <boost/shared_ptr.hpp>
#include "RemoteControl.h"
#include "ModCodec.h"
@@ -43,6 +42,7 @@
#include <time.h>
#include <cstdio>
#include <string>
+#include <memory>
#define FIRFILTER_PIPELINE_DELAY 1
@@ -52,8 +52,8 @@ struct FIRFilterWorkerData {
/* Thread-safe queues to give data to and get data from
* the worker
*/
- ThreadsafeQueue<boost::shared_ptr<Buffer> > input_queue;
- ThreadsafeQueue<boost::shared_ptr<Buffer> > output_queue;
+ ThreadsafeQueue<std::shared_ptr<Buffer> > input_queue;
+ ThreadsafeQueue<std::shared_ptr<Buffer> > output_queue;
/* Remote-control can change the taps while the filter
* runs. This lock makes sure nothing bad happens when
diff --git a/src/Flowgraph.cpp b/src/Flowgraph.cpp
index 3844e86..e36c1f4 100644
--- a/src/Flowgraph.cpp
+++ b/src/Flowgraph.cpp
@@ -26,7 +26,7 @@
#include "Flowgraph.h"
#include "PcDebug.h"
-
+#include <memory>
#if HAVE_DECL__MM_MALLOC
# include <mm_malloc.h>
@@ -43,7 +43,7 @@
#include <sys/time.h>
#endif
-using namespace boost;
+using namespace std;
typedef std::vector<shared_ptr<Node> >::iterator NodeIterator;
typedef std::vector<shared_ptr<Edge> >::iterator EdgeIterator;
diff --git a/src/Flowgraph.h b/src/Flowgraph.h
index 1129668..9c6c2d8 100644
--- a/src/Flowgraph.h
+++ b/src/Flowgraph.h
@@ -34,24 +34,23 @@
#include "porting.h"
#include "ModPlugin.h"
-
+#include <memory>
#include <sys/types.h>
#include <vector>
-#include <boost/shared_ptr.hpp>
class Node
{
public:
- Node(boost::shared_ptr<ModPlugin> plugin);
+ Node(std::shared_ptr<ModPlugin> plugin);
~Node();
Node(const Node&);
Node& operator=(const Node&);
- boost::shared_ptr<ModPlugin> plugin() { return myPlugin; }
+ std::shared_ptr<ModPlugin> plugin() { return myPlugin; }
- std::vector<boost::shared_ptr<Buffer> > myInputBuffers;
- std::vector<boost::shared_ptr<Buffer> > myOutputBuffers;
+ std::vector<std::shared_ptr<Buffer> > myInputBuffers;
+ std::vector<std::shared_ptr<Buffer> > myOutputBuffers;
int process();
time_t processTime() { return myProcessTime; }
@@ -60,7 +59,7 @@ public:
}
protected:
- boost::shared_ptr<ModPlugin> myPlugin;
+ std::shared_ptr<ModPlugin> myPlugin;
time_t myProcessTime;
};
@@ -68,15 +67,15 @@ protected:
class Edge
{
public:
- Edge(boost::shared_ptr<Node>& src, boost::shared_ptr<Node>& dst);
+ Edge(std::shared_ptr<Node>& src, std::shared_ptr<Node>& dst);
~Edge();
Edge(const Edge&);
Edge& operator=(const Edge&);
protected:
- boost::shared_ptr<Node> mySrcNode;
- boost::shared_ptr<Node> myDstNode;
- boost::shared_ptr<Buffer> myBuffer;
+ std::shared_ptr<Node> mySrcNode;
+ std::shared_ptr<Node> myDstNode;
+ std::shared_ptr<Buffer> myBuffer;
};
@@ -88,13 +87,13 @@ public:
Flowgraph(const Flowgraph&);
Flowgraph& operator=(const Flowgraph&);
- void connect(boost::shared_ptr<ModPlugin> input,
- boost::shared_ptr<ModPlugin> output);
+ void connect(std::shared_ptr<ModPlugin> input,
+ std::shared_ptr<ModPlugin> output);
bool run();
protected:
- std::vector<boost::shared_ptr<Node> > nodes;
- std::vector<boost::shared_ptr<Edge> > edges;
+ std::vector<std::shared_ptr<Node> > nodes;
+ std::vector<std::shared_ptr<Edge> > edges;
time_t myProcessTime;
};
diff --git a/src/FrameMultiplexer.cpp b/src/FrameMultiplexer.cpp
index 843f72d..efd43f3 100644
--- a/src/FrameMultiplexer.cpp
+++ b/src/FrameMultiplexer.cpp
@@ -25,16 +25,15 @@
#include <stdio.h>
#include <stdexcept>
#include <complex>
+#include <memory>
#include <assert.h>
#include <string.h>
typedef std::complex<float> complexf;
-using namespace boost;
-
FrameMultiplexer::FrameMultiplexer(
size_t framesize,
- const std::vector<shared_ptr<SubchannelSource> >* subchannels) :
+ const std::vector<std::shared_ptr<SubchannelSource> >* subchannels) :
ModMux(ModFormat(framesize), ModFormat(framesize)),
d_frameSize(framesize),
mySubchannels(subchannels)
@@ -79,7 +78,7 @@ int FrameMultiplexer::process(std::vector<Buffer*> dataIn, Buffer* dataOut)
++in;
// Write subchannel
assert(mySubchannels->size() == dataIn.size() - 1);
- std::vector<shared_ptr<SubchannelSource> >::const_iterator subchannel =
+ std::vector<std::shared_ptr<SubchannelSource> >::const_iterator subchannel =
mySubchannels->begin();
while (in != dataIn.end()) {
assert((*subchannel)->framesizeCu() * 8 == (*in)->getLength());
diff --git a/src/FrameMultiplexer.h b/src/FrameMultiplexer.h
index ba571f6..b32a0d7 100644
--- a/src/FrameMultiplexer.h
+++ b/src/FrameMultiplexer.h
@@ -29,7 +29,7 @@
#include "ModMux.h"
#include "SubchannelSource.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <sys/types.h>
@@ -38,7 +38,7 @@ class FrameMultiplexer : public ModMux
{
public:
FrameMultiplexer(size_t frameSize,
- const std::vector<boost::shared_ptr<SubchannelSource> >* subchannels);
+ const std::vector<std::shared_ptr<SubchannelSource> >* subchannels);
virtual ~FrameMultiplexer();
FrameMultiplexer(const FrameMultiplexer&);
FrameMultiplexer& operator=(const FrameMultiplexer&);
@@ -49,7 +49,7 @@ public:
protected:
size_t d_frameSize;
- const std::vector<boost::shared_ptr<SubchannelSource> >* mySubchannels;
+ const std::vector<std::shared_ptr<SubchannelSource> >* mySubchannels;
};
#endif // FRAME_MULTIPLEXER_H
diff --git a/src/InputReader.h b/src/InputReader.h
index b262cc9..b8c4fae 100644
--- a/src/InputReader.h
+++ b/src/InputReader.h
@@ -32,7 +32,7 @@
#include <cstdio>
#include <vector>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#if defined(HAVE_ZEROMQ)
# include "zmq.hpp"
# include "ThreadsafeQueue.h"
@@ -147,7 +147,7 @@ struct zmq_input_overflow : public std::exception
struct InputZeroMQThreadData
{
- ThreadsafeQueue<boost::shared_ptr<std::vector<uint8_t> > > *in_messages;
+ ThreadsafeQueue<std::shared_ptr<std::vector<uint8_t> > > *in_messages;
std::string uri;
unsigned max_queued_frames;
@@ -206,7 +206,7 @@ class InputZeroMQReader : public InputReader
std::string uri_;
InputZeroMQWorker worker_;
- ThreadsafeQueue<boost::shared_ptr<std::vector<uint8_t> > > in_messages_;
+ ThreadsafeQueue<std::shared_ptr<std::vector<uint8_t> > > in_messages_;
struct InputZeroMQThreadData workerdata_;
};
diff --git a/src/InputZeroMQReader.cpp b/src/InputZeroMQReader.cpp
index 36d4e4b..70b0afc 100644
--- a/src/InputZeroMQReader.cpp
+++ b/src/InputZeroMQReader.cpp
@@ -37,7 +37,6 @@
#include <stdint.h>
#include "zmq.hpp"
#include <boost/thread/thread.hpp>
-#include <boost/make_shared.hpp>
#include "porting.h"
#include "InputReader.h"
#include "PcDebug.h"
@@ -85,7 +84,7 @@ int InputZeroMQReader::GetNextFrame(void* buffer)
{
const size_t framesize = 6144;
- boost::shared_ptr<std::vector<uint8_t> > incoming;
+ std::shared_ptr<std::vector<uint8_t> > incoming;
/* Do some prebuffering because reads will happen in bursts
* (4 ETI frames in TM1) and we should make sure that
@@ -168,8 +167,8 @@ void InputZeroMQWorker::RecvProcess(struct InputZeroMQThreadData* workerdata)
// TODO error handling
}
else {
- boost::shared_ptr<std::vector<uint8_t> > buf =
- boost::make_shared<std::vector<uint8_t> >(6144, 0x55);
+ std::shared_ptr<std::vector<uint8_t> > buf =
+ std::make_shared<std::vector<uint8_t> >(6144, 0x55);
const int framesize = dab_msg->buflen[i];
diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp
index adc7b9a..e71a625 100644
--- a/src/OutputUHD.cpp
+++ b/src/OutputUHD.cpp
@@ -46,7 +46,6 @@
#include <errno.h>
#include <unistd.h>
-using namespace boost;
using namespace std;
typedef std::complex<float> complexf;
@@ -226,7 +225,7 @@ OutputUHD::OutputUHD(
SetDelayBuffer(myConf.dabMode);
- shared_ptr<barrier> b(new barrier(2));
+ auto b = std::make_shared<boost::barrier>(2);
mySyncBarrier = b;
uwd.sync_barrier = b;
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index 8234340..88be215 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -49,8 +49,8 @@ DESCRIPTION:
#include <uhd/usrp/multi_usrp.hpp>
#include <boost/thread/thread.hpp>
#include <boost/thread/barrier.hpp>
-#include <boost/shared_ptr.hpp>
#include <list>
+#include <memory>
#include <string>
#include "Log.h"
@@ -127,7 +127,7 @@ struct UHDWorkerData {
bool muting;
// A barrier to synchronise the two threads
- boost::shared_ptr<boost::barrier> sync_barrier;
+ std::shared_ptr<boost::barrier> sync_barrier;
// What to do when the reference clock PLL loses lock
refclk_lock_loss_behaviour_t refclk_lock_loss_behaviour;
@@ -247,7 +247,7 @@ class OutputUHD: public ModOutput, public RemoteControllable {
EtiReader *myEtiReader;
OutputUHDConfig myConf;
uhd::usrp::multi_usrp::sptr myUsrp;
- boost::shared_ptr<boost::barrier> mySyncBarrier;
+ std::shared_ptr<boost::barrier> mySyncBarrier;
UHDWorker worker;
bool first_run;
bool gps_fix_verified;
@@ -281,7 +281,7 @@ class OutputUHD: public ModOutput, public RemoteControllable {
static const int initial_gps_fix_wait = 180;
// Interval for checking the GPS at runtime
- static const double gps_fix_check_interval = 10.0; // seconds
+ static constexpr double gps_fix_check_interval = 10.0; // seconds
void check_gps();
diff --git a/src/RemoteControl.h b/src/RemoteControl.h
index 0a4848f..b94ed6c 100644
--- a/src/RemoteControl.h
+++ b/src/RemoteControl.h
@@ -42,8 +42,6 @@
#include <string>
#include <iostream>
#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/asio.hpp>
#include <boost/foreach.hpp>
#include <boost/tokenizer.hpp>
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp
index 5044366..2cfb281 100644
--- a/src/TimestampDecoder.cpp
+++ b/src/TimestampDecoder.cpp
@@ -28,8 +28,6 @@
#include <iostream>
#include <fstream>
#include <string>
-#include <boost/lexical_cast.hpp>
-#include <boost/make_shared.hpp>
#include <sys/types.h>
#include "PcDebug.h"
#include "TimestampDecoder.h"
@@ -42,8 +40,8 @@
void TimestampDecoder::calculateTimestamp(struct frame_timestamp& ts)
{
- boost::shared_ptr<struct frame_timestamp> ts_queued =
- boost::make_shared<struct frame_timestamp>();
+ std::shared_ptr<struct frame_timestamp> ts_queued =
+ std::make_shared<struct frame_timestamp>();
/* Push new timestamp into queue */
ts_queued->timestamp_valid = full_timestamp_received_mnsc;
diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h
index d8ab633..9420506 100644
--- a/src/TimestampDecoder.h
+++ b/src/TimestampDecoder.h
@@ -28,7 +28,7 @@
#define TIMESTAMP_DECODER_H
#include <queue>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <string>
#include <time.h>
#include <math.h>
@@ -192,7 +192,7 @@ class TimestampDecoder : public RemoteControllable
* synchronise two modulators if only one uses (for instance) the
* FIRFilter (1 stage pipeline)
*/
- std::queue<boost::shared_ptr<struct frame_timestamp> > queue_timestamps;
+ std::queue<std::shared_ptr<struct frame_timestamp> > queue_timestamps;
};