Skip to content

Commit e5e16e5

Browse files
committed
First import of arduinized rpclib
1 parent 77c021f commit e5e16e5

File tree

1,845 files changed

+341499
-0
lines changed

Some content is hidden

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

1,845 files changed

+341499
-0
lines changed

Diff for: libraries/rpclib/.clang-format

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
Standard: Cpp11
4+
UseTab: Never
5+
ColumnLimit: 80
6+
AccessModifierOffset: -4
7+
ConstructorInitializerAllOnOneLineOrOnePerLine: true

Diff for: libraries/rpclib/.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
charset = utf-8
8+
9+
# Matches multiple files with brace expansion notation
10+
# Set default charset
11+
[*.{cc,cpp,h,hpp,hh}]
12+
indent_style = space
13+
indent_size = 4
14+
trim_trailing_whitespace = true

Diff for: libraries/rpclib/.gitignore

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.DS_Store
2+
build/
3+
.idea/
4+
.vscode/
5+
6+
doc/site/
7+
doc/doxygen/
8+
9+
*.pyc
10+
compile_commands.json
11+
CMakeLists.txt.user
12+
cppcheck*
13+
report
14+
utils/release
15+
doc/all.xml
16+
reference.md

Diff for: libraries/rpclib/.travis.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
language: c++
2+
os: linux
3+
dist: trusty
4+
sudo: required
5+
6+
matrix:
7+
include:
8+
- compiler: gcc
9+
env: RPCLIB_CXX_STANDARD=11 BUILD_TYPE=Release COVERAGE="ON"
10+
- compiler: gcc
11+
env: RPCLIB_CXX_STANDARD=14 BUILD_TYPE=Release COVERAGE="OFF"
12+
- compiler: clang
13+
env: RPCLIB_CXX_STANDARD=11 BUILD_TYPE=Release COVERAGE="OFF"
14+
- compiler: clang
15+
env: RPCLIB_CXX_STANDARD=14 BUILD_TYPE=Release COVERAGE="OFF"
16+
17+
before_install:
18+
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
19+
- sudo apt-get update -qq
20+
21+
install:
22+
- sudo apt-get install -qq g++-5
23+
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 90
24+
- wget https://cmake.org/files/v3.9/cmake-3.9.2-Linux-x86_64.sh
25+
- sudo sh cmake-3.9.2-Linux-x86_64.sh -- --skip-license --prefix=/usr
26+
27+
script:
28+
- mkdir build ; cd build
29+
- cmake -DRPCLIB_ENABLE_COVERAGE=$COVERAGE -DRPCLIB_BUILD_TESTS=ON -DRPCLIB_CXX_STANDARD=$RPCLIB_CXX_STANDARD -DCMAKE_INSTALL_PREFIX=../install ..
30+
- cmake --build . --config $BUILD_TYPE
31+
- cmake --build . --target install
32+
33+
after_success:
34+
- ./tests/rpc_test
35+
- lcov --capture --directory . --output-file coverage.info
36+
- bash <(curl -s https://codecov.io/bash)

Diff for: libraries/rpclib/.ycm_extra_conf.py

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import os
2+
import ycm_core
3+
4+
def current_path():
5+
return os.path.dirname(os.path.abspath(__file__))
6+
7+
8+
flags = [
9+
'-Wall',
10+
'-DRPCLIB_ASIO=clmdep_asio',
11+
'-DRPCLIB_FMT=clmdep_fmt',
12+
'-Wextra',
13+
'-Wno-long-long',
14+
'-Wno-variadic-macros',
15+
'-fexceptions',
16+
'-DNDEBUG',
17+
'-std=c++14',
18+
'-x',
19+
'c++',
20+
'-I', os.path.join(current_path(), 'include'),
21+
'-I', os.path.join(current_path(), 'dependencies', 'include')
22+
]
23+
24+
compilation_database_folder = current_path()
25+
26+
if os.path.exists(compilation_database_folder):
27+
database = ycm_core.CompilationDatabase(compilation_database_folder)
28+
else:
29+
database = None
30+
31+
SOURCE_EXTENSIONS = ['.cc', '.inl']
32+
33+
def MakeRelativePathsInFlagsAbsolute(flags, working_directory):
34+
if not working_directory:
35+
return list(flags)
36+
new_flags = []
37+
make_next_absolute = False
38+
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
39+
for flag in flags:
40+
new_flag = flag
41+
if make_next_absolute:
42+
make_next_absolute = False
43+
if not flag.startswith('/'):
44+
new_flag = os.path.join(working_directory, flag)
45+
for path_flag in path_flags:
46+
if flag == path_flag:
47+
make_next_absolute = True
48+
break
49+
if flag.startswith(path_flag):
50+
path = flag[ len(path_flag): ]
51+
new_flag = path_flag + os.path.join(working_directory, path)
52+
break
53+
if new_flag:
54+
new_flags.append(new_flag)
55+
return new_flags
56+
57+
58+
def IsHeaderFile(filename):
59+
extension = os.path.splitext(filename)[ 1 ]
60+
return extension in [ '.h', '.hxx', '.hpp', '.hh', '.inl' ]
61+
62+
63+
# The compilation_commands.json file generated by CMake does not have entries
64+
# for header files. So we do our best by asking the db for flags for a
65+
# corresponding source file, if any. If one exists, the flags for that file
66+
# should be good enough.
67+
def GetCompilationInfoForFile(filename):
68+
if IsHeaderFile(filename):
69+
basename = os.path.splitext(filename)[0].replace('include', 'lib')
70+
replacement_file = basename + '.cc'
71+
if os.path.exists(replacement_file):
72+
compilation_info = database.GetCompilationInfoForFile(
73+
replacement_file)
74+
if compilation_info.compiler_flags_:
75+
return compilation_info
76+
return None
77+
return database.GetCompilationInfoForFile(filename)
78+
79+
80+
def FlagsForFile(filename, **kwargs):
81+
global flags
82+
if database:
83+
compilation_info = GetCompilationInfoForFile(filename)
84+
if not compilation_info:
85+
return None
86+
final_flags = MakeRelativePathsInFlagsAbsolute(
87+
compilation_info.compiler_flags_,
88+
compilation_info.compiler_working_dir_)
89+
else:
90+
relative_to = current_path()
91+
final_flags = MakeRelativePathsInFlagsAbsolute(flags, relative_to)
92+
93+
final_flags.extend(flags)
94+
95+
return {'flags': final_flags, 'do_cache': True}

Diff for: libraries/rpclib/dependencies/include/asio.hpp

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
//
2+
// asio.hpp
3+
// ~~~~~~~~
4+
//
5+
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6+
//
7+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9+
//
10+
11+
#ifndef ASIO_HPP
12+
#define ASIO_HPP
13+
14+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15+
# pragma once
16+
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17+
18+
#include "asio/async_result.hpp"
19+
#include "asio/basic_datagram_socket.hpp"
20+
#include "asio/basic_deadline_timer.hpp"
21+
#include "asio/basic_io_object.hpp"
22+
#include "asio/basic_raw_socket.hpp"
23+
#include "asio/basic_seq_packet_socket.hpp"
24+
#include "asio/basic_serial_port.hpp"
25+
#include "asio/basic_signal_set.hpp"
26+
#include "asio/basic_socket_acceptor.hpp"
27+
#include "asio/basic_socket_iostream.hpp"
28+
#include "asio/basic_socket_streambuf.hpp"
29+
#include "asio/basic_stream_socket.hpp"
30+
#include "asio/basic_streambuf.hpp"
31+
#include "asio/basic_waitable_timer.hpp"
32+
#include "asio/buffer.hpp"
33+
#include "asio/buffered_read_stream_fwd.hpp"
34+
#include "asio/buffered_read_stream.hpp"
35+
#include "asio/buffered_stream_fwd.hpp"
36+
#include "asio/buffered_stream.hpp"
37+
#include "asio/buffered_write_stream_fwd.hpp"
38+
#include "asio/buffered_write_stream.hpp"
39+
#include "asio/buffers_iterator.hpp"
40+
#include "asio/completion_condition.hpp"
41+
#include "asio/connect.hpp"
42+
#include "asio/coroutine.hpp"
43+
#include "asio/datagram_socket_service.hpp"
44+
#include "asio/deadline_timer_service.hpp"
45+
#include "asio/deadline_timer.hpp"
46+
#include "asio/error.hpp"
47+
#include "asio/error_code.hpp"
48+
#include "asio/generic/basic_endpoint.hpp"
49+
#include "asio/generic/datagram_protocol.hpp"
50+
#include "asio/generic/raw_protocol.hpp"
51+
#include "asio/generic/seq_packet_protocol.hpp"
52+
#include "asio/generic/stream_protocol.hpp"
53+
#include "asio/handler_alloc_hook.hpp"
54+
#include "asio/handler_continuation_hook.hpp"
55+
#include "asio/handler_invoke_hook.hpp"
56+
#include "asio/handler_type.hpp"
57+
#include "asio/io_service.hpp"
58+
#include "asio/ip/address.hpp"
59+
#include "asio/ip/address_v4.hpp"
60+
#include "asio/ip/address_v6.hpp"
61+
#include "asio/ip/basic_endpoint.hpp"
62+
#include "asio/ip/basic_resolver.hpp"
63+
#include "asio/ip/basic_resolver_entry.hpp"
64+
#include "asio/ip/basic_resolver_iterator.hpp"
65+
#include "asio/ip/basic_resolver_query.hpp"
66+
#include "asio/ip/host_name.hpp"
67+
#include "asio/ip/icmp.hpp"
68+
#include "asio/ip/multicast.hpp"
69+
#include "asio/ip/resolver_query_base.hpp"
70+
#include "asio/ip/resolver_service.hpp"
71+
#include "asio/ip/tcp.hpp"
72+
#include "asio/ip/udp.hpp"
73+
#include "asio/ip/unicast.hpp"
74+
#include "asio/ip/v6_only.hpp"
75+
#include "asio/is_read_buffered.hpp"
76+
#include "asio/is_write_buffered.hpp"
77+
#include "asio/local/basic_endpoint.hpp"
78+
#include "asio/local/connect_pair.hpp"
79+
#include "asio/local/datagram_protocol.hpp"
80+
#include "asio/local/stream_protocol.hpp"
81+
#include "asio/placeholders.hpp"
82+
#include "asio/posix/basic_descriptor.hpp"
83+
#include "asio/posix/basic_stream_descriptor.hpp"
84+
#include "asio/posix/descriptor_base.hpp"
85+
#include "asio/posix/stream_descriptor.hpp"
86+
#include "asio/posix/stream_descriptor_service.hpp"
87+
#include "asio/raw_socket_service.hpp"
88+
#include "asio/read.hpp"
89+
#include "asio/read_at.hpp"
90+
#include "asio/read_until.hpp"
91+
#include "asio/seq_packet_socket_service.hpp"
92+
#include "asio/serial_port.hpp"
93+
#include "asio/serial_port_base.hpp"
94+
#include "asio/serial_port_service.hpp"
95+
#include "asio/signal_set.hpp"
96+
#include "asio/signal_set_service.hpp"
97+
#include "asio/socket_acceptor_service.hpp"
98+
#include "asio/socket_base.hpp"
99+
#include "asio/strand.hpp"
100+
#include "asio/stream_socket_service.hpp"
101+
#include "asio/streambuf.hpp"
102+
#include "asio/system_error.hpp"
103+
#include "asio/thread.hpp"
104+
#include "asio/time_traits.hpp"
105+
#include "asio/version.hpp"
106+
#include "asio/wait_traits.hpp"
107+
#include "asio/waitable_timer_service.hpp"
108+
#include "asio/windows/basic_handle.hpp"
109+
#include "asio/windows/basic_object_handle.hpp"
110+
#include "asio/windows/basic_random_access_handle.hpp"
111+
#include "asio/windows/basic_stream_handle.hpp"
112+
#include "asio/windows/object_handle.hpp"
113+
#include "asio/windows/object_handle_service.hpp"
114+
#include "asio/windows/overlapped_ptr.hpp"
115+
#include "asio/windows/random_access_handle.hpp"
116+
#include "asio/windows/random_access_handle_service.hpp"
117+
#include "asio/windows/stream_handle.hpp"
118+
#include "asio/windows/stream_handle_service.hpp"
119+
#include "asio/write.hpp"
120+
#include "asio/write_at.hpp"
121+
122+
#endif // ASIO_HPP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
//
2+
// async_result.hpp
3+
// ~~~~~~~~~~~~~~~~
4+
//
5+
// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6+
//
7+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
8+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9+
//
10+
11+
#ifndef ASIO_ASYNC_RESULT_HPP
12+
#define ASIO_ASYNC_RESULT_HPP
13+
14+
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15+
# pragma once
16+
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17+
18+
#include "asio/detail/config.hpp"
19+
#include "asio/handler_type.hpp"
20+
21+
#include "asio/detail/push_options.hpp"
22+
23+
namespace clmdep_asio {
24+
25+
/// An interface for customising the behaviour of an initiating function.
26+
/**
27+
* This template may be specialised for user-defined handler types.
28+
*/
29+
template <typename Handler>
30+
class async_result
31+
{
32+
public:
33+
/// The return type of the initiating function.
34+
typedef void type;
35+
36+
/// Construct an async result from a given handler.
37+
/**
38+
* When using a specalised async_result, the constructor has an opportunity
39+
* to initialise some state associated with the handler, which is then
40+
* returned from the initiating function.
41+
*/
42+
explicit async_result(Handler&)
43+
{
44+
}
45+
46+
/// Obtain the value to be returned from the initiating function.
47+
type get()
48+
{
49+
}
50+
};
51+
52+
namespace detail {
53+
54+
// Helper template to deduce the true type of a handler, capture a local copy
55+
// of the handler, and then create an async_result for the handler.
56+
template <typename Handler, typename Signature>
57+
struct async_result_init
58+
{
59+
explicit async_result_init(ASIO_MOVE_ARG(Handler) orig_handler)
60+
: handler(ASIO_MOVE_CAST(Handler)(orig_handler)),
61+
result(handler)
62+
{
63+
}
64+
65+
typename handler_type<Handler, Signature>::type handler;
66+
async_result<typename handler_type<Handler, Signature>::type> result;
67+
};
68+
69+
template <typename Handler, typename Signature>
70+
struct async_result_type_helper
71+
{
72+
typedef typename async_result<
73+
typename handler_type<Handler, Signature>::type
74+
>::type type;
75+
};
76+
77+
} // namespace detail
78+
} // namespace clmdep_asio
79+
80+
#include "asio/detail/pop_options.hpp"
81+
82+
#if defined(GENERATING_DOCUMENTATION)
83+
# define ASIO_INITFN_RESULT_TYPE(h, sig) \
84+
void_or_deduced
85+
#elif defined(_MSC_VER) && (_MSC_VER < 1500)
86+
# define ASIO_INITFN_RESULT_TYPE(h, sig) \
87+
typename ::clmdep_asio::detail::async_result_type_helper<h, sig>::type
88+
#else
89+
# define ASIO_INITFN_RESULT_TYPE(h, sig) \
90+
typename ::clmdep_asio::async_result< \
91+
typename ::clmdep_asio::handler_type<h, sig>::type>::type
92+
#endif
93+
94+
#endif // ASIO_ASYNC_RESULT_HPP

0 commit comments

Comments
 (0)