Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create "modules" for types not in the standard library #123

Open
AzothAmmo opened this issue Sep 15, 2014 · 12 comments
Open

Create "modules" for types not in the standard library #123

AzothAmmo opened this issue Sep 15, 2014 · 12 comments

Comments

@AzothAmmo
Copy link
Contributor

We already have support for boost::variant mostly due to needing it for a project when cereal was created, but there are many other common things cereal could have support for.

Instead of cluttering the cereal types directory with these, it would be better to have organized modules of support for things, e.g. boost, opencv, or eigen. I'd prefer if these weren't pulled by default with cereal, so they either need to be in another repository or potentially just in some directory that would be outside of the normal cereal install (the cereal include folder).

This relates to the pull requests #53 and #122.

@stevehickman
Copy link

Modules makes sense to me. For something as large as Boost, would it make sense to have submodules as well?

@stevehickman
Copy link

In terms of subcategories for Boost, it may make sense to use Boost categories or(http://www.boost.org/doc/libs/1_56_0/?view=categorized) or individual library names as the organizing principle to help users know which submodules they might need. In some cases (e.g., Containers and Data Structures), the individual libraries within the category may contain enough data structures to make creating a separate module for each worthwhile. In other cases (e.g. Algorithms), where the primary focus in not on data structures, there will still be data structures used by the libraries in the category, but there may not be enough in each individual library to make creating an entire submodule worthwhile.

The competing forces, as I see it right now, are 1) the more that is in a single module/ submodule, the more effort required to keep the module/submodule updated; 2) the more modules/submodules proliferate, the higher the effort required of each user to keep track of which ones are needed.

Net result: Probably makes sense to just start with a single Boost module, with the thought that breaking it into multiple submodules down the road as it grows may be needed. As each module, submodule grows "too large", it gets factored into smaller pieces based on some easily understood criteria (like Boost category or library name. Knowing that we'd need to leave room to refactor / break apart modules should be sufficient initially.

@stevehickman
Copy link

I did a quick review of Boost and created the list below of the libraries it makes sense to serialize. This list excludes libraries that are already in C++11 or those that don't have data structures that it would make sense to serialize. Note that this was a quick review - it may turn out that some of these don't need to be serialized. I have not (yet) attempted to identify which of these are used the most.

Any
BiMap (maps and iterators after maps)
Circular Buffer
Compressed Pair
Config (Standard Integer Types) -
Container - maybe? mostly C++11 conformant
Context - for thread switching - would this ever be serialized (debug logs?)
Date_Time - could, but std already has Chrono - lower priority
Dynamic Bitset
Exception - maybe - dig deeper
Filesystem - in TR2? Check
Flyweight
Fusion
Geometry
GIL (Generic Image Library) - might be big enough for a submodule
Graph - might be big enough for a submodule
Heap
ICL
Interprocess
Interval
Intrusive
IO State Savers - duh
Iterators - must work in conjunction with iterated collection?
Locale
Lockfree
Math - 128 bit floating point structure. Others?
Math Octonions
Math Quaternion
Meta State Machine
Multi-Array
Multi-Index
Multiprecision
Optional - done
Parameter
Pointer Container (along with the things it points to)
Polygon
Property Map
Property Tree
Range - but only if the referenced collection is serialized
Rational
Regex
SmartPtr (if any aren’t in C++11)
Spirit
Statechart
Tribool
Tuple
TypeIndex
uBLAS
Units - store value and units (might need own submodule)
Uuid
Variant - already done

@AzothAmmo
Copy link
Contributor Author

My intention here will be for the majority of these modules to be community contributed once we have the infrastructure in place, and we likely won't implement anything ourselves unless we have an immediate need for it.

@patlecat
Copy link

Excellent idea, that will help immensely working with Cereal! But I wouldn't make the use of them modules too remote and complicated. A simple include or config entry in a header file should do to add what the developer needs.

@patlecat
Copy link

Besides I think especially Flyweight could profit a lot from this, since it added Boost::Serialization in 1.57 and has key-value types. With this and a fast serialization lib Cereal could rival with the use of pure key-value store databases like Redis! 💃

@pwm1234
Copy link

pwm1234 commented Sep 8, 2016

I just implemented cereal load/save functions for boost::posix_time::ptime. Is there someplace I can put this? In a comment above @AzothAmmo said "once we have the infrastructure in place". Since that comment was made two years ago and this is still an open issue, I suspect the intended infrastructure will not be in place. Can we adjust our intentions to get these kind of community contributions in place? (I am not being critical--I just found cereal and really like the work that you have done on it! I want it to continue to improve and grow.)

My preference would be a subdirectory in the cereal repo, perhaps include/cereal/contrib? I feel this would be better than a separate repo. I am, however, a newcomer to cereal; I would certainly defer to others.

@qh-huang
Copy link

I plan to implement boost::graph save/load functions. This thread seems ended in 2014, but I can't find the conclusion about 3rd party data structure serialization. There is no "module" nor "contrib" folder for community work.

Is there any ways to provide our code?

@AzothAmmo
Copy link
Contributor Author

I recently created a Github project for this (see here: https://github.com/USCiLab/cereal/projects/1) to help organize all of the modules related work. This is still something I very much want to add to cereal, and would greatly appreciate input and assistance with.

I don't want contributions to reside in the main cereal repository if they 1) aren't part of the standard library or 2) can't be entirely self contained (for contributions that aren't serialization functions). For example, a new archive, assuming it was header only with no external dependencies, would be fine for inclusion into the main cereal repository.

