Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5b571ad

Browse files
committed
Merge pull request#181 from glynos/restructure_dirs
Restructure dirs
2 parents5f6cce5 +6f51e04 commit5b571ad

File tree

254 files changed

+13623
-762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+13623
-762
lines changed

‎CMakeLists.txt‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,11 @@ endif()
4343

4444
if (${CMAKE_CXX_COMPILER_ID}MATCHES GNU)
4545
INCLUDE(CheckCXXCompilerFlag)
46-
CHECK_CXX_COMPILER_FLAG(-std=c++0x HAVE_STD0X)
4746
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
4847
if (HAVE_STD11)
4948
set(CMAKE_CXX_FLAGS -std=c++11)
50-
elseif (HAVE_STD0X)
51-
set(CMAKE_CXX_FLAGS -std=c++0x)
5249
else()
53-
message(FATAL_ERROR"No advanced standard C++ support (-std=c++0x and -std=c++11 not defined).")
50+
message(FATAL_ERROR"No advanced standard C++ support (-std=c++11 not defined).")
5451
endif()
5552
elseif(${CMAKE_CXX_COMPILER_ID}MATCHES Clang)
5653
INCLUDE(CheckCXXCompilerFlag)
@@ -81,10 +78,10 @@ if (Boost_FOUND)
8178
if(CPP-NETLIB_BUILD_TESTS)
8279
enable_testing()
8380
endif()
84-
add_subdirectory(libs/network/src)
81+
#add_subdirectory(libs/network/src)
8582
if(CPP-NETLIB_BUILD_TESTS)
8683
enable_testing()
87-
add_subdirectory(libs/network/test)
84+
#add_subdirectory(libs/network/test)
8885
if (NOTMSVC)
8986
#add_subdirectory(libs/mime/test)
9087
endif(NOTMSVC)
@@ -113,3 +110,6 @@ message(STATUS " CPP-NETLIB_DISABLE_LOGGING: ${CPP-NETLIB_DISABLE_LOGGING}\t(
113110
add_subdirectory(uri)
114111
add_subdirectory(message)
115112
add_subdirectory(logging)
113+
add_subdirectory(concurrency)
114+
add_subdirectory(http)
115+
add_subdirectory(mime)

‎concurrency/CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) Glyn Matthews 2012.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
add_subdirectory(src)
7+
8+
if(CPP-NETLIB_BUILD_TESTS)
9+
enable_testing()
10+
add_subdirectory(test)
11+
endif(CPP-NETLIB_BUILD_TESTS)

