|
From: <tho...@us...> - 2012-07-02 20:41:26
|
Revision: 901
http://openautomation.svn.sourceforge.net/openautomation/?rev=901&view=rev
Author: thomas_s
Date: 2012-07-02 20:41:20 +0000 (Mon, 02 Jul 2012)
Log Message:
-----------
make it compile with g++-4.7
Modified Paths:
--------------
xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt
xPLHAL/branches/thomas_s_dev/src/determinator.cpp
xPLHAL/branches/thomas_s_dev/src/determinator.h
xPLHAL/branches/thomas_s_dev/src/determinator_manager.cpp
xPLHAL/branches/thomas_s_dev/src/main.cpp
xPLHAL/branches/thomas_s_dev/src/recurring_timer.cpp
xPLHAL/branches/thomas_s_dev/src/recurring_timer.h
xPLHAL/branches/thomas_s_dev/src/xplcache.h
xPLHAL/branches/thomas_s_dev/test/CMakeLists.txt
Modified: xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/CMakeLists.txt 2012-07-02 20:41:20 UTC (rev 901)
@@ -21,7 +21,7 @@
file(GLOB_RECURSE Condition_sources ./conditions/*.cpp)
#set(CMAKE_CXX_FLAGS "-g -std=c++0x")
-set(CMAKE_CXX_FLAGS "-g -O2 -std=c++0x")
+set(CMAKE_CXX_FLAGS "-g -Os -std=c++11 -ffunction-sections -fdata-sections")
set(xPLHAL_SRCS xplmessagequeue.cpp devicemanager.cpp
xplhandler.cpp xplcache.cpp xhcpthread.cpp log.cpp
xhcp.cpp xplmessage.cpp recurring_timer.cpp main.cpp pugixml.cpp
@@ -34,5 +34,5 @@
#message(STATUS "Boost_LIBRARIES=${Boost_LIBRARIES}")
#message(STATUS "LIBRARIES=${LIBS}")
#target_link_libraries(xPLHAL ${Boost_LIBRARIES} -dynamic xPL pthread -static)
-target_link_libraries(xPLHAL ${LIBS})
+target_link_libraries(xPLHAL ${LIBS} -ffunction-sections -fdata-sections)
Modified: xPLHAL/branches/thomas_s_dev/src/determinator.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinator.cpp 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/determinator.cpp 2012-07-02 20:41:20 UTC (rev 901)
@@ -201,9 +201,10 @@
{
if (checkInputs()) {
if (mExecFutures.empty() || mExecFutures[0].valid()) {
- mExecFutures.erase(mExecFutures.begin(), mExecFutures.end());
+ mExecFutures.clear();
+// mExecFutures.erase(mExecFutures.begin(), mExecFutures.end());
cerr << "determinator start thread" << endl;
- mExecFutures.push_back(std::async(std::launch::async, std::bind(&Determinator::executeOutputs, this)));
+ mExecFutures.emplace_back(std::async(std::launch::async, std::bind(&Determinator::executeOutputs, this)));
cerr << "determinator start thread" << endl;
}
}
Modified: xPLHAL/branches/thomas_s_dev/src/determinator.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinator.h 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/determinator.h 2012-07-02 20:41:20 UTC (rev 901)
@@ -46,7 +46,7 @@
bool checkInputs() const;
bool executeOutputs() const;
- std::vector<std::future<bool>> mExecFutures;
+ std::vector<std::shared_future<bool>> mExecFutures;
};
typedef std::shared_ptr<Determinator> DeterminatorPtr;
Modified: xPLHAL/branches/thomas_s_dev/src/determinator_manager.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/determinator_manager.cpp 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/determinator_manager.cpp 2012-07-02 20:41:20 UTC (rev 901)
@@ -31,7 +31,7 @@
for (auto item = directory_iterator(p); item != directory_iterator(); ++item) {
ifstream determinatorFile(*item);
- std::string filename = item->string();
+ std::string filename = item->path().string();
//storeXmlDeterminator("guid", determinatorFile.read());
cout << "diritem: " << *item << "\n";
DeterminatorXmlParser parser(filename);
Modified: xPLHAL/branches/thomas_s_dev/src/main.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/main.cpp 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/main.cpp 2012-07-02 20:41:20 UTC (rev 901)
@@ -29,7 +29,7 @@
#include "globals.h"
using boost::filesystem::path;
-using boost::filesystem::initial_path;
+using boost::filesystem::current_path;
using boost::program_options::options_description;
using boost::program_options::variables_map;
using boost::program_options::store;
Modified: xPLHAL/branches/thomas_s_dev/src/recurring_timer.cpp
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/recurring_timer.cpp 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/recurring_timer.cpp 2012-07-02 20:41:20 UTC (rev 901)
@@ -16,10 +16,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "recurring_timer.h"
-#include <boost/bind.hpp>
+using namespace std::placeholders;
+
RecurringTimer::RecurringTimer(boost::asio::io_service& io_service,
- const boost::asio::deadline_timer::duration_type& expiry_time,
+ const boost::asio::steady_timer::duration& expiry_time,
bool startTimer)
:m_timer(io_service, expiry_time)
,m_delay(expiry_time)
@@ -38,7 +39,7 @@
void RecurringTimer::start()
{
m_running = true;
- m_timer.async_wait(boost::bind(&RecurringTimer::onExpire, this, _1));
+ m_timer.async_wait(std::bind(&RecurringTimer::onExpire, this, _1));
}
void RecurringTimer::stop()
@@ -51,7 +52,7 @@
{
if (m_running) {
m_timer.expires_at(m_timer.expires_at() + m_delay);
- m_timer.async_wait(boost::bind(&RecurringTimer::onExpire, this, _1));
+ m_timer.async_wait(std::bind(&RecurringTimer::onExpire, this, _1));
}
sigExpired(e);
}
Modified: xPLHAL/branches/thomas_s_dev/src/recurring_timer.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/recurring_timer.h 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/recurring_timer.h 2012-07-02 20:41:20 UTC (rev 901)
@@ -17,7 +17,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/asio.hpp>
+#include <boost/asio/steady_timer.hpp>
#include <boost/signals2/signal.hpp>
/**
@@ -28,7 +30,7 @@
class RecurringTimer
{
public:
- RecurringTimer(boost::asio::io_service& io_service, const boost::asio::deadline_timer::duration_type& expiry_time, bool startTimer = false);
+ RecurringTimer(boost::asio::io_service& io_service, const boost::asio::steady_timer::duration& expiry_time, bool startTimer = false);
~RecurringTimer();
void start();
@@ -44,8 +46,8 @@
private:
void onExpire(const boost::system::error_code& e);
- const boost::asio::deadline_timer::duration_type m_delay;
+ const boost::asio::steady_timer::duration m_delay;
bool m_running;
- boost::asio::deadline_timer m_timer;
+ boost::asio::steady_timer m_timer;
};
Modified: xPLHAL/branches/thomas_s_dev/src/xplcache.h
===================================================================
--- xPLHAL/branches/thomas_s_dev/src/xplcache.h 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/src/xplcache.h 2012-07-02 20:41:20 UTC (rev 901)
@@ -21,14 +21,17 @@
#include <vector>
#include <map>
#include <chrono>
-#include <thread>
+#include <mutex>
#include <boost/regex.hpp>
#include "i_xplcache.h"
+
+#if !((__GNUG__ >= 4) && (__GNUC_MINOR__ >= 7))
#ifdef __GXX_EXPERIMENTAL_CXX0X__
#define steady_clock monotonic_clock
#endif
+#endif
/**
* \class xPLCacheClass
Modified: xPLHAL/branches/thomas_s_dev/test/CMakeLists.txt
===================================================================
--- xPLHAL/branches/thomas_s_dev/test/CMakeLists.txt 2012-07-02 20:40:52 UTC (rev 900)
+++ xPLHAL/branches/thomas_s_dev/test/CMakeLists.txt 2012-07-02 20:41:20 UTC (rev 901)
@@ -35,7 +35,7 @@
enable_testing()
-set(CMAKE_CXX_FLAGS "-g -Os -std=c++0x -fprofile-arcs -ftest-coverage")
+set(CMAKE_CXX_FLAGS "-g -Os -std=c++11 -fprofile-arcs -ftest-coverage")
#set(xPLHALTest_SRCS test_test.cpp test_xplcache.cpp)
#add_executable(test_runner ${xPLHALTest_SRCS})
#message(STATUS "Boost_LIBRARIES=${Boost_LIBRARIES}")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|