mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-07-04 01:27:13 +02:00
Reorganized tree.
This commit is contained in:
parent
754b1682a5
commit
bc33317b7e
126
CMakeLists.txt
126
CMakeLists.txt
@ -29,26 +29,6 @@ IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND)
|
||||
OPTION (MSGPACK_BUILD_TESTS "Build msgpack tests." ON)
|
||||
ENDIF ()
|
||||
|
||||
|
||||
# Files to copy
|
||||
|
||||
MACRO (COPY_FILE SOURCE DESTINATION)
|
||||
# COPY_FILE (readme.txt dir1/dir2/) would add new target
|
||||
# that will copy readme.txt to dir1/dir2 where dir1 will be located
|
||||
# in current binary directory.
|
||||
ADD_CUSTOM_COMMAND (
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DESTINATION}/${SOURCE}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${DESTINATION}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/${DESTINATION}/${SOURCE}
|
||||
)
|
||||
ENDMACRO ()
|
||||
|
||||
IF (MSGPACK_CXX11)
|
||||
COPY_FILE (cpp11/zone.hpp src/msgpack/zone.hpp)
|
||||
COPY_FILE (cpp11/define.hpp src/msgpack/type/define.hpp)
|
||||
COPY_FILE (cpp11/tuple.hpp src/msgpack/type/tuple.hpp)
|
||||
ENDIF ()
|
||||
|
||||
OPTION (MSGPACK_ENABLE_CXX "Enable C++ interface." ON)
|
||||
|
||||
INCLUDE (CheckCXXSourceCompiles)
|
||||
@ -79,51 +59,57 @@ LIST (APPEND msgpack_SOURCES
|
||||
)
|
||||
|
||||
LIST (APPEND msgpack_HEADERS
|
||||
src/msgpack/pack_define.h
|
||||
src/msgpack/pack_template.h
|
||||
src/msgpack/unpack_define.h
|
||||
src/msgpack/unpack_template.h
|
||||
src/msgpack/sysdep.h
|
||||
src/msgpack/sbuffer.h
|
||||
src/msgpack/version.h
|
||||
src/msgpack/vrefbuffer.h
|
||||
src/msgpack/zbuffer.h
|
||||
src/msgpack/fbuffer.h
|
||||
src/msgpack/pack.h
|
||||
src/msgpack/unpack.h
|
||||
src/msgpack/object.h
|
||||
src/msgpack/zone.h
|
||||
include/msgpack/pack_define.h
|
||||
include/msgpack/pack_template.h
|
||||
include/msgpack/unpack_define.h
|
||||
include/msgpack/unpack_template.h
|
||||
include/msgpack/sysdep.h
|
||||
include/msgpack/sbuffer.h
|
||||
include/msgpack/version.h
|
||||
include/msgpack/vrefbuffer.h
|
||||
include/msgpack/zbuffer.h
|
||||
include/msgpack/fbuffer.h
|
||||
include/msgpack/pack.h
|
||||
include/msgpack/unpack.h
|
||||
include/msgpack/object.h
|
||||
include/msgpack/zone.h
|
||||
)
|
||||
|
||||
IF (MSGPACK_ENABLE_CXX)
|
||||
LIST (APPEND msgpack_HEADERS
|
||||
src/msgpack.hpp
|
||||
src/msgpack/sbuffer.hpp
|
||||
src/msgpack/vrefbuffer.hpp
|
||||
src/msgpack/zbuffer.hpp
|
||||
src/msgpack/fbuffer.hpp
|
||||
src/msgpack/pack.hpp
|
||||
src/msgpack/unpack.hpp
|
||||
src/msgpack/object.hpp
|
||||
src/msgpack/zone.hpp
|
||||
src/msgpack/type.hpp
|
||||
src/msgpack/type/bool.hpp
|
||||
src/msgpack/type/deque.hpp
|
||||
src/msgpack/type/float.hpp
|
||||
src/msgpack/type/fixint.hpp
|
||||
src/msgpack/type/int.hpp
|
||||
src/msgpack/type/list.hpp
|
||||
src/msgpack/type/map.hpp
|
||||
src/msgpack/type/nil.hpp
|
||||
src/msgpack/type/pair.hpp
|
||||
src/msgpack/type/raw.hpp
|
||||
src/msgpack/type/set.hpp
|
||||
src/msgpack/type/string.hpp
|
||||
src/msgpack/type/vector.hpp
|
||||
src/msgpack/type/tuple.hpp
|
||||
src/msgpack/type/define.hpp
|
||||
src/msgpack/type/tr1/unordered_map.hpp
|
||||
src/msgpack/type/tr1/unordered_set.hpp
|
||||
include/msgpack.hpp
|
||||
include/msgpack/sbuffer.hpp
|
||||
include/msgpack/vrefbuffer.hpp
|
||||
include/msgpack/zbuffer.hpp
|
||||
include/msgpack/fbuffer.hpp
|
||||
include/msgpack/pack.hpp
|
||||
include/msgpack/unpack.hpp
|
||||
include/msgpack/object.hpp
|
||||
include/msgpack/zone.hpp
|
||||
include/msgpack/detail/cpp03_zone.hpp
|
||||
include/msgpack/detail/cpp11_zone.hpp
|
||||
include/msgpack/type.hpp
|
||||
include/msgpack/adaptor/bool.hpp
|
||||
include/msgpack/adaptor/deque.hpp
|
||||
include/msgpack/adaptor/float.hpp
|
||||
include/msgpack/adaptor/fixint.hpp
|
||||
include/msgpack/adaptor/int.hpp
|
||||
include/msgpack/adaptor/list.hpp
|
||||
include/msgpack/adaptor/map.hpp
|
||||
include/msgpack/adaptor/nil.hpp
|
||||
include/msgpack/adaptor/pair.hpp
|
||||
include/msgpack/adaptor/raw.hpp
|
||||
include/msgpack/adaptor/set.hpp
|
||||
include/msgpack/adaptor/string.hpp
|
||||
include/msgpack/adaptor/vector.hpp
|
||||
include/msgpack/adaptor/msgpack_tuple.hpp
|
||||
include/msgpack/adaptor/detail/cpp03_msgpack_tuple.hpp
|
||||
include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp
|
||||
include/msgpack/adaptor/define.hpp
|
||||
include/msgpack/adaptor/detail/cpp03_define.hpp
|
||||
include/msgpack/adaptor/detail/cpp11_define.hpp
|
||||
include/msgpack/adaptor/tr1/unordered_map.hpp
|
||||
include/msgpack/adaptor/tr1/unordered_set.hpp
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
@ -131,15 +117,6 @@ EXECUTE_PROCESS (
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/src/msgpack
|
||||
)
|
||||
|
||||
CONFIGURE_FILE (
|
||||
src/msgpack/version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/msgpack/version.h
|
||||
)
|
||||
CONFIGURE_FILE (
|
||||
src/msgpack/version.hpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/msgpack/version.hpp
|
||||
)
|
||||
|
||||
CONFIGURE_FILE (
|
||||
msgpack.pc.in
|
||||
msgpack.pc
|
||||
@ -148,10 +125,8 @@ CONFIGURE_FILE (
|
||||
|
||||
INCLUDE_DIRECTORIES (
|
||||
./
|
||||
src/
|
||||
src/msgpack/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/msgpack/
|
||||
include/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/
|
||||
)
|
||||
|
||||
ADD_LIBRARY (msgpack SHARED
|
||||
@ -186,8 +161,7 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
ENDIF ()
|
||||
|
||||
INSTALL (TARGETS msgpack msgpack-static DESTINATION lib)
|
||||
INSTALL (DIRECTORY src/msgpack DESTINATION include)
|
||||
INSTALL (FILES src/msgpack.h src/msgpack.hpp DESTINATION include)
|
||||
INSTALL (DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
INSTALL (FILES msgpack.pc DESTINATION lib/pkgconfig)
|
||||
|
||||
# Doxygen
|
||||
|
26
README.md
26
README.md
@ -22,6 +22,15 @@ To report an issue, use the [msgpack-c issue tracker](https://github.com/msgpack
|
||||
|
||||
## Using Msgpack
|
||||
|
||||
### Header only library for C++
|
||||
When you use msgpack on C++03 and C++11, you just add msgpack-c/include to your include path. You don't need to link any msgpack libraries.
|
||||
|
||||
e.g.)
|
||||
|
||||
```
|
||||
g++ -I msgpack-c/include your_source_file.cpp
|
||||
```
|
||||
|
||||
### Building and Installing
|
||||
|
||||
#### Install from git repository
|
||||
@ -29,11 +38,8 @@ To report an issue, use the [msgpack-c issue tracker](https://github.com/msgpack
|
||||
##### Using autotools
|
||||
You will need gcc (4.1.0 or higher), autotools.
|
||||
|
||||
You can use msgpack-c as a header only library on C++11 and C++03.
|
||||
For C++03 and C:
|
||||
|
||||
You don't need to prepare ruby when you choose C++11 configuration.
|
||||
|
||||
For C++11:
|
||||
```
|
||||
$ git clone https://github.com/redboltz/msgpack-c/tree/cxx_separate
|
||||
$ cd msgpack-c
|
||||
@ -43,14 +49,17 @@ $ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
If you want to setup C++11 version of msgpack, execute the following command:
|
||||
For C++11:
|
||||
|
||||
```
|
||||
$ git clone https://github.com/msgpack/msgpack-c.git
|
||||
$ cd msgpack-c
|
||||
$ ./bootstrap
|
||||
$ ./configure CXXFLAGS="-std=c++11"
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
You need the compiler that fully supports C++11.
|
||||
|
||||
##### Using cmake
|
||||
@ -120,12 +129,13 @@ Open the created msgpack.sln on Visual Studio.
|
||||
|
||||
Build all.
|
||||
|
||||
### Linking with an Application
|
||||
### Linking with an Application for C
|
||||
|
||||
Include `msgpack.hpp` (or `msgpack.h` for C) in your application and link with libmsgpack. Here is a typical gcc link command:
|
||||
Include `msgpack.h` in your application and link with libmsgpack. Here is a typical gcc link command:
|
||||
|
||||
g++ myapp.cpp -lmsgpack -o myapp
|
||||
gcc myapp.c -lmsgpack -o myapp
|
||||
|
||||
When you use the C++ version of the msgpack, you don't need to link any msgpack libraries.
|
||||
|
||||
### Code Example
|
||||
```CPP
|
||||
|
29
configure.in
29
configure.in
@ -1,29 +1,11 @@
|
||||
AC_INIT([msgpack], [0.5.9])
|
||||
major=`sed -n 's/#define MSGPACK_VERSION_MAJOR\s\(.*\)/\1/p' include/msgpack/version_master.h`
|
||||
minor=`sed -n 's/#define MSGPACK_VERSION_MINOR\s\(.*\)/\1/p' include/msgpack/version_master.h`
|
||||
release=`sed -n 's/#define MSGPACK_VERSION_RELEASE\s\(.*\)/\1/p' include/msgpack/version_master.h`
|
||||
AC_INIT(msgpack, $major.$minor.$release)
|
||||
AC_CONFIG_AUX_DIR(ac)
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#if __cplusplus < 201103
|
||||
#error
|
||||
#endif
|
||||
])],
|
||||
[
|
||||
./preprocess_cpp11
|
||||
if test $? != 0; then
|
||||
exit 1
|
||||
fi
|
||||
],
|
||||
[
|
||||
./preprocess
|
||||
if test $? != 0; then
|
||||
exit 1
|
||||
fi
|
||||
])
|
||||
AC_LANG_POP()
|
||||
|
||||
AC_SUBST(CFLAGS)
|
||||
CFLAGS="-O3 -Wall $CFLAGS"
|
||||
|
||||
@ -115,7 +97,4 @@ AC_SUBST(VERSION_MINOR, $minor)
|
||||
AC_OUTPUT([Makefile
|
||||
msgpack.pc
|
||||
src/Makefile
|
||||
src/msgpack/version.h
|
||||
src/msgpack/version.hpp
|
||||
test/Makefile])
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_TYPE_DEFINE_HPP
|
||||
#define MSGPACK_TYPE_DEFINE_HPP
|
||||
#ifndef MSGPACK_CPP03_DEFINE_HPP
|
||||
#define MSGPACK_CPP03_DEFINE_HPP
|
||||
|
||||
#define MSGPACK_DEFINE(...) \
|
||||
template <typename Packer> \
|
||||
@ -144,5 +144,5 @@ define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_define(A0& a0<%1.upto(i) {|j|%>,
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif /* msgpack/type/define.hpp */
|
||||
#endif // MSGPACK_CPP03_DEFINE_HPP
|
||||
|
@ -15,8 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_TYPE_TUPLE_HPP
|
||||
#define MSGPACK_TYPE_TUPLE_HPP
|
||||
#ifndef MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
||||
#define MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
||||
|
||||
#include "msgpack/object.hpp"
|
||||
|
||||
@ -208,5 +208,4 @@ inline void operator<< (
|
||||
//}
|
||||
//<%}%>
|
||||
|
||||
#endif /* msgpack/type/tuple.hpp */
|
||||
|
||||
#endif // MSGPACK_CPP03_MSGPACK_TUPLE_HPP
|
@ -15,14 +15,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_ZONE_HPP
|
||||
#define MSGPACK_ZONE_HPP
|
||||
#ifndef MSGPACK_CPP03_ZONE_HPP
|
||||
#define MSGPACK_CPP03_ZONE_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "cpp_config.hpp"
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
||||
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
||||
@ -317,4 +317,4 @@ T* zone::allocate(<%=(1..i).map{|j|"A#{j} a#{j}"}.join(', ')%>)
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif /* msgpack/zone.hpp */
|
||||
#endif // MSGPACK_CPP03_ZONE_HPP
|
29
include/msgpack/adaptor/define.hpp
Normal file
29
include/msgpack/adaptor/define.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2008-2014 FURUHASHI Sadayuki and KONDO Takatoshi
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_DEFINE_HPP
|
||||
#define MSGPACK_DEFINE_HPP
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
#include "detail/cpp03_define.hpp"
|
||||
#else // MSGPACK_USE_CPP03
|
||||
#include "detail/cpp11_define.hpp"
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_DEFINE_HPP
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -15,8 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_TYPE_DEFINE_HPP
|
||||
#define MSGPACK_TYPE_DEFINE_HPP
|
||||
#ifndef MSGPACK_CPP11_DEFINE_HPP
|
||||
#define MSGPACK_CPP11_DEFINE_HPP
|
||||
|
||||
#define MSGPACK_DEFINE(...) \
|
||||
template <typename Packer> \
|
||||
@ -46,7 +46,7 @@
|
||||
return v; \
|
||||
} \
|
||||
template <> \
|
||||
void operator<< (object::with_zone& o, const enum& v) \
|
||||
inline void operator<< (object::with_zone& o, const enum& v) \
|
||||
{ \
|
||||
int tmp = static_cast<enum>(v); \
|
||||
o << tmp; \
|
||||
@ -165,6 +165,4 @@ define<Args...> make_define(Args&... args)
|
||||
} // namespace type
|
||||
} // namespace msgpack
|
||||
|
||||
|
||||
#endif /* msgpack/type/define.hpp */
|
||||
|
||||
#endif // MSGPACK_CPP11_DEFINE_HPP
|
@ -15,8 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_TYPE_TUPLE_HPP
|
||||
#define MSGPACK_TYPE_TUPLE_HPP
|
||||
#ifndef MSGPACK_CPP11_MSGPACK_TUPLE_HPP
|
||||
#define MSGPACK_CPP11_MSGPACK_TUPLE_HPP
|
||||
|
||||
#include <tuple>
|
||||
|
||||
@ -181,5 +181,5 @@ inline void operator<< (
|
||||
|
||||
} // msgpack
|
||||
|
||||
#endif /* msgpack/type/tuple.hpp */
|
||||
#endif // MSGPACK_CPP11_MSGPACK_TUPLE_HPP
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define MSGPACK_TYPE_FIXINT_HPP
|
||||
|
||||
#include "msgpack/object.hpp"
|
||||
#include "msgpack/type/int.hpp"
|
||||
#include "msgpack/adaptor/int.hpp"
|
||||
|
||||
namespace msgpack {
|
||||
|
29
include/msgpack/adaptor/msgpack_tuple.hpp
Normal file
29
include/msgpack/adaptor/msgpack_tuple.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2008-2014 FURUHASHI Sadayuki and KONDO Takatoshi
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_MSGPACK_TUPLE_HPP
|
||||
#define MSGPACK_MSGPACK_TUPLE_HPP
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
#include "detail/cpp03_msgpack_tuple.hpp"
|
||||
#else // MSGPACK_USE_CPP03
|
||||
#include "detail/cpp11_msgpack_tuple.hpp"
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_MSGPACK_TUPLE_HPP
|
@ -18,6 +18,17 @@
|
||||
#ifndef MSGPACK_CPP_CONFIG_HPP
|
||||
#define MSGPACK_CPP_CONFIG_HPP
|
||||
|
||||
#if !defined(MSGPACK_USE_CPP03)
|
||||
// If MSVC would support C++11 completely,
|
||||
// then 'defined(_MSC_VER)' would replace with
|
||||
// '_MSC_VER < XXXX'
|
||||
# if (__cplusplus < 201103) || defined(_MSC_VER)
|
||||
# define MSGPACK_USE_CPP03
|
||||
# endif
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
|
||||
|
||||
#if defined __cplusplus
|
||||
#if __cplusplus < 201103
|
||||
|
||||
@ -25,6 +36,8 @@
|
||||
#define nullptr (0)
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
template <typename T>
|
@ -3,43 +3,164 @@
|
||||
//
|
||||
// Copyright (C) 2008-2010 FURUHASHI Sadayuki
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_ZONE_HPP__
|
||||
#define MSGPACK_ZONE_HPP__
|
||||
#ifndef MSGPACK_CPP03_ZONE_HPP
|
||||
#define MSGPACK_CPP03_ZONE_HPP
|
||||
|
||||
#include "zone.h"
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
||||
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
||||
#endif
|
||||
|
||||
#ifndef MSGPACK_ZONE_ALIGN
|
||||
#define MSGPACK_ZONE_ALIGN sizeof(int)
|
||||
#endif
|
||||
|
||||
|
||||
namespace msgpack {
|
||||
|
||||
class zone {
|
||||
struct finalizer {
|
||||
finalizer(void (*func)(void*), void* data):func_(func), data_(data) {}
|
||||
void operator()() { func_(data_); }
|
||||
void (*func_)(void*);
|
||||
void* data_;
|
||||
};
|
||||
struct finalizer_array {
|
||||
finalizer_array():tail_(nullptr), end_(nullptr), array_(nullptr) {}
|
||||
void call() {
|
||||
finalizer* fin = tail_;
|
||||
for(; fin != array_; --fin) (*(fin-1))();
|
||||
}
|
||||
~finalizer_array() {
|
||||
call();
|
||||
::free(array_);
|
||||
}
|
||||
void clear() {
|
||||
call();
|
||||
tail_ = array_;
|
||||
}
|
||||
void push(void (*func)(void* data), void* data)
|
||||
{
|
||||
finalizer* fin = tail_;
|
||||
|
||||
class zone : public msgpack_zone {
|
||||
public:
|
||||
zone(size_t chunk_size = MSGPACK_ZONE_CHUNK_SIZE);
|
||||
~zone();
|
||||
if(fin == end_) {
|
||||
push_expand(func, data);
|
||||
return;
|
||||
}
|
||||
|
||||
fin->func_ = func;
|
||||
fin->data_ = data;
|
||||
|
||||
++tail_;
|
||||
}
|
||||
void push_expand(void (*func)(void*), void* data) {
|
||||
const size_t nused = end_ - array_;
|
||||
size_t nnext;
|
||||
if(nused == 0) {
|
||||
nnext = (sizeof(finalizer) < 72/2) ?
|
||||
72 / sizeof(finalizer) : 8;
|
||||
} else {
|
||||
nnext = nused * 2;
|
||||
}
|
||||
finalizer* tmp =
|
||||
static_cast<finalizer*>(::realloc(array_, sizeof(finalizer) * nnext));
|
||||
if(!tmp) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
array_ = tmp;
|
||||
end_ = tmp + nnext;
|
||||
tail_ = tmp + nused;
|
||||
new (tail_) finalizer(func, data);
|
||||
|
||||
++tail_;
|
||||
}
|
||||
finalizer* tail_;
|
||||
finalizer* end_;
|
||||
finalizer* array_;
|
||||
};
|
||||
struct chunk {
|
||||
chunk* next_;
|
||||
};
|
||||
struct chunk_list {
|
||||
chunk_list(size_t chunk_size)
|
||||
{
|
||||
chunk* c = static_cast<chunk*>(::malloc(sizeof(chunk) + chunk_size));
|
||||
if(!c) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
head_ = c;
|
||||
free_ = chunk_size;
|
||||
ptr_ = reinterpret_cast<char*>(c) + sizeof(chunk);
|
||||
c->next_ = nullptr;
|
||||
}
|
||||
~chunk_list()
|
||||
{
|
||||
chunk* c = head_;
|
||||
while(true) {
|
||||
chunk* n = c->next_;
|
||||
::free(c);
|
||||
if(n) {
|
||||
c = n;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
void clear(size_t chunk_size)
|
||||
{
|
||||
chunk* c = head_;
|
||||
while(true) {
|
||||
chunk* n = c->next_;
|
||||
if(n) {
|
||||
::free(c);
|
||||
c = n;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
head_->next_ = nullptr;
|
||||
free_ = chunk_size;
|
||||
ptr_ = reinterpret_cast<char*>(head_) + sizeof(chunk);
|
||||
}
|
||||
size_t free_;
|
||||
char* ptr_;
|
||||
chunk* head_;
|
||||
};
|
||||
size_t chunk_size_;
|
||||
chunk_list chunk_list_;
|
||||
finalizer_array finalizer_array_;
|
||||
|
||||
public:
|
||||
void* malloc(size_t size);
|
||||
void* malloc_no_align(size_t size);
|
||||
zone(size_t chunk_size = MSGPACK_ZONE_CHUNK_SIZE) /* throw() */;
|
||||
|
||||
public:
|
||||
static zone* create(size_t chunk_size);
|
||||
static void destroy(zone* zone);
|
||||
void* allocate_align(size_t size);
|
||||
void* allocate_no_align(size_t size);
|
||||
|
||||
void push_finalizer(void (*func)(void*), void* data);
|
||||
|
||||
template <typename T>
|
||||
void push_finalizer(std::auto_ptr<T> obj);
|
||||
void push_finalizer(msgpack::unique_ptr<T> obj);
|
||||
|
||||
void clear();
|
||||
|
||||
@ -54,6 +175,14 @@ public:
|
||||
{
|
||||
::free(p);
|
||||
}
|
||||
static void* operator new(std::size_t size, void* place) throw()
|
||||
{
|
||||
return ::operator new(size, place);
|
||||
}
|
||||
static void operator delete(void* p, void* place) throw()
|
||||
{
|
||||
::operator delete(p, place);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* allocate();
|
||||
@ -105,71 +234,97 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
void undo_malloc(size_t size);
|
||||
void undo_allocate(size_t size);
|
||||
|
||||
template <typename T>
|
||||
static void object_destructor(void* obj);
|
||||
|
||||
typedef msgpack_zone base;
|
||||
|
||||
private:
|
||||
zone(const zone&);
|
||||
void* allocate_expand(size_t size);
|
||||
};
|
||||
|
||||
|
||||
|
||||
inline zone::zone(size_t chunk_size)
|
||||
inline zone* zone::create(size_t chunk_size)
|
||||
{
|
||||
msgpack_zone_init(this, chunk_size);
|
||||
}
|
||||
|
||||
inline zone::~zone()
|
||||
{
|
||||
msgpack_zone_destroy(this);
|
||||
}
|
||||
|
||||
inline void* zone::malloc(size_t size)
|
||||
{
|
||||
void* ptr = msgpack_zone_malloc(this, size);
|
||||
if(!ptr) {
|
||||
throw std::bad_alloc();
|
||||
zone* z = static_cast<zone*>(::malloc(sizeof(zone) + chunk_size));
|
||||
if (!z) {
|
||||
return nullptr;
|
||||
}
|
||||
new (z) zone(chunk_size);
|
||||
return z;
|
||||
}
|
||||
|
||||
inline void zone::destroy(zone* z)
|
||||
{
|
||||
z->~zone();
|
||||
::free(z);
|
||||
}
|
||||
|
||||
inline zone::zone(size_t chunk_size) /* throw() */ :chunk_size_(chunk_size), chunk_list_(chunk_size_)
|
||||
{
|
||||
}
|
||||
|
||||
inline void* zone::allocate_align(size_t size)
|
||||
{
|
||||
return allocate_no_align(
|
||||
((size)+((MSGPACK_ZONE_ALIGN)-1)) & ~((MSGPACK_ZONE_ALIGN)-1));
|
||||
}
|
||||
|
||||
inline void* zone::allocate_no_align(size_t size)
|
||||
{
|
||||
if(chunk_list_.free_ < size) {
|
||||
return allocate_expand(size);
|
||||
}
|
||||
|
||||
char* ptr = chunk_list_.ptr_;
|
||||
chunk_list_.free_ -= size;
|
||||
chunk_list_.ptr_ += size;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline void* zone::malloc_no_align(size_t size)
|
||||
inline void* zone::allocate_expand(size_t size)
|
||||
{
|
||||
void* ptr = msgpack_zone_malloc_no_align(this, size);
|
||||
if(!ptr) {
|
||||
throw std::bad_alloc();
|
||||
chunk_list* const cl = &chunk_list_;
|
||||
|
||||
size_t sz = chunk_size_;
|
||||
|
||||
while(sz < size) {
|
||||
sz *= 2;
|
||||
}
|
||||
|
||||
chunk* c = static_cast<chunk*>(::malloc(sizeof(chunk) + sz));
|
||||
|
||||
char* ptr = reinterpret_cast<char*>(c) + sizeof(chunk);
|
||||
|
||||
c->next_ = cl->head_;
|
||||
cl->head_ = c;
|
||||
cl->free_ = sz - size;
|
||||
cl->ptr_ = ptr + size;
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
inline void zone::push_finalizer(void (*func)(void*), void* data)
|
||||
{
|
||||
if(!msgpack_zone_push_finalizer(this, func, data)) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
finalizer_array_.push(func, data);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void zone::push_finalizer(std::auto_ptr<T> obj)
|
||||
inline void zone::push_finalizer(msgpack::unique_ptr<T> obj)
|
||||
{
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, obj.get())) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
finalizer_array_.push(&zone::object_destructor<T>, obj.get());
|
||||
obj.release();
|
||||
}
|
||||
|
||||
inline void zone::clear()
|
||||
{
|
||||
msgpack_zone_clear(this);
|
||||
finalizer_array_.clear();
|
||||
chunk_list_.clear(chunk_size_);
|
||||
}
|
||||
|
||||
inline void zone::swap(zone& o)
|
||||
{
|
||||
msgpack_zone_swap(this, &o);
|
||||
std::swap(*this, o);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -178,26 +333,28 @@ void zone::object_destructor(void* obj)
|
||||
reinterpret_cast<T*>(obj)->~T();
|
||||
}
|
||||
|
||||
inline void zone::undo_malloc(size_t size)
|
||||
inline void zone::undo_allocate(size_t size)
|
||||
{
|
||||
base::chunk_list.ptr -= size;
|
||||
base::chunk_list.free += size;
|
||||
chunk_list_.ptr_ -= size;
|
||||
chunk_list_.free_ += size;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
T* zone::allocate()
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T();
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -205,16 +362,18 @@ T* zone::allocate()
|
||||
template <typename T, typename A1>
|
||||
T* zone::allocate(A1 a1)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -222,16 +381,18 @@ T* zone::allocate(A1 a1)
|
||||
template <typename T, typename A1, typename A2>
|
||||
T* zone::allocate(A1 a1, A2 a2)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -239,16 +400,18 @@ T* zone::allocate(A1 a1, A2 a2)
|
||||
template <typename T, typename A1, typename A2, typename A3>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -256,16 +419,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -273,16 +438,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -290,16 +457,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -307,16 +476,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -324,16 +495,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -341,16 +514,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -358,16 +533,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9)
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -375,16 +552,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -392,16 +571,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -409,16 +590,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -426,16 +609,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13, A14 a14)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -443,16 +628,18 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
|
||||
template <typename T, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9, typename A10, typename A11, typename A12, typename A13, typename A14, typename A15>
|
||||
T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9, A10 a10, A11 a11, A12 a12, A13 a13, A14 a14, A15 a15)
|
||||
{
|
||||
void* x = malloc(sizeof(T));
|
||||
if(!msgpack_zone_push_finalizer(this, &zone::object_destructor<T>, x)) {
|
||||
undo_malloc(sizeof(T));
|
||||
throw std::bad_alloc();
|
||||
void* x = allocate_align(sizeof(T));
|
||||
try {
|
||||
finalizer_array_.push(&zone::object_destructor<T>, x);
|
||||
} catch (...) {
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
try {
|
||||
return new (x) T(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
|
||||
} catch (...) {
|
||||
--base::finalizer_array.tail;
|
||||
undo_malloc(sizeof(T));
|
||||
--finalizer_array_.tail_;
|
||||
undo_allocate(sizeof(T));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@ -460,5 +647,4 @@ T* zone::allocate(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif /* msgpack/zone.hpp */
|
||||
|
||||
#endif // MSGPACK_CPP03_ZONE_HPP
|
@ -15,14 +15,14 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_ZONE_HPP
|
||||
#define MSGPACK_ZONE_HPP
|
||||
#ifndef MSGPACK_CPP11_ZONE_HPP
|
||||
#define MSGPACK_CPP11_ZONE_HPP
|
||||
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "cpp_config.hpp"
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#ifndef MSGPACK_ZONE_CHUNK_SIZE
|
||||
#define MSGPACK_ZONE_CHUNK_SIZE 8192
|
||||
@ -317,4 +317,4 @@ T* zone::allocate(Args... args)
|
||||
|
||||
} // namespace msgpack
|
||||
|
||||
#endif /* msgpack/zone.hpp */
|
||||
#endif // MSGPACK_CPP11_ZONE_HPP
|
17
include/msgpack/type.hpp
Normal file
17
include/msgpack/type.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "adaptor/bool.hpp"
|
||||
#include "adaptor/deque.hpp"
|
||||
#include "adaptor/fixint.hpp"
|
||||
#include "adaptor/float.hpp"
|
||||
#include "adaptor/int.hpp"
|
||||
#include "adaptor/list.hpp"
|
||||
#include "adaptor/map.hpp"
|
||||
#include "adaptor/nil.hpp"
|
||||
#include "adaptor/pair.hpp"
|
||||
#include "adaptor/raw.hpp"
|
||||
#include "adaptor/set.hpp"
|
||||
#include "adaptor/string.hpp"
|
||||
#include "adaptor/vector.hpp"
|
||||
#include "adaptor/msgpack_tuple.hpp"
|
||||
#include "adaptor/define.hpp"
|
||||
#include "adaptor/tr1/unordered_map.hpp"
|
||||
#include "adaptor/tr1/unordered_set.hpp"
|
@ -27,10 +27,12 @@ const char* msgpack_version(void);
|
||||
int msgpack_version_major(void);
|
||||
int msgpack_version_minor(void);
|
||||
|
||||
#define MSGPACK_VERSION "@VERSION@"
|
||||
#define MSGPACK_VERSION_MAJOR @VERSION_MAJOR@
|
||||
#define MSGPACK_VERSION_MINOR @VERSION_MINOR@
|
||||
#include "version_master.h"
|
||||
|
||||
#define MSGPACK_STR(v) #v
|
||||
#define MSGPACK_VERSION_I(maj, min, rel) MSGPACK_STR(maj) "." MSGPACK_STR(min) "." MSGPACK_STR(rel)
|
||||
|
||||
#define MSGPACK_VERSION MSGPACK_VERSION_I(MSGPACK_VERSION_MAJOR, MSGPACK_VERSION_MINOR, MSGPACK_VERSION_RELEASE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
@ -18,9 +18,12 @@
|
||||
#ifndef MSGPACK_VERSION_HPP
|
||||
#define MSGPACK_VERSION_HPP
|
||||
|
||||
#define MSGPACK_VERSION "@VERSION@"
|
||||
#define MSGPACK_VERSION_MAJOR @VERSION_MAJOR@
|
||||
#define MSGPACK_VERSION_MINOR @VERSION_MINOR@
|
||||
#include "version_master.h"
|
||||
|
||||
#define MSGPACK_STR(v) #v
|
||||
#define MSGPACK_VERSION_I(maj, min, rel) MSGPACK_STR(maj) "." MSGPACK_STR(min) "." MSGPACK_STR(rel)
|
||||
|
||||
#define MSGPACK_VERSION MSGPACK_VERSION_I(MSGPACK_VERSION_MAJOR, MSGPACK_VERSION_MINOR, MSGPACK_VERSION_RELEASE)
|
||||
|
||||
inline const char* msgpack_version(void) {
|
||||
return MSGPACK_VERSION;
|
3
include/msgpack/version_master.h
Normal file
3
include/msgpack/version_master.h
Normal file
@ -0,0 +1,3 @@
|
||||
#define MSGPACK_VERSION_MAJOR 0
|
||||
#define MSGPACK_VERSION_MINOR 5
|
||||
#define MSGPACK_VERSION_RELEASE 9
|
29
include/msgpack/zone.hpp
Normal file
29
include/msgpack/zone.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// MessagePack for C++ memory pool
|
||||
//
|
||||
// Copyright (C) 2008-2014 FURUHASHI Sadayuki and KONDO Takatoshi
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef MSGPACK_ZONE_HPP
|
||||
#define MSGPACK_ZONE_HPP
|
||||
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
|
||||
#if defined(MSGPACK_USE_CPP03)
|
||||
#include "detail/cpp03_zone.hpp"
|
||||
#else // MSGPACK_USE_CPP03
|
||||
#include "detail/cpp11_zone.hpp"
|
||||
#endif // MSGPACK_USE_CPP03
|
||||
|
||||
#endif // MSGPACK_ZONE_HPP
|
@ -8,10 +8,10 @@ preprocess() {
|
||||
echo ""
|
||||
exit 1
|
||||
else
|
||||
mv $1.tmp $1
|
||||
mv $1.tmp $2
|
||||
fi
|
||||
}
|
||||
|
||||
preprocess src/msgpack/type/tuple.hpp
|
||||
preprocess src/msgpack/type/define.hpp
|
||||
preprocess src/msgpack/zone.hpp
|
||||
preprocess erb/cpp03_msgpack_tuple.hpp include/msgpack/adaptor/detail/cpp03_msgpack_tuple.hpp
|
||||
preprocess erb/cpp03_define.hpp include/msgpack/adaptor/detail/cpp03_define.hpp
|
||||
preprocess erb/cpp03_zone.hpp include/msgpack/detail/cpp03_zone.hpp
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "clean" ];then
|
||||
rm -f src/msgpack/type/tuple.hpp
|
||||
rm -f src/msgpack/type/define.hpp
|
||||
rm -f src/msgpack/zone.hpp
|
||||
else
|
||||
cp -f cpp11/zone.hpp src/msgpack/
|
||||
cp -f cpp11/tuple.hpp src/msgpack/type/
|
||||
cp -f cpp11/define.hpp src/msgpack/type/
|
||||
fi
|
||||
cp -f cases.mpac test/
|
||||
cp -f cases_compact.mpac test/
|
||||
|
||||
sed -e 's/8\.00/9.00/' < msgpack_vc8.vcproj > msgpack_vc2008.vcproj
|
||||
sed -e 's/9\.00/10.00/' -e 's/msgpack_vc8/msgpack_vc2008/' < msgpack_vc8.sln > msgpack_vc2008.sln
|
||||
|
100
src/Makefile.am
100
src/Makefile.am
@ -1,6 +1,8 @@
|
||||
|
||||
lib_LTLIBRARIES = libmsgpack.la
|
||||
|
||||
AM_CPPFLAGS = -I../include
|
||||
|
||||
libmsgpack_la_SOURCES = \
|
||||
unpack.c \
|
||||
objectc.c \
|
||||
@ -31,60 +33,62 @@ libmsgpackc_la_LDFLAGS = -version-info 2:0:0 -no-undefined
|
||||
|
||||
|
||||
nobase_include_HEADERS = \
|
||||
msgpack/pack_define.h \
|
||||
msgpack/pack_template.h \
|
||||
msgpack/unpack_define.h \
|
||||
msgpack/unpack_template.h \
|
||||
msgpack/sysdep.h \
|
||||
msgpack.h \
|
||||
msgpack/sbuffer.h \
|
||||
msgpack/version.h \
|
||||
msgpack/vrefbuffer.h \
|
||||
msgpack/zbuffer.h \
|
||||
msgpack/fbuffer.h \
|
||||
msgpack/pack.h \
|
||||
msgpack/unpack.h \
|
||||
msgpack/object.h \
|
||||
msgpack/zone.h
|
||||
../include/msgpack/pack_define.h \
|
||||
../include/msgpack/pack_template.h \
|
||||
../include/msgpack/unpack_define.h \
|
||||
../include/msgpack/unpack_template.h \
|
||||
../include/msgpack/sysdep.h \
|
||||
../include/msgpack.h \
|
||||
../include/msgpack/sbuffer.h \
|
||||
../include/msgpack/version.h \
|
||||
../include/msgpack/version_master.h \
|
||||
../include/msgpack/vrefbuffer.h \
|
||||
../include/msgpack/zbuffer.h \
|
||||
../include/msgpack/fbuffer.h \
|
||||
../include/msgpack/pack.h \
|
||||
../include/msgpack/unpack.h \
|
||||
../include/msgpack/object.h \
|
||||
../include/msgpack/zone.h
|
||||
|
||||
if ENABLE_CXX
|
||||
nobase_include_HEADERS += \
|
||||
msgpack.hpp \
|
||||
msgpack/sbuffer.hpp \
|
||||
msgpack/vrefbuffer.hpp \
|
||||
msgpack/zbuffer.hpp \
|
||||
msgpack/fbuffer.hpp \
|
||||
msgpack/pack.hpp \
|
||||
msgpack/unpack.hpp \
|
||||
msgpack/version.hpp \
|
||||
msgpack/object.hpp \
|
||||
msgpack/zone.hpp \
|
||||
msgpack/type.hpp \
|
||||
msgpack/type/bool.hpp \
|
||||
msgpack/type/deque.hpp \
|
||||
msgpack/type/float.hpp \
|
||||
msgpack/type/fixint.hpp \
|
||||
msgpack/type/int.hpp \
|
||||
msgpack/type/list.hpp \
|
||||
msgpack/type/map.hpp \
|
||||
msgpack/type/nil.hpp \
|
||||
msgpack/type/pair.hpp \
|
||||
msgpack/type/raw.hpp \
|
||||
msgpack/type/set.hpp \
|
||||
msgpack/type/string.hpp \
|
||||
msgpack/type/vector.hpp \
|
||||
msgpack/type/tuple.hpp \
|
||||
msgpack/type/define.hpp \
|
||||
msgpack/type/tr1/unordered_map.hpp \
|
||||
msgpack/type/tr1/unordered_set.hpp
|
||||
../include/msgpack.hpp \
|
||||
../include/msgpack/sbuffer.hpp \
|
||||
../include/msgpack/vrefbuffer.hpp \
|
||||
../include/msgpack/zbuffer.hpp \
|
||||
../include/msgpack/fbuffer.hpp \
|
||||
../include/msgpack/pack.hpp \
|
||||
../include/msgpack/unpack.hpp \
|
||||
../include/msgpack/version.hpp \
|
||||
../include/msgpack/object.hpp \
|
||||
../include/msgpack/zone.hpp \
|
||||
../include/msgpack/type.hpp \
|
||||
../include/msgpack/detail/cpp11_zone.hpp \
|
||||
../include/msgpack/adaptor/bool.hpp \
|
||||
../include/msgpack/adaptor/deque.hpp \
|
||||
../include/msgpack/adaptor/float.hpp \
|
||||
../include/msgpack/adaptor/fixint.hpp \
|
||||
../include/msgpack/adaptor/int.hpp \
|
||||
../include/msgpack/adaptor/list.hpp \
|
||||
../include/msgpack/adaptor/map.hpp \
|
||||
../include/msgpack/adaptor/nil.hpp \
|
||||
../include/msgpack/adaptor/pair.hpp \
|
||||
../include/msgpack/adaptor/raw.hpp \
|
||||
../include/msgpack/adaptor/set.hpp \
|
||||
../include/msgpack/adaptor/string.hpp \
|
||||
../include/msgpack/adaptor/vector.hpp \
|
||||
../include/msgpack/adaptor/msgpack_tuple.hpp \
|
||||
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp \
|
||||
../include/msgpack/adaptor/define.hpp \
|
||||
../include/msgpack/adaptor/detail/cpp11_define.hpp \
|
||||
../include/msgpack/adaptor/tr1/unordered_map.hpp \
|
||||
../include/msgpack/adaptor/tr1/unordered_set.hpp
|
||||
endif
|
||||
|
||||
EXTRA_DIST = \
|
||||
msgpack/version.h.in \
|
||||
msgpack/version.hpp.in \
|
||||
msgpack/zone.hpp.erb \
|
||||
msgpack/type/define.hpp.erb \
|
||||
msgpack/type/tuple.hpp.erb
|
||||
../erb/cpp03_zone.hpp.erb \
|
||||
../erb/cpp03_define.hpp.erb \
|
||||
../erb/cpp03_msgpack_tuple.hpp.erb
|
||||
|
||||
|
||||
doxygen_c:
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifdef ENABLE_GCC_CXX_ATOMIC
|
||||
#if defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
|
||||
|
||||
#include "gcc_atomic.h"
|
||||
#include "msgpack/gcc_atomic.h"
|
||||
#include <bits/atomicity.h>
|
||||
|
||||
int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr)
|
||||
|
@ -1,17 +0,0 @@
|
||||
#include "type/bool.hpp"
|
||||
#include "type/deque.hpp"
|
||||
#include "type/fixint.hpp"
|
||||
#include "type/float.hpp"
|
||||
#include "type/int.hpp"
|
||||
#include "type/list.hpp"
|
||||
#include "type/map.hpp"
|
||||
#include "type/nil.hpp"
|
||||
#include "type/pair.hpp"
|
||||
#include "type/raw.hpp"
|
||||
#include "type/set.hpp"
|
||||
#include "type/string.hpp"
|
||||
#include "type/vector.hpp"
|
||||
#include "type/tuple.hpp"
|
||||
#include "type/define.hpp"
|
||||
#include "type/tr1/unordered_map.hpp"
|
||||
#include "type/tr1/unordered_set.hpp"
|
@ -1,6 +1,6 @@
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
AM_C_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_C_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_LDFLAGS = $(top_builddir)/src/libmsgpack.la -lgtest_main -lgtest -pthread
|
||||
|
||||
check_PROGRAMS = \
|
||||
|
@ -508,7 +508,7 @@ TEST(MSGPACK_STL, simple_buffer_multiset)
|
||||
|
||||
#ifdef MSGPACK_HAS_STD_TR1_UNOURDERED_MAP
|
||||
#include <tr1/unordered_map>
|
||||
#include "msgpack/type/tr1/unordered_map.hpp"
|
||||
#include "msgpack/adaptor/tr1/unordered_map.hpp"
|
||||
TEST(MSGPACK_TR1, simple_buffer_tr1_unordered_map)
|
||||
{
|
||||
for (unsigned int k = 0; k < kLoop; k++) {
|
||||
@ -569,7 +569,7 @@ TEST(MSGPACK_TR1, simple_buffer_tr1_unordered_multimap)
|
||||
|
||||
#ifdef MSGPACK_HAS_STD_TR1_UNOURDERED_SET
|
||||
#include <tr1/unordered_set>
|
||||
#include "msgpack/type/tr1/unordered_set.hpp"
|
||||
#include "msgpack/adaptor/tr1/unordered_set.hpp"
|
||||
TEST(MSGPACK_TR1, simple_buffer_tr1_unordered_set)
|
||||
{
|
||||
for (unsigned int k = 0; k < kLoop; k++) {
|
||||
@ -625,7 +625,7 @@ TEST(MSGPACK_TR1, simple_buffer_tr1_unordered_multiset)
|
||||
|
||||
#ifdef MSGPACK_HAS_STD_UNOURDERED_MAP
|
||||
#include <unordered_map>
|
||||
#include "msgpack/type/tr1/unordered_map.hpp"
|
||||
#include "msgpack/adaptor/tr1/unordered_map.hpp"
|
||||
TEST(MSGPACK_TR1, simple_buffer_unordered_map)
|
||||
{
|
||||
for (unsigned int k = 0; k < kLoop; k++) {
|
||||
@ -686,7 +686,7 @@ TEST(MSGPACK_TR1, simple_buffer_unordered_multimap)
|
||||
|
||||
#ifdef MSGPACK_HAS_STD_UNOURDERED_SET
|
||||
#include <unordered_set>
|
||||
#include "msgpack/type/tr1/unordered_set.hpp"
|
||||
#include "msgpack/adaptor/tr1/unordered_set.hpp"
|
||||
TEST(MSGPACK_TR1, simple_buffer_unordered_set)
|
||||
{
|
||||
for (unsigned int k = 0; k < kLoop; k++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user