‎concurrency/src/CMakeLists.txt‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) Glyn Matthews 2012.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
include_directories(${CPP-NETLIB_SOURCE_DIR}/concurrency/src)
7+
8+
if (${CMAKE_CXX_COMPILER_ID}MATCHES GNU)
9+
set(CPP-NETLIB_CXXFLAGS"-Wall -std=c++11")
10+
elseif (${CMAKE_CXX_COMPILER_ID}MATCHES Clang)
11+
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
12+
set(CPP-NETLIB_CXXFLAGS"-Wall -std=c++11 -stdlib=libc++")
13+
set(CPP-NETLIB_CXXFLAGS"-Wall -std=c++11 -stdlib=libc++")
14+
endif()
15+
16+
set(CPP-NETLIB_CONCURRENCY_SRCS thread_pool.cpp)
17+
add_library(cppnetlib-concurrency ${CPP-NETLIB_CONCURRENCY_SRCS})
18+
foreach (src_file ${CPP-NETLIB_CONCURRENCY_SRCS})
19+
if (${CMAKE_CXX_COMPILER_ID}MATCHES GNU)
20+
set_source_files_properties(${src_file}
21+
PROPERTIESCOMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
22+
elseif (${CMAKE_CXX_COMPILER_ID}MATCHES Clang)
23+
set_source_files_properties(${src_file}
24+
PROPERTIESCOMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
25+
endif()
26+
endforeach(src_file)

‎include/network/utils/thread_pool.hpp‎renamed to ‎concurrency/src/network/concurrency/thread_pool.hpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// Copyright 2010 Dean Michael Berris.
22
// Copyright 2012 Google, Inc.
3+
// Copyright (c) Glyn Matthews 2012.
34
// Distributed under the Boost Software License, Version 1.0.
45
// (See accompanying file LICENSE_1_0.txt or copy at
56
// http://www.boost.org/LICENSE_1_0.txt)
67

7-
#ifndefNETWORK_UTILS_THREAD_POOL_HPP_20101020
8-
#defineNETWORK_UTILS_THREAD_POOL_HPP_20101020
8+
#ifndefNETWORK_CONCURRENCY_THREAD_POOL_HPP_20101020
9+
#defineNETWORK_CONCURRENCY_THREAD_POOL_HPP_20101020
910

1011
#include<cstddef>
1112
#include<thread>
@@ -14,7 +15,7 @@
1415
#include<vector>
1516
#include<boost/asio/io_service.hpp>
1617

17-
namespacenetwork {namespaceutils {
18+
namespacenetwork {namespaceconcurrency {
1819

1920
typedef std::shared_ptr<boost::asio::io_service> io_service_ptr;
2021
typedef std::shared_ptr<std::vector<std::thread>> worker_threads_ptr;
@@ -46,7 +47,7 @@ namespace network { namespace utils {
4647
l.swap(r);
4748
}
4849

49-
}// namespaceutils
50+
}// namespaceconcurrency
5051
}// namespace network
5152

52-
#endif/*NETWORK_UTILS_THREAD_POOL_HPP_20101020*/
53+
#endif/*NETWORK_CONCURRENCY_THREAD_POOL_HPP_20101020*/

‎include/network/utils/thread_pool.ipp‎renamed to ‎concurrency/src/network/concurrency/thread_pool.ipp‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
// Copyright 2011 Dean Michael Berris <dberris@google.com>.
22
// Copyright 2011 Google, Inc.
3+
// Copyright (c) Glyn Matthews 2012.
34
// Distributed under the Boost Software License, Version 1.0.
45
// (See accompanying file LICENSE_1_0.txt or copy at
56
// http://www.boost.org/LICENSE_1_0.txt)
67

7-
#ifndefNETWORK_UTILS_THREAD_POOL_IPP_20111021
8-
#defineNETWORK_UTILS_THREAD_POOL_IPP_20111021
8+
#ifndefNETWORK_CONCURRENCY_THREAD_POOL_IPP_20111021
9+
#defineNETWORK_CONCURRENCY_THREAD_POOL_IPP_20111021
910

1011
#include<vector>
1112
#include<thread>
12-
#include<network/utils/thread_pool.hpp>
13+
#include<network/concurrency/thread_pool.hpp>
1314
#include<boost/scope_exit.hpp>
1415

15-
namespacenetwork {namespaceutils {
16+
namespacenetwork {namespaceconcurrency {
1617

1718
structthread_pool_pimpl {
1819
thread_pool_pimpl(std::size_t threads =1,
@@ -109,7 +110,7 @@ namespace network { namespace utils {
109110
delete pimpl;
110111
}
111112

112-
}// namespaceutils
113+
}// namespaceconcurrency
113114
}// namespace network
114115

115-
#endif/*NETWORK_UTILS_THREAD_POOL_IPP_20111021*/
116+
#endif/*NETWORK_CONCURRENCY_THREAD_POOL_IPP_20111021*/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Glyn Matthews 2012.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
7+
#ifndef __NETWORK_UTILS_THREAD_POOL_INC__
8+
#define__NETWORK_UTILS_THREAD_POOL_INC__
9+
10+
#include<network/concurrency/thread_pool.hpp>
11+
12+
namespacenetwork {
13+
namespaceutils {
14+
typedef ::network::concurrency::thread_pool thread_pool;
15+
}// namespace utils
16+
}// namespace network
17+
18+
19+
#endif// __NETWORK_UTILS_THREAD_POOL_INC__
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Copyright 2011 Dean Michael Berris <dberris@google.com>.
22
// Copyright 2011 Google, Inc.
3+
// Copyright (c) Glyn Matthews 2012.
34
// Distributed under the Boost Software License, Version 1.0.
45
// (See accompanying file LICENSE_1_0.txt or copy at
56
// http://www.boost.org/LICENSE_1_0.txt)
67

7-
#include<network/utils/thread_pool.ipp>
8+
#include<network/concurrency/thread_pool.ipp>

‎concurrency/test/CMakeLists.txt‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) Glyn Matthews 2012.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
include_directories(${CPP-NETLIB_SOURCE_DIR}/concurrency/src)
7+
8+
if (${CMAKE_CXX_COMPILER_ID}MATCHES GNU)
9+
set(CPP-NETLIB_CXXFLAGS"-Wall -std=c++11")
10+
elseif (${CMAKE_CXX_COMPILER_ID}MATCHES Clang)
11+
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
12+
set(CPP-NETLIB_CXXFLAGS"-Wall -std=c++11 -stdlib=libc++")
13+
set(CPP-NETLIB_CXXFLAGS"-Wall -std=c++11 -stdlib=libc++")
14+
endif()
15+
16+
set_source_files_properties(thread_pool_test.cpp
17+
PROPERTIESCOMPILE_FLAGS"-Wall")
18+
add_executable(cpp-netlib-thread_pool_test thread_pool_test.cpp)
19+
target_link_libraries(cpp-netlib-thread_pool_test
20+
cppnetlib-concurrency
21+
${Boost_LIBRARIES}
22+
${CMAKE_THREAD_LIBS_INIT})
23+
set_target_properties(cpp-netlib-thread_pool_test
24+
PROPERTIESRUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
25+
add_test(cpp-netlib-thread_pool_test ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-thread_pool_test)
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11

22
// Copyright 2010 Dean Michael Berris.
33
// Copyright 2012 Google, Inc.
4+
// Copyright (c) Glyn Matthews 2012.
45
// Distributed under the Boost Software License, Version 1.0.
56
// (See accompanying file LICENSE_1_0.txt or copy at
67
// http://www.boost.org/LICENSE_1_0.txt)
78

89
#ifdef BUILD_SHARED_LIBS
910
#defineBOOST_TEST_DYN_LINK
1011
#endif
11-
#defineBOOST_TEST_MODULEutilsthread pool test
12+
#defineBOOST_TEST_MODULE thread pool test
1213
#include<boost/config/warning_disable.hpp>
1314
#include<boost/test/unit_test.hpp>
14-
#include<network/utils/thread_pool.hpp>
15+
#include<network/concurrency/thread_pool.hpp>
1516
#include<boost/bind.hpp>
1617

17-
usingnamespacenetwork;
18+
using network::concurrency::thread_pool;
1819

1920
// This test specifies the requirements for a thread pool interface. At the
2021
// very least any thread pool implementation should be able to pass the simple
@@ -25,29 +26,29 @@ using namespace network;
2526
//
2627

2728
BOOST_AUTO_TEST_CASE( default_constructor ) {
28-
utils::thread_pool pool;
29-
BOOST_CHECK_EQUAL(pool.thread_count(),std::size_t(1));
29+
thread_pool pool;
30+
BOOST_CHECK_EQUAL(pool.thread_count(),std::size_t(1));
3031
}
3132

3233
structfoo {
33-
foo() : val_(0) {}
34-
voidbar(int val) {
35-
val_ += val;
36-
}
37-
intconstval()const {
38-
return val_;
39-
}
34+
foo() : val_(0) {}
35+
voidbar(int val) {
36+
val_ += val;
37+
}
38+
intconstval()const {
39+
return val_;
40+
}
4041
protected:
41-
int val_;
42+
int val_;
4243
};
4344

4445
BOOST_AUTO_TEST_CASE( post_work ) {
45-
foo instance;
46-
{
47-
utils::thread_pool pool;
48-
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance,1)));
49-
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance,2)));
50-
// require that pool is destroyed here, RAII baby
51-
}
52-
BOOST_CHECK_EQUAL(instance.val(),3);
46+
foo instance;
47+
{
48+
thread_pool pool;
49+
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance,1)));
50+
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance,2)));
51+
// require that pool is destroyed here, RAII baby
52+
}
53+
BOOST_CHECK_EQUAL(instance.val(),3);
5354
}

‎http/CMakeLists.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) Glyn Matthews 2012.
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
add_subdirectory(src)
7+
8+
if(CPP-NETLIB_BUILD_TESTS)
9+
enable_testing()
10+
add_subdirectory(test)
11+
endif(CPP-NETLIB_BUILD_TESTS)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp