Commit 2d92106e authored by Dominik Charousset's avatar Dominik Charousset

Merge branch 'master' into unstable

parents c73eb232 c25eec9f
...@@ -3,7 +3,7 @@ project(cppa CXX) ...@@ -3,7 +3,7 @@ project(cppa CXX)
set(LIBCPPA_VERSION_MAJOR 0) set(LIBCPPA_VERSION_MAJOR 0)
set(LIBCPPA_VERSION_MINOR 3) set(LIBCPPA_VERSION_MINOR 3)
set(LIBCPPA_VERSION_PATCH 1) set(LIBCPPA_VERSION_PATCH 2)
# prohibit in-source builds # prohibit in-source builds
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
......
Version 0.3.2
2012-07-30
- Bugfix: added 'bool' to the list of announced types
Version 0.3.1 Version 0.3.1
2012-07-27 2012-07-27
......
...@@ -619,6 +619,28 @@ class int_tinfo : public detail::default_uniform_type_info_impl<T> { ...@@ -619,6 +619,28 @@ class int_tinfo : public detail::default_uniform_type_info_impl<T> {
}; };
class bool_tinfo : public util::abstract_uniform_type_info<bool> {
public:
virtual void serialize(const void* instance, serializer* sink) const {
auto val = *reinterpret_cast<const bool*>(instance);
sink->begin_object(name());
sink->write_value(static_cast<std::uint8_t>(val ? 1 : 0));
sink->end_object();
}
virtual void deserialize(void* instance, deserializer* source) const {
auto tname = source->seek_object();
if (tname != name()) throw 42;
source->begin_object(tname);
auto ptval = source->read_value(pt_uint8);
source->end_object();
*reinterpret_cast<bool*>(instance) = (get<pt_uint8>(ptval) != 0);
}
};
class uniform_type_info_map_helper { class uniform_type_info_map_helper {
public: public:
...@@ -682,6 +704,8 @@ uniform_type_info_map::uniform_type_info_map() { ...@@ -682,6 +704,8 @@ uniform_type_info_map::uniform_type_info_map() {
helper.insert_builtin<std::string>(); helper.insert_builtin<std::string>();
helper.insert_builtin<std::u16string>(); helper.insert_builtin<std::u16string>();
helper.insert_builtin<std::u32string>(); helper.insert_builtin<std::u32string>();
// bool needs some special handling, because it hasn't a guaranteed size
insert({raw_name<bool>()}, new bool_tinfo);
// insert cppa types // insert cppa types
insert({raw_name<util::duration>()}, new duration_tinfo); insert({raw_name<util::duration>()}, new duration_tinfo);
insert({raw_name<any_tuple>()}, new any_tuple_tinfo); insert({raw_name<any_tuple>()}, new any_tuple_tinfo);
......
...@@ -299,8 +299,8 @@ int main() { ...@@ -299,8 +299,8 @@ int main() {
CPPA_TEST(test__spawn); CPPA_TEST(test__spawn);
CPPA_IF_VERBOSE(cout << "test send() ... " << std::flush); CPPA_IF_VERBOSE(cout << "test send() ... " << std::flush);
send(self, 1, 2, 3); send(self, 1, 2, 3, true);
receive(on(1, 2, 3) >> []() { }); receive(on(1, 2, 3, true) >> []() { });
CPPA_IF_VERBOSE(cout << "... with empty message... " << std::flush); CPPA_IF_VERBOSE(cout << "... with empty message... " << std::flush);
self << any_tuple{}; self << any_tuple{};
receive(on() >> []() { }); receive(on() >> []() { });
......
...@@ -68,6 +68,7 @@ int main() { ...@@ -68,6 +68,7 @@ int main() {
// these types (and only those) are present if // these types (and only those) are present if
// the uniform_type_info implementation is correct // the uniform_type_info implementation is correct
std::set<std::string> expected = { std::set<std::string> expected = {
"bool",
"@_::foo", // <anonymous namespace>::foo "@_::foo", // <anonymous namespace>::foo
"@i8", "@i16", "@i32", "@i64", // signed integer names "@i8", "@i16", "@i32", "@i64", // signed integer names
"@u8", "@u16", "@u32", "@u64", // unsigned integer names "@u8", "@u16", "@u32", "@u64", // unsigned integer names
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment