620 Commits

Author SHA1 Message Date
Shane Grant
fb9239bf3b Added macro to define base XML node name
Addresses concerns in issue #63

Also cleaned up a small amount of leftover commented out code, added const to some things that should be const, and a minor optimization in the JSON search to use strncmp in one instance.
2014-03-01 11:23:33 -08:00
Shane Grant
5ae926461f turning off code analysis
see #61
2014-02-27 21:53:05 -08:00
Shane Grant
048e95d966 Merge branch 'develop' of github.com:USCiLab/cereal into develop 2014-02-27 21:51:30 -08:00
Shane Grant
0d83f14fa3 Adding delay_static_assert
Closes #61
2014-02-27 21:50:58 -08:00
Shane Grant
923c3722eb minor cleanup in shared_from_this_wrapper 2014-02-26 14:10:10 -08:00
Shane Grant
89bcdc1404 32 vs 64 bit testing for portable binary
see #12
2014-02-22 23:02:12 -08:00
Shane Grant
2095c71e94 Adding warning about using std::ios::binary to doxygen 2014-02-22 19:38:05 -08:00
Shane Grant
30a22fec28 Renaming load_and_allocate to load_and_construct
Anything associated this that used the verb allocate has been replaced with construct

closes #59
2014-02-21 15:52:26 -08:00
Shane Grant
4a3c2859e6 using std::ios::binary for binary streams
see #54
2014-02-15 19:29:12 -08:00
Shane Grant
8fd965819c Adding _CEREAL_NVP for internal loads
Closes #56
2014-02-15 12:32:17 -08:00
Shane Grant
542406fba1 progress towards #56 through memory 2014-02-14 15:41:54 -08:00
Shane Grant
353252d7f9 Merge branch 'develop' of github.com:USCiLab/cereal into develop 2014-02-14 15:22:42 -08:00
Shane Grant
e9bff3a493 shared_ptr for enable_shared_from_this libc++
Addresses a libc++ only issue.  See the bug report here: http://llvm.org/bugs/show_bug.cgi?id=18843
2014-02-14 15:20:48 -08:00
Randolph Voorhies
24ce678c74 Fixes an issue with libc++ eof handling in rapidjson
The credit to this fix is due to @zittix. This closes issue #51.

This is due to a bug in the mac version of libc++ and should be fixed in
HEAD. See here for a related stackoverflow post:
http://stackoverflow.com/questions/14147667/clang-and-libc-istreampeek-does-not-set-eof-flag
2014-02-14 11:37:54 -08:00
Shane Grant
cde2d2954d Misc fixes to better MSVC support
Fixed a preprocessor define
Removed an extra semicolon
cereal::any is hidden behind an include guard now
2014-02-13 23:51:05 -08:00
Shane Grant
d89c94d7bb Adding polymorphic unit tests for enble_shared_from_this
Should fix #47
2014-02-11 16:52:57 -08:00
Shane Grant
2c618bb6d4 adding comments
see #47
2014-02-11 16:38:29 -08:00
Shane Grant
3447e059a4 cleanup junk leftover from last commit
see #47
2014-02-11 16:33:13 -08:00
Shane Grant
6bb2f28908 has_shared_from_this and get_shared_from_this_base
Functionality to figure out the type enable_shared_from_this was templated on for
any base type of the current type.

see #47
2014-02-11 16:30:53 -08:00
Shane Grant
29578c8c48 Support for std::enable_shared_from_this
Fixes #47

When we detect a shared_ptr being loaded in load_and_allocate that
also is of a type that derives from enable_shared_from_this, extra
work is done to save the state of the enable_shared_from_this before
the user gets to meddle with it via placement new inside of
cereal::allocate.  State is restored after getting back from the user.
2014-02-09 12:31:32 -08:00
Shane Grant
6c163a54eb Comments for any marking it as unsupported
see #46
2014-02-08 19:06:40 -08:00
Shane Grant
32c423c16d Light-weight version of boost::any working
See issue #46
2014-02-08 19:03:01 -08:00
Shane Grant
481c2002ff Light-weight Any implementation for #46
Compiles but not stable yet, no interface to use Any within cereal yet.  Will be kept internal and not exposed for use
outside of whatever the load/store names will be.
2014-01-31 22:48:06 -08:00
Shane Grant
10df6c4c0c Adding ptr() to cereal::allocate
Also renamed things to avoid shadowing
See #46 for example that inspired ptr()
2014-01-31 21:56:25 -08:00
Shane Grant
f0f336d15f fixing spelling typo in comment 2014-01-24 15:49:23 -08:00
Shane Grant
f8ec6251f0 Adding some specialize macros
Adding some macros for specialization in case people feel like
typing less scary looking template specialization code.

Modified static assert to remind people that specialization exists.

See issue #25
2014-01-24 15:47:33 -08:00
Shane Grant
942873c5a1 Adding access to members during allocate
Moving code around a bit, allocate is now in access.hpp which seems
to make a bit more sense.  Exception is now in helpers.hpp.

It is now possible to use a cereal::allocate<T> object to directly
access member variables or functions after it has been initialized.
Accessing them before initialization will throw as will performing
a double initialization.