I have two ideas for how to actually implement contributions such as these into cereal:

  1. Each contribution would consist of a submodule in the appropriate location, along with a second submodule in the unittests directory. The upsides to this are that users can easily add features by just pulling a submodule and it will exist in a sensible location (e.g. cereal/types/boost). The downsides are that for development, each contribution is now split into at least two different repositories (e.g. boost and boost_unittest), making development more annoying.
  2. Each contribution consists of a single submodule, residing in cereal/modules, and contains all necessary code and unit tests. As part of the installation of a module, the repository would be pulled and unpacked into the appropriate directories within cereal. This would be accomplished using some combination of CMake and/or scripts, such that a user could do something like make install_module_boost and end up with the appropriate code now residing in cereal/types/boost, unittests, or wherever else.

The second option is currently my favorite of the two though it is more work to set up. It will be easier on developers because everything can be contained in a single repository.

Ideally I would like repositories to be contained here, with ownership rights shared amongst maintainers of the module as well as cereal (though neither idea presented here requires this).


For now, feel free to add your contribution to cereal/types/boost/XXX/YYY (along with an appropriate unit test) until the above system is in place. I'll do my best to devote some time to cereal in the coming weeks to start to address this all.

@stevehickman
Copy link

The work was moved to the develop branch. See this pull request:
#282

What you can do is pull from my repo: https://github.com/stevehickman/cereal/tree/develop

make your changes and then send me a pull request. I’ve integrated several other boost contributions. That way all the boost contributions will get added in pull request 282.

NOTE: I am 2 updates behind the USCIlab develop branch. I’ll get that taken care of no later than this weekend. That shouldn’t affect any work you do.

Also – when you pull from my develop branch, take a look at how I structured the tests. There are several things there you can take advantage of if you like. If you have any questions, ask. I’ll use your questions and update the readme with the answers.

Regards,

Steve H.

