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

Restructure dirs#181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
deanberris merged 5 commits intocpp-netlib:masterfromglynos:restructure_dirs
Jan 2, 2013
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletionsCMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,14 +43,11 @@ endif()

if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
INCLUDE(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG(-std=c++0x HAVE_STD0X)
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
if (HAVE_STD11)
set(CMAKE_CXX_FLAGS -std=c++11)
elseif (HAVE_STD0X)
set(CMAKE_CXX_FLAGS -std=c++0x)
else()
message(FATAL_ERROR "No advanced standard C++ support (-std=c++0x and -std=c++11 not defined).")
message(FATAL_ERROR "No advanced standard C++ support (-std=c++11 not defined).")
endif()
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
INCLUDE(CheckCXXCompilerFlag)
Expand DownExpand Up@@ -81,10 +78,10 @@ if (Boost_FOUND)
if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
endif()
add_subdirectory(libs/network/src)
#add_subdirectory(libs/network/src)
if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
add_subdirectory(libs/network/test)
#add_subdirectory(libs/network/test)
if (NOT MSVC)
#add_subdirectory(libs/mime/test)
endif(NOT MSVC)
Expand DownExpand Up@@ -113,3 +110,6 @@ message(STATUS " CPP-NETLIB_DISABLE_LOGGING: ${CPP-NETLIB_DISABLE_LOGGING}\t(
add_subdirectory(uri)
add_subdirectory(message)
add_subdirectory(logging)
add_subdirectory(concurrency)
add_subdirectory(http)
add_subdirectory(mime)
11 changes: 11 additions & 0 deletionsconcurrency/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
# Copyright (c) Glyn Matthews 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

add_subdirectory(src)

if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(CPP-NETLIB_BUILD_TESTS)
26 changes: 26 additions & 0 deletionsconcurrency/src/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
# Copyright (c) Glyn Matthews 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

include_directories(${CPP-NETLIB_SOURCE_DIR}/concurrency/src)

if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11")
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
endif()

set(CPP-NETLIB_CONCURRENCY_SRCS thread_pool.cpp)
add_library(cppnetlib-concurrency ${CPP-NETLIB_CONCURRENCY_SRCS})
foreach (src_file ${CPP-NETLIB_CONCURRENCY_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
set_source_files_properties(${src_file}
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
endif()
endforeach(src_file)
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
// Copyright 2010 Dean Michael Berris.
// Copyright 2012 Google, Inc.
// Copyright (c) Glyn Matthews 2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndefNETWORK_UTILS_THREAD_POOL_HPP_20101020
#defineNETWORK_UTILS_THREAD_POOL_HPP_20101020
#ifndefNETWORK_CONCURRENCY_THREAD_POOL_HPP_20101020
#defineNETWORK_CONCURRENCY_THREAD_POOL_HPP_20101020

#include <cstddef>
#include <thread>
Expand All@@ -14,7 +15,7 @@
#include <vector>
#include <boost/asio/io_service.hpp>

namespace network { namespaceutils {
namespace network { namespaceconcurrency {

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

} // namespaceutils
} // namespaceconcurrency
} // namespace network

#endif /*NETWORK_UTILS_THREAD_POOL_HPP_20101020 */
#endif /*NETWORK_CONCURRENCY_THREAD_POOL_HPP_20101020 */
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
// Copyright 2011 Dean Michael Berris <dberris@google.com>.
// Copyright 2011 Google, Inc.
// Copyright (c) Glyn Matthews 2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndefNETWORK_UTILS_THREAD_POOL_IPP_20111021
#defineNETWORK_UTILS_THREAD_POOL_IPP_20111021
#ifndefNETWORK_CONCURRENCY_THREAD_POOL_IPP_20111021
#defineNETWORK_CONCURRENCY_THREAD_POOL_IPP_20111021

#include <vector>
#include <thread>
#include <network/utils/thread_pool.hpp>
#include <network/concurrency/thread_pool.hpp>
#include <boost/scope_exit.hpp>

namespace network { namespaceutils {
namespace network { namespaceconcurrency {

struct thread_pool_pimpl {
thread_pool_pimpl(std::size_t threads = 1,
Expand DownExpand Up@@ -109,7 +110,7 @@ namespace network { namespace utils {
delete pimpl;
}

} // namespaceutils
} // namespaceconcurrency
} // namespace network

#endif /*NETWORK_UTILS_THREAD_POOL_IPP_20111021 */
#endif /*NETWORK_CONCURRENCY_THREAD_POOL_IPP_20111021 */
19 changes: 19 additions & 0 deletionsconcurrency/src/network/utils/thread_pool.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
// Copyright (c) Glyn Matthews 2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)


#ifndef __NETWORK_UTILS_THREAD_POOL_INC__
#define __NETWORK_UTILS_THREAD_POOL_INC__

#include <network/concurrency/thread_pool.hpp>

namespace network {
namespace utils {
typedef ::network::concurrency::thread_pool thread_pool;
} // namespace utils
} // namespace network


#endif // __NETWORK_UTILS_THREAD_POOL_INC__
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
// Copyright 2011 Dean Michael Berris <dberris@google.com>.
// Copyright 2011 Google, Inc.
// Copyright (c) Glyn Matthews 2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <network/utils/thread_pool.ipp>
#include <network/concurrency/thread_pool.ipp>
25 changes: 25 additions & 0 deletionsconcurrency/test/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
# Copyright (c) Glyn Matthews 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

include_directories(${CPP-NETLIB_SOURCE_DIR}/concurrency/src)

if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11")
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD11)
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
set(CPP-NETLIB_CXXFLAGS "-Wall -std=c++11 -stdlib=libc++")
endif()

set_source_files_properties(thread_pool_test.cpp
PROPERTIES COMPILE_FLAGS "-Wall")
add_executable(cpp-netlib-thread_pool_test thread_pool_test.cpp)
target_link_libraries(cpp-netlib-thread_pool_test
cppnetlib-concurrency
${Boost_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
set_target_properties(cpp-netlib-thread_pool_test
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
add_test(cpp-netlib-thread_pool_test ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-thread_pool_test)
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@

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

#ifdef BUILD_SHARED_LIBS
# define BOOST_TEST_DYN_LINK
#endif
#define BOOST_TEST_MODULEutilsthread pool test
#define BOOST_TEST_MODULE thread pool test
#include <boost/config/warning_disable.hpp>
#include <boost/test/unit_test.hpp>
#include <network/utils/thread_pool.hpp>
#include <network/concurrency/thread_pool.hpp>
#include <boost/bind.hpp>

usingnamespacenetwork;
using network::concurrency::thread_pool;

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

BOOST_AUTO_TEST_CASE( default_constructor ) {
utils::thread_pool pool;
BOOST_CHECK_EQUAL(pool.thread_count(), std::size_t(1));
thread_pool pool;
BOOST_CHECK_EQUAL(pool.thread_count(), std::size_t(1));
}

struct foo {
foo() : val_(0) {}
void bar(int val) {
val_ += val;
}
int const val() const {
return val_;
}
foo() : val_(0) {}
void bar(int val) {
val_ += val;
}
int const val() const {
return val_;
}
protected:
int val_;
int val_;
};

BOOST_AUTO_TEST_CASE( post_work ) {
foo instance;
{
utils::thread_pool pool;
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 1)));
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 2)));
// require that pool is destroyed here, RAII baby
}
BOOST_CHECK_EQUAL(instance.val(), 3);
foo instance;
{
thread_pool pool;
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 1)));
BOOST_CHECK_NO_THROW(pool.post(boost::bind(&foo::bar, &instance, 2)));
// require that pool is destroyed here, RAII baby
}
BOOST_CHECK_EQUAL(instance.val(), 3);
}
11 changes: 11 additions & 0 deletionshttp/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
# Copyright (c) Glyn Matthews 2012.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

add_subdirectory(src)

if(CPP-NETLIB_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif(CPP-NETLIB_BUILD_TESTS)
12 changes: 0 additions & 12 deletionslibs/network/src/CMakeLists.txt → http/src/CMakeLists.txt
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -172,18 +172,6 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
endif()
endforeach(src_file)

set(CPP-NETLIB_UTILS_THREAD_POOL_SRCS utils/thread_pool.cpp)
add_library(cppnetlib-utils-thread_pool ${CPP-NETLIB_UTILS_THREAD_POOL_SRCS})
foreach (src_file ${CPP-NETLIB_UTILS_THREAD_POOL_SRCS})
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set_source_files_properties(${src_file}
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
set_source_files_properties(${src_file}
PROPERTIES COMPILE_FLAGS ${CPP-NETLIB_CXXFLAGS})
endif()
endforeach(src_file)

set(CPP-NETLIB_CONSTANTS_SRCS constants.cpp)
add_library(cppnetlib-constants ${CPP-NETLIB_CONSTANTS_SRCS})
foreach (src_file ${CPP-NETLIB_CONSTANTS_SRCS})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletionshttp/src/network/constants.hpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
#ifndef NETWORK_CONSTANTS_HPP_20100808
#define NETWORK_CONSTANTS_HPP_20100808

// Copyright 2010 (C) Dean Michael Berris
// Copyright 2012 Google, Inc.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

namespace network {

struct constants {
static char const * crlf();
static char const * dot();
static char dot_char();
static char const * http_slash();
static char const * space();
static char space_char();
static char const * slash();
static char slash_char();
static char const * host();
static char const * colon();
static char colon_char();
static char const * accept();
static char const * default_accept_mime();
static char const * accept_encoding();
static char const * default_accept_encoding();
static char const * user_agent();
static char const * default_user_agent();
static char const * cpp_netlib_slash();
static char question_mark_char();
static char hash_char();
static char const * connection();
static char const * close();
static char const * https();
};

} // namespace network

#endif // NETWORK_CONSTANTS_HPP_20100808
Loading

[8]ページ先頭

©2009-2025 Movatter.jp