see #46
2014-01-23 11:53:10 -08:00
Shane Grant
2b25a7b3d6 Considering #44 fixed
Need to do a once over on documentation to finish up, see issue #22
2014-01-22 16:57:07 -08:00
Shane Grant
6f7ca3ea99 adding tests for load_and_allocate
relates #44
2014-01-22 16:33:56 -08:00
Shane Grant
9d4f51ee10 Also for #44, need to test type_traits on load_and_allocate 2014-01-22 14:44:18 -08:00
Shane Grant
00b18c4d6a progress towards circular loads #44
Passing tests but need to look over this with valgrind some more.  Potentially have some issues here, moreso with
unique_ptr than shared_ptr.
2014-01-22 14:38:27 -08:00
Shane Grant
3a92f0bb34 Starting on solution for #44
Won't have time to finish this one right now, but this solution should work well.

1) Realized there was no reason to do the deferring thing, we just register immediately after
allocation and use that pointer, so got rid of some overhead in code/time on regular shared_ptr loads.
2) For cases with no default constructor the interface will be changing slightly.  Instead of having the
user do both the allocation and initialization, the user will only be responsible for the initialization.
This works as follows:

We allocate std::aligned_storage big enough for the type and pack it into a shared_ptr for the proper type with
a custom deleter to correctly call the proper destructors.  We'll wrap up this raw pointer in a new class called
cereal::allocation (or similar) which will now be passed along with the archive as a reference to the load and
allocate function.  The user now loads up their data as before using the archive, and then instead of performing
a raw call to operator new, they pass all of their arguments to the operator() of the cereal::allocation object
which then performs a placement new into the aligned_storage (transparent to the user).  Should resolve the circular
reference problem too.
2014-01-21 22:40:50 -08:00
Shane Grant
be4ec7df10 Fixes #40 2014-01-21 14:37:57 -08:00
Shane Grant
d5e813aa56 adding units tests for #44 2014-01-16 15:15:11 -08:00
Shane Grant
ce009d9c9a fixing typo for #44 2014-01-16 14:37:53 -08:00
Shane Grant
253c3274fe Adding documentation for issue #43 2014-01-14 14:22:21 -08:00
Shane Grant
0c5846fe93 done with issue #43 aside from documentation
to handle circular nested shared pointer references, we split registration
for an id into a pre and post portion, where pre marks it as being dirty and
post marks it clean (valid).  if we are loading up a reference to something that is
in the progress of being loaded (a nested case), we defer our load until it is no longer
dirty and perform the load afer the post condition happens.
2014-01-14 14:07:08 -08:00
Shane Grant
30836ce2bf Fix for load_and_allocate in regards to issue #42
load_and_allocate did not properly enter into the 'data' NVP that the
ptr_wrapper creates for unique/shared ptr.  When loading these types,
we now go through a wrapper struct to force entry into an extra node to
resolve this issue.

Changes to unittests are for an issue compiling with g++-4.7.3 under
Ubuntu where steady_clock::now() is not defined for some reason
2014-01-07 11:38:28 -08:00
Shane Grant
4de892eaf8 Merge branch 'develop' of github.com:USCiLab/cereal into develop
Conflicts:
	include/cereal/cereal.hpp
	include/cereal/details/helpers.hpp
2014-01-07 10:21:54 -08:00
Shane Grant
06185def6b Looks like some changes that never got commited for issue #17 in regards to -WShadow 2014-01-07 10:17:09 -08:00
Shane Grant
b3527ffd0f Missing const on weak_ptr lock, addresses part of issue #43 2014-01-06 12:12:38 -08:00
Shane Grant
436a0a275c g++ 4.7.3 compatability fixed
closes #38

Added a preprocessor define CEREAL_OLDER_GCC that exists if using
any GCC 4.7.x or earlier.  If this is defined some type traits change to
our original solution (prior to VS compatible), which is probably what we'd switch
to if VS ever gets around to fully supporting SFINAE and constexpr.

In map and set, as well as in unit tests, use insert instead of emplace for 4.7.x.
2013-12-22 13:25:06 -08:00
Shane Grant
456122cfd0 re-do fix for 4.7
beware using the wrong compiler, still uses typo fix
2013-12-22 12:41:18 -08:00
Shane Grant
046eefa4af fixed typo in characterOk that allows previous 4.7 workaround to be removed 2013-12-22 12:39:20 -08:00
Shane Grant
402ff90c4e 4.7 compatability changes
-Convert to int with constexpr in reader/writer to avoid
 always false comparison error in gcc 4.7.3
-make clean now removes visual studio sandbox if built
-fixes to traits for 4.7, still more to do there
see #38
2013-12-22 12:32:54 -08:00
Shane Grant
89baf45371 fixed shadow warning 2013-12-22 12:15:50 -08:00
Shane Grant
8e5fa8ef33 testing macros for gcc 4.7 2013-12-22 12:14:23 -08:00
Shane Grant
9085b6dc79 Adding tests for #8, fixed bug re #8
Added a test case for versioning which exposed a small bug that related to loading versioned data due to an improper use
of static.
2013-12-21 23:21:24 -08:00
Shane Grant
7ef5a9311b Making some changes on vs2013, replacing some typedefs with using statements now that those are cool 2013-12-21 21:22:46 -08:00
Shane Grant
f9b3eb5bd6 Adding missing header from access for std::uint32 2013-12-21 13:54:10 -08:00