From: qiao [mailto:notifications@github.com]
Sent: Tuesday, September 27, 2016 11:40 AM
To: USCiLab/cereal cereal@noreply.github.com
Cc: Hickman, Steve Steve.Hickman@honeywell.com; Comment comment@noreply.github.com
Subject: Re: [USCiLab/cereal] Create "modules" for types not in the standard library (#123)

I plan to implement boost::graph save/load functions. This thread seems ended in 2014, but I can't find the conclusion about 3rd party data structure serialization. There is no "module" nor "contrib" folder for community work.

Is there any ways to provide our code?


You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com//issues/123#issuecomment-249957687, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGVK-GC4YrkKs3UT2DhVzUfaaye_UBlZks5quWL-gaJpZM4CiLCV.

AzothAmmo added a commit that referenced this issue Oct 28, 2016
@AzothAmmo
Copy link
Contributor Author

I've started working on #139 which is a core requirement for modules. I'm also going to be removing the dependency on boost test in favor of doctest.

AzothAmmo added a commit that referenced this issue Nov 4, 2016
-Now build 32 bit unit tests if portability testing is enabled
-No more boost+clang issues over std::string abi
see #139, #123
@AzothAmmo
Copy link
Contributor Author

A small update on this - the current plan is to use a cross platform CMake based module system (e.g., https://github.com/iauns/cpm, https://github.com/ruslo/hunter, or https://github.com/tamaskenez/cake) to "install" modules into an existing cereal installation.

The idea is that if you wanted boost support, this would simply be an option you specify to CMake, which would then automatically download the required files and update CMake flags as appropriate. Modules would have a CMake file that describes how their directory structure should be integrated into cereal proper.

Consider a hypothetical boost module, which might have an organization like:

|- license.txt
|- install.cmake
|- unittests
 |- boost_optional.hpp
 |- boost_optional.cpp
 |- etc
|- include
 |- cereal
  |- types
   |- boost_optional.hpp
   |- boost_chrono.hpp
   |- etc

This would get placed in the appropriate locations within cereal, allowing for things like unit testing to now additionally compile the unit tests from the module. CMake could also keep track of the installed modules and remove them if necessary.

This approach keeps a clean separation of cereal proper and modules. It allows us to easily support a mix of curated modules (hosted here, with shared ownership between a maintainer and cereal: https://github.com/cerealcpp) but still allow any repository to be a potential source, so long as it has an appropriate CMake module file that explains how it should be installed.

headupinclouds added a commit to headupinclouds/cereal that referenced this issue Aug 15, 2017
commit aa891a4
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Jun 26 13:42:08 2017 -0700

    Resolves USCiLab#414

commit fcef0da
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri May 5 11:37:12 2017 -0700

    Fix shadowing issue for USCiLab#401, recent osx compile issue re: USCiLab#354

commit 950aca4
Merge: ad90557 35a36af
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri May 5 11:09:34 2017 -0700

    Merge branch 'hoensr-xml-no-size-attributes' into develop

commit 35a36af
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri May 5 10:54:25 2017 -0700

    Standardize interface for options (xml)
    see USCiLab#401

commit ad90557
Merge: f031131 2ab15f7
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed May 3 11:39:02 2017 -0700

    Merge branch 'develop' of github.com:USCiLab/cereal into develop

commit f031131
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed May 3 11:38:35 2017 -0700

    modifications for g47 and comment out memory intensive testing

commit c4dcc8d
Merge: 68f56ee 676d329
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed May 3 11:11:08 2017 -0700

    Merge branch 'issue_354' into develop

    still needs more work but this is an improvement for now
    see USCiLab#354

commit 52b03d5
Author: Robin Hoens <robin.hoens@qiagen.com>
Date:   Mon Apr 10 17:13:39 2017 +0200

    Add option to turn off the size=dynamic attributes of lists

commit 2ab15f7
Merge: 68f56ee 7723503
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Tue Apr 11 16:17:51 2017 -0700

    Merge pull request USCiLab#397 from albertziegenhagel/issue_396

    Add remove_reference to determine whether template argument to BinaryData is const

commit 7723503
Author: Albert Ziegenhagel <albert.ziegenhagel@scai.fraunhofer.de>
Date:   Tue Apr 11 10:32:55 2017 +0200

    Add remove_reference to determine whether template argument to BinaryData is const

commit 68f56ee
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Apr 10 11:22:38 2017 -0700

    Remove undefined behavior, see USCiLab#390

commit 676d329
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Feb 22 14:43:31 2017 -0800

    adventures in microoptimization USCiLab#354

commit 546fd9b
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sun Feb 19 16:25:32 2017 -0800

    tinkering on USCiLab#354

commit 8b8f581
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Feb 15 13:39:42 2017 -0800

    Fix macro for double comparison in unit test
    relates USCiLab#338

commit 51cbda5
Merge: 70c4420 e38d6fe
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sun Feb 12 14:06:58 2017 -0800

    Merge branch 'develop' for release 1.2.2

commit e38d6fe
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sun Feb 12 13:46:25 2017 -0800

    fix update doc script

commit 70c4420
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sun Feb 12 00:25:30 2017 -0800

    Update README.md

    add appveyor badge

commit 2590f21
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sat Feb 11 23:47:00 2017 -0800

    Properly use multimap for lookup in poly casting
    relates USCiLab#356, still need final testing on MSVC

commit a917374
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Feb 8 10:47:02 2017 -0800

    size_type now specified by macro CEREAL_SIZE_TYPE
    resolves USCiLab#379

commit ee17db5
Merge: b827b95 f577fc4
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Feb 6 22:51:29 2017 -0800

    Merge branch 'develop' of github.com:USCiLab/cereal into develop

commit b827b95
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Feb 6 22:50:56 2017 -0800

    Fixes need for special MSVC case, see USCiLab#373

commit f577fc4
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sun Feb 5 22:13:08 2017 -0800

    Turn on warnings as errors for MSVC, warning level to 3
    Can't do level 4 warnings yet - need to make an upstream change to doctest

commit fb6606d
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Sun Feb 5 18:13:37 2017 -0800

    Do not build coverage or valgrind for MSVC

commit a2d5a15
Merge: 4a92e29 e4d543d
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Jan 27 10:29:51 2017 -0800

    Merge branch 'tusharpm-develop' into develop

    see USCiLab#373

    Still need to address why windows needed a modifcation to polymorphic test to compile

commit e4d543d
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Thu Jan 26 16:53:47 2017 +0530

    Fix merge issues

commit 2261fee
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Sun Dec 18 17:32:04 2016 +0530

    Pull requests to not increment build numbers

commit 4ff4db8
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Sun Dec 11 20:03:02 2016 +0530

    boost new version

commit 655696a
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Sun Dec 11 15:42:00 2016 +0530

    AppVeyor integration

commit df44243
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Sun Dec 11 01:01:10 2016 +0530

    Enable cross-platform portability test

    CMake fix 32-bit executable with generator Win64

commit 0a908bc
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Sat Dec 10 17:27:28 2016 +0530

    Make tests pass with Windows

commit 4a92e29
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Jan 25 11:04:24 2017 -0800

    no longer need boost test in travis

commit a8e9963
Merge: 75e50ee 1d67d44
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Jan 25 10:56:38 2017 -0800

    Merge branch 'develop_doctest' into develop

    see USCiLab#139

commit 75e50ee
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 13:48:46 2016 -0800

    remove old code from sandbox relates USCiLab#363

commit 507f97d
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 11:53:56 2016 -0800

    add -Wold-style-casts see USCiLab#363

commit f69ad7c
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 11:50:23 2016 -0800

    tab to space

commit d21b0c0
Merge: 29829c1 e63f08f
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 11:47:53 2016 -0800

    Merge branch 'laudrup-master' into develop
    see USCiLab#363

commit e63f08f
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 11:47:24 2016 -0800

    minor adjustments to casts, see comments on USCiLab#363

commit 29829c1
Merge: 9978e0c ad92746
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 10:41:27 2016 -0800

    Merge branch 'FlexCoreLib-doxygen_access_from_extern' into develop

    see USCiLab#365

commit ad92746
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 10:41:02 2016 -0800

    comment out obsolete doxygen

commit 9978e0c
Merge: 1edc5c6 6e71766
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 10:37:17 2016 -0800

    Merge pull request USCiLab#366 from headupinclouds/pr.is_loading.is_saving

    Add is_loading and is_saving values to cereal::{Input,Output}Archive

commit 1edc5c6
Merge: 72d7936 6086234
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Mon Nov 28 10:35:24 2016 -0800

    Merge pull request USCiLab#367 from tusharpm/develop

    Travis configuration updates

commit 6086234
Author: Tushar Maheshwari <tushar27192@gmail.com>
Date:   Sun Nov 27 13:57:26 2016 +0530

    Travis configuration updates
    - Switch to trusty container-based infrastructure for linux systems
    - Add a job to test with clang compiler (skips portability test)
    - Add a job to test on macOS with Xcode8

commit 6e71766
Author: David Hirvonen <dhirvonen@elucideye.com>
Date:   Sat Nov 26 12:31:56 2016 -0500

    Remove spurious character

commit 9376ca6
Author: Kasper Laudrup <laudrup@stacktrace.dk>
Date:   Wed Nov 23 01:34:53 2016 +0100

    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

commit 1d67d44
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Nov 4 16:07:00 2016 -0700

    Removed boost_test as a requirement
    -Now build 32 bit unit tests if portability testing is enabled
    -No more boost+clang issues over std::string abi
    see USCiLab#139, USCiLab#123

commit 66528b6
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Nov 4 15:51:57 2016 -0700

    last? conversions for USCiLab#139

commit 978b3b5
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Nov 4 12:11:51 2016 -0700

    typo fix in comment USCiLab#139

commit 13ae560
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Nov 4 12:10:24 2016 -0700

    more USCiLab#139

commit 07818f4
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Nov 4 12:00:16 2016 -0700

    more USCiLab#139

commit b5e500d
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Nov 2 16:32:35 2016 -0700

    more USCiLab#139

commit a6e59d7
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Nov 2 13:38:33 2016 -0700

    more for USCiLab#139

commit cd46374
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Wed Nov 2 12:20:22 2016 -0700

    more converted for USCiLab#139

commit 38e1548
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Tue Nov 1 11:59:40 2016 -0700

    headers USCiLab#139

commit 15c7339
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Tue Nov 1 11:59:02 2016 -0700

    more conversions USCiLab#139

commit 928cd36
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Tue Nov 1 11:41:28 2016 -0700

    more conversions to CHECK_EQ
    see USCiLab#139

commit 0a262ec
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Tue Nov 1 11:36:22 2016 -0700

    More tests split, switch to CHECk_EQ over CHECK
    see USCiLab#139

commit 671999e
Author: Shane Grant <w.shane.grant@gmail.com>
Date:   Fri Oct 28 14:28:37 2016 -0700

    Initial progress on removing boost test and moving to doctest to better support modules

    relates USCiLab#123

commit a066808
Author: Caspar Kielwein <Caspar@Kielwein.de>
Date:   Sun Oct 2 16:09:04 2016 +0200

    Add cereal.doxytags as tagfile to allow external projects to link to cereal documentation.

commit 3fb59db
Author: Caspar Kielwein <Caspar@Kielwein.de>
Date:   Sun Oct 2 15:53:28 2016 +0200

    Build doxygen documentation with separate CMakeLists.

    Extracted CMakelists.txt to doc subdirectory.
    Changed paths in doxyfile.in and CMakeLists accordingly.
    added doc as subdirectory in main CMakeLists.txt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants