-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace boost with C++11 where applicable [DISCL-391]
Notes: - FramePtr must remain a boost::shared_ptr as long as Tide is serializing it and does not mandate boost >= 1.56. - boost::signals2 for Stream::disconnected is hard to replace, however it is only used internally by QmlStreamerImpl.cpp. - program_options and unit_test could be optional.
- Loading branch information
Raphael Dumusc
committed
Sep 26, 2016
1 parent
757a3a0
commit 28652a5
Showing
20 changed files
with
137 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,8 @@ | |
#include "Frame.h" | ||
#include "ReceiveBuffer.h" | ||
|
||
#include <cassert> | ||
|
||
namespace deflect | ||
{ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*********************************************************************/ | ||
/* Copyright (c) 2013-2015, EPFL/Blue Brain Project */ | ||
/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ | ||
/* Raphael Dumusc <[email protected]> */ | ||
/* [email protected] */ | ||
/* All rights reserved. */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*********************************************************************/ | ||
/* Copyright (c) 2013-2015, EPFL/Blue Brain Project */ | ||
/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ | ||
/* Raphael Dumusc <[email protected]> */ | ||
/* [email protected] */ | ||
/* All rights reserved. */ | ||
|
@@ -47,7 +47,7 @@ | |
#include <deflect/MTQueue.h> | ||
#include <deflect/Segment.h> | ||
|
||
#include <boost/function/function1.hpp> | ||
#include <functional> | ||
#include <vector> | ||
|
||
namespace deflect | ||
|
@@ -63,7 +63,7 @@ class ImageSegmenter | |
DEFLECT_API ImageSegmenter(); | ||
|
||
/** Function called on each segment. */ | ||
typedef boost::function< bool( const Segment& ) > Handler; | ||
using Handler = std::function< bool( const Segment& ) >; | ||
|
||
/** | ||
* Generate segments. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*********************************************************************/ | ||
/* Copyright (c) 2013-2014, EPFL/Blue Brain Project */ | ||
/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ | ||
/* [email protected] */ | ||
/* All rights reserved. */ | ||
/* */ | ||
|
@@ -47,7 +47,7 @@ namespace deflect | |
StreamSendWorker::StreamSendWorker( StreamPrivate& stream ) | ||
: _stream( stream ) | ||
, _running( true ) | ||
, _thread( boost::bind( &StreamSendWorker::_run, this )) | ||
, _thread( std::bind( &StreamSendWorker::_run, this )) | ||
{} | ||
|
||
StreamSendWorker::~StreamSendWorker() | ||
|
@@ -57,7 +57,7 @@ StreamSendWorker::~StreamSendWorker() | |
|
||
void StreamSendWorker::_run() | ||
{ | ||
boost::mutex::scoped_lock lock( _mutex ); | ||
std::unique_lock<std::mutex> lock( _mutex ); | ||
while( true ) | ||
{ | ||
while( _requests.empty() && _running ) | ||
|
@@ -75,7 +75,7 @@ void StreamSendWorker::_run() | |
void StreamSendWorker::_stop() | ||
{ | ||
{ | ||
boost::mutex::scoped_lock lock( _mutex ); | ||
std::lock_guard<std::mutex> lock( _mutex ); | ||
_running = false; | ||
_condition.notify_all(); | ||
} | ||
|
@@ -90,7 +90,7 @@ void StreamSendWorker::_stop() | |
|
||
Stream::Future StreamSendWorker::enqueueImage( const ImageWrapper& image ) | ||
{ | ||
boost::mutex::scoped_lock lock( _mutex ); | ||
std::lock_guard<std::mutex> lock( _mutex ); | ||
PromisePtr promise( new Promise ); | ||
_requests.push_back( Request( promise, image )); | ||
_condition.notify_all(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*********************************************************************/ | ||
/* Copyright (c) 2013-2014, EPFL/Blue Brain Project */ | ||
/* Copyright (c) 2013-2016, EPFL/Blue Brain Project */ | ||
/* [email protected] */ | ||
/* All rights reserved. */ | ||
/* */ | ||
|
@@ -40,12 +40,8 @@ | |
#ifndef DEFLECT_STREAMSENDWORKER_H | ||
#define DEFLECT_STREAMSENDWORKER_H | ||
|
||
// needed for future.hpp with Boost 1.41 | ||
#include <boost/thread/mutex.hpp> | ||
#include <boost/thread/condition.hpp> | ||
|
||
#include <boost/thread/future.hpp> | ||
#include <boost/thread/thread.hpp> | ||
#include <mutex> | ||
#include <thread> | ||
#include <deque> | ||
|
||
#include "Stream.h" // Stream::Future | ||
|
@@ -76,16 +72,16 @@ class StreamSendWorker | |
/** Stop the worker and clear any pending image send requests. */ | ||
void _stop(); | ||
|
||
typedef boost::promise< bool > Promise; | ||
typedef boost::shared_ptr< Promise > PromisePtr; | ||
typedef std::pair< PromisePtr, ImageWrapper > Request; | ||
using Promise = std::promise< bool >; | ||
using PromisePtr = std::shared_ptr< Promise >; | ||
using Request = std::pair< PromisePtr, ImageWrapper >; | ||
|
||
StreamPrivate& _stream; | ||
std::deque< Request > _requests; | ||
boost::mutex _mutex; | ||
boost::condition _condition; | ||
std::mutex _mutex; | ||
std::condition_variable _condition; | ||
bool _running; | ||
boost::thread _thread; | ||
std::thread _thread; | ||
}; | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.