Commit Graph

71 Commits

Author SHA1 Message Date
Kasper Laudrup
9376ca6055 Don't use C style casts
Change C style casts to C++ static casts.

This makes the code compile with the -Wold-style-cast warning enabled
2016-11-23 01:34:53 +01:00
Shane Grant
fb7fd75954 Changes to support thread safety
-Make CEREAL_THREAD_SAFE be 0 or 1 instead of present or not present
-Move CEREAL_NOEXCEPT to macros.hpp
-instead of individual locks, can now use StaticObject::lock() to request a lock if CEREAL_THREAD_SAFE is enabled. If
not enabled, this call returns an empty object. The lock returned acts just like std::lock_guard, but uses
std::unique_lock internally
-Made a bunch of requests to StaticObject::getInstance const
-Added first stab at multithreaded tests with versioning and polymorphism
2016-07-29 13:40:49 -07:00
Shane Grant
58d244edb7 fix uninit valgrind error for base ctor in diamond inheritance 2016-06-30 14:38:54 -07:00
Shane Grant
6d8bdd8818 Split lookup and exists check in PolymorphicCasters into two functions.
Fixes a bug related to lookup, see #291

Also changed from bool to uint8_t for #306

Updated gitignore for MSVC junk
2016-06-29 12:32:02 -07:00
Shane Grant
c330000cb4 Fix problems with portable_binary for BinaryData
see #298
2016-06-13 11:28:18 -07:00
Shane Grant
aaf1ef185e Implicitly build intermediate relations for polymorphism
relates to #281

Now if someone has a hierarchy like A -> B -> C,
the A->C relation will be automatically created if A->B and B->C already exist.
This is implemented by a chain of casts to get down the inheritance.

In the case of multiple paths, the shortest one will be chosen.
2016-04-29 16:39:31 -07:00
Shane Grant
8ab5c1cfe5 Unit tests for #216 2016-03-30 11:34:17 -07:00
Shane Grant
08891efaa9 Add empty serialization func for std::less
-Resolves issues with compiling priority_queue (#264)
-Removed std::less serialization from testing common file
2016-03-01 14:30:02 -08:00
Shane Grant
e9d33b0a1f BinaryData optimization for Bitset
Integrates the changes proposed by #236

Bitset will now use a chunking method when serializing to BinaryData
capable archives, which should be faster, especially for larger bitsets.

Archives that do not support BinaryData will continue to use the old method.

Also added a larger bitset to the test case
2016-02-05 10:14:44 -08:00
Shane Grant
6a7bffb34d fix double comparison for variant test #230 2016-01-27 15:22:43 -08:00
Shane Grant
27e4172f0b Improve variant test relates #230 2016-01-27 15:10:44 -08:00
Shane Grant
d612b9fc65 Merge branch 'test_boost_variant' of https://github.com/kylefleming/cereal into kylefleming-test_boost_variant 2016-01-27 15:03:24 -08:00
Shane Grant
f6d0308a0b Merge branch 'develop' of https://github.com/adasworks/cereal into adasworks-develop 2015-12-27 23:26:01 -08:00
Shane Grant
20778fe4b8 Finish up endian support for portable binary
-added more tests
-should resolve #115
2015-12-27 23:21:59 -08:00
Shane Grant
68f75089a9 Fix compilation issue with old boost test 2015-12-25 18:19:53 -08:00
Shane Grant
05afe09737 Merge branch 'issue_188' into develop
resolves #188

still need to update website doc
2015-12-25 18:02:20 -08:00
Shane Grant
61d610db27 Merge branch 'develop' of github.com:USCiLab/cereal into develop 2015-12-25 17:58:08 -08:00
Shane Grant
480de61173 make clang happy with integer comparisons 2015-12-22 22:30:30 -08:00
Shane Grant
1d50761ece Boost test related fix, fix unit test in response to #188 2015-12-21 23:21:11 -08:00
Shane Grant
bdd766d474 Adding unit tests for polymorphic casting
Added support for up and downcasting for polymorphism, see issue #188

Still needs final documentation + cleanup
2015-12-20 18:15:29 -08:00
Sébastien Matte
de1011152e Fixed an issue with the preservation of whitespaces for strings. The validation may be invalid when one of the previous calls to the saveValue was done and the value was taking more characters. A test is now added in order to reproduce this error. 2015-11-06 00:24:17 -05:00
Tamas Kenez
cd7346ff3d cmake improvements (install target)
- add install target to install config-module for
  which creates an INTERFACE library
- add unittest to test config-module
- add option to skip tests and install only
- fix MSVC compatibility problem in CMakeLists.txt
2015-10-06 14:32:40 +02:00
Kyle Fleming
99d8f0a77d Barebones boost::variant unit test 2015-09-03 17:15:06 -07:00
Shane Grant
676ebf76fa more tab spacing fixes 2015-05-02 21:53:30 -07:00
Shane Grant
15d4e9f10e style changes 2015-05-02 21:49:39 -07:00
Shane Grant
7e1d32f1d5 Merge branch 'std.valarray.support.implementation' of https://github.com/ilerik/cereal into ilerik-std.valarray.support.implementation 2015-05-02 21:30:25 -07:00
Shane Grant
5d541d33cd JSON now matches string length for out of order NVPs
Fixes #183, relates #168, #169
fix originally proposed by @felixzng
2015-05-02 21:17:44 -07:00
ilerik
005d628652 Added support for std::valarray.
1) Implemented std::valarray serialization (based on vector.hpp) in file valarray.hpp
2) Implemented unit tests in file valarray.cpp (based on vector.cpp tests, except for bool case)
3) vs2013/unittests project configuration updated accordingly
4) unittests/common.hpp updated.
5) No documentation so far
2015-04-18 17:50:59 +03:00
Shane Grant
94d49c42ac is_in/out_serializable is now aware of specialization
count_in/out_serializers will now count the number of specializations if a type is
specialized, otherwise it will count the number of non-specialized serialization functions.

as a result of this, is_output/input_serializable now works as you would expect from the name
and will return true for correctly configured specialized types too.

this caused some logic changes to need to happen in cereal.hpp, mostly within the PROCESS_IF macro.

added some tests related to this change and #180

fixes #180
2015-04-04 18:19:22 -07:00
Shane Grant
b385b3958a Empty string fixes with XML serialization
Fixes #182
2015-04-04 15:09:23 -07:00
Shane Grant
aad1e371c7 Merge branch 'develop' of github.com:USCiLab/cereal into develop 2015-03-29 00:36:28 -07:00
Shane Grant
14bc429d9a Various fixes for warning level 4 with MSVC
closes #178
relates #151
2015-03-29 00:35:34 -07:00
Shane Grant
0d8cebe6f3 Add unit tests for size 11 tuple, re: #175 2015-03-04 15:24:11 -08:00
Shane Grant
418271f219 Marking adapters as FUTURE_EXPERIMENTAL
see notes in #46
2015-01-16 15:42:10 -08:00
Shane Grant
dfa871d5d8 Added test to VS build, related fixes
Relates to #46, passing on VS now
2014-10-05 18:01:12 -07:00
Shane Grant
e054ec1b10 Merge branch 'issue_46' into develop relates #46 2014-10-04 19:15:05 -07:00
Shane Grant
901489593f finish unit test for #46 2014-10-04 19:02:35 -07:00
Shane Grant
5715d7ad01 Clean up UserDataAdapter
Wrapped dynamic_cast in a cereal exception,
made the rtti function private,
updated test case to expect failure on some cases
2014-10-03 14:39:21 -07:00
Shane Grant
851e72bd1a Some ideas on solving adapters
This is a solution for #46 that uses RTTI to allow get_user_data to work
and throw an error when used in an archive that doesn't actually have user
data.  Unfortunately this is a run-time check and uses a dummy virtual function
that is never actually called (so the overhead of this will be very low, a few bytes
for the vtable, no runtime cost).

Another solution I'm going to play around with involves re-arranging some templates and
typedefs.
2014-09-26 21:59:18 -07:00
Randolph Voorhies
28f9841fdb Fixing issues with icc. refs #120
In sandbox_vs.cpp, there is a very strange issue with calling
traits::is_input_serializable that causes icc 15.0.0 to crash.
Everything else works great though.
2014-09-02 11:49:47 -07:00
Randolph Voorhies
652e9b7f34 Fixed issue with private c'tors
This fixes an issue where we were not properly using cereal::access to
default construct classes.

This closes issue #119.
2014-08-26 11:45:38 -07:00
Shane Grant
2e1737ec1f Uncomment test for issue #116 2014-08-22 13:23:44 -07:00
Shane Grant
13b0c7edb5 Support for char in XML archive
-Added unit tests for char in pod
-XML archive should properly deserialize chars vs int8_t types now
see #116

still needs to be tested on VS and g49
2014-08-21 23:43:52 -07:00
Shane Grant
ba63d4a093 Merge branch 'volo-zyko-master' into issue_109 2014-08-18 17:10:25 -07:00
Volo Zyko
f8a871c7ff Another attempt to fix issue #109 now for any type that can contain whitespaces 2014-08-18 14:57:07 +03:00
Björn Esser
869b2b2cda add CMake-option 'SKIP_PORTABILITY_TEST' 2014-08-05 19:43:15 +02:00
Volo Zyko
16bf75dedf Extended the fix for issue #109 and added a test. 2014-07-31 15:45:05 +03:00
Shane Grant
ea007dafd8 Adding additional tests to cover issue #79 2014-06-06 15:24:24 -07:00
Shane Grant
f067ba6905 Fixing issue #79
Added a set of trait classes that can be used to get an input archive
from an output archive.  Requires specializing a struct for each direction or
alternatively using the new macro CEREAL_SETUP_ARCHIVE_TRAITS(InArchive, OutArchive).
This has already been added for all built in archive types.  This is currently only
used for minimal serialization.

load_minimal type traits now correctly use the output archive to check the existence of
a corresponding save_minimal and get its return type, using the new get_input_from_output
type class.

Added a test for this case into the minimal structs test.

Sandbox_vs needed the new macro to become compliant.
2014-05-22 10:59:13 -07:00
Shane Grant
8785741f41 Progress towards #46 2014-05-19 16:15:16 -07:00