Commit 0a785ab1 authored by eudaldsabate's avatar eudaldsabate
Browse files

Main is now the master branch

parents 6ac2be30 226caccb
demo: server client
CFLAGS=-Wall -g -std=c++11
LDFLAGS=-lpthread -lrt
INCLUDE=-I./cereal/include -I./include
server: demo/server.cpp
g++ ${CFLAGS} ${INCLUDE} demo/server.cpp -o server ${LDFLAGS}
client: demo/client.cpp
g++ ${CFLAGS} ${INCLUDE} demo/client.cpp -o client ${LDFLAGS}
clean:
rm server
rm client
\ No newline at end of file
# masa_protocol
Client-Server protocol, tailored to send different tipes of datagrams via UDP or TCP created by UNIMORE.
## Usage
TODO
---
### How to add a new datagram type
1. In **include/objects.hpp** define your data structure, if necessary.
2. In **include/messages.hpp** define a new message structure. Each message should be child of ```struct Message```.
3. Since each different datagram is intended to be sent to a different port, please note the file ``protocol_ports.md``
# Compiled Object files
*.slo
*.lo
*.o
# Compiled Dynamic libraries
*.so
*.dylib
# Compiled Static libraries
*.lai
*.la
*.a
# Visual studio cruft
*.opensdf
*.sdf
*.suo
*.user
*/x64
*/Debug*
*/Release*
*.log
*.tlog*
*.obj
*.VC.db
*.VC.VC.opendb
*.pdb
# misc files mostly used for testing
out.txt
ptr.txt
test.txt
boost_serialize
arr.txt
performance
include_renamed
.ycm_extra_conf.py*
doc/html
rtti.txt
doc/latex
portability64
portability32
file.json
out.xml
cereal_version.out
xml_ordering.out
build
/out/
\ No newline at end of file
language: cpp
dist: trusty
sudo: false
group: beta
addons:
apt:
sources:
- 'ubuntu-toolchain-r-test'
- 'boost-latest'
packages:
- 'g++-multilib'
- 'libboost-serialization-dev'
# - 'libboost-test-dev'
compiler:
- gcc
matrix:
include:
- os: linux
compiler: clang
env: CMAKE_OPTIONS="-DSKIP_PORTABILITY_TEST=ON"
# TODO: Add an entry for valgrind
# after_script: make valgrind
- os: osx
osx_image: xcode8
compiler: clang
script:
- mkdir build && cd build
- cmake ${CMAKE_OPTIONS} .. && make -j4
- ctest . --output-on-failure
branches:
only:
- develop
cmake_minimum_required (VERSION 2.6.2)
project (cereal)
option(SKIP_PORTABILITY_TEST "Skip portability (32 bit) tests" OFF)
if(NOT CMAKE_VERSION VERSION_LESS 3.0) # installing cereal requires INTERFACE lib
option(JUST_INSTALL_CEREAL "Don't do anything besides installing the library" OFF)
endif()
option(THREAD_SAFE "Use mutexes to ensure thread safety" OFF)
if(THREAD_SAFE)
add_definitions(-DCEREAL_THREAD_SAFE=1)
set(CEREAL_THREAD_LIBS "pthread")
else()
set(CEREAL_THREAD_LIBS "")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /W3 /WX")
else()
set(CMAKE_CXX_FLAGS "-Wall -g -Wextra -Wshadow -pedantic -Wold-style-cast ${CMAKE_CXX_FLAGS}")
option(WITH_WERROR "Compile with '-Werror' C++ compiler flag" ON)
if(WITH_WERROR)
set(CMAKE_CXX_FLAGS "-Werror ${CMAKE_CXX_FLAGS}")
endif(WITH_WERROR)
if(CMAKE_VERSION VERSION_LESS 3.1)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
else()
if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD STREQUAL "98")
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
endif()
if(NOT CMAKE_VERSION VERSION_LESS 3.0)
add_library(cereal INTERFACE)
target_include_directories(cereal INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
install(TARGETS cereal EXPORT cereal
DESTINATION lib) # ignored
install(EXPORT cereal FILE cereal-config.cmake
DESTINATION share/cmake/cereal)
install(DIRECTORY include/cereal DESTINATION include)
endif()
if(JUST_INSTALL_CEREAL)
return()
endif()
include_directories(./include)
# Boost serialization for performance sandbox
find_package(Boost COMPONENTS serialization)
if(Boost_FOUND)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)
enable_testing()
add_subdirectory(unittests)
add_subdirectory(sandbox)
add_subdirectory(doc)
Copyright (c) 2014, Randolph Voorhies, Shane Grant
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of cereal nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL RANDOLPH VOORHIES OR SHANE GRANT BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cereal - A C++11 library for serialization
==========================================
<img src="http://uscilab.github.io/cereal/assets/img/cerealboxside.png" align="right"/><p>cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns them into different representations, such as compact binary encodings, XML, or JSON. cereal was designed to be fast, light-weight, and easy to extend - it has no external dependencies and can be easily bundled with other code or used standalone.</p>
### cereal has great documentation
Looking for more information on how cereal works and its documentation? Visit [cereal's web page](http://USCiLab.github.com/cereal) to get the latest information.
### cereal is easy to use
Installation and use of of cereal is fully documented on the [main web page](http://USCiLab.github.com/cereal), but this is a quick and dirty version:
* Download cereal and place the headers somewhere your code can see them
* Write serialization functions for your custom types or use the built in support for the standard library cereal provides
* Use the serialization archives to load and save data
```cpp
#include <cereal/types/unordered_map.hpp>
#include <cereal/types/memory.hpp>
#include <cereal/archives/binary.hpp>
#include <fstream>
struct MyRecord
{
uint8_t x, y;
float z;
template <class Archive>
void serialize( Archive & ar )
{
ar( x, y, z );
}
};
struct SomeData
{
int32_t id;
std::shared_ptr<std::unordered_map<uint32_t, MyRecord>> data;
template <class Archive>
void save( Archive & ar ) const
{
ar( data );
}
template <class Archive>
void load( Archive & ar )
{
static int32_t idGen = 0;
id = idGen++;
ar( data );
}
};
int main()
{
std::ofstream os("out.cereal", std::ios::binary);
cereal::BinaryOutputArchive archive( os );
SomeData myData;
archive( myData );
return 0;
}
```
### cereal has a mailing list
Either get in touch over <a href="mailto:cerealcpp@googlegroups.com">email</a> or [on the web](https://groups.google.com/forum/#!forum/cerealcpp).
## cereal has a permissive license
cereal is licensed under the [BSD license](http://opensource.org/licenses/BSD-3-Clause).
## cereal build status
* develop : [![Build Status](https://travis-ci.org/USCiLab/cereal.png?branch=develop)](https://travis-ci.org/USCiLab/cereal)
[![Build status](https://ci.appveyor.com/api/projects/status/91aou6smj36or0vb/branch/develop?svg=true)](https://ci.appveyor.com/project/AzothAmmo/cereal/branch/develop)
---
Were you looking for the Haskell cereal? Go <a href="https://github.com/GaloisInc/cereal">here</a>.
# can use variables like {build} and {branch}
version: 1.2.{build}
pull_requests:
do_not_increment_build_number: true
branches:
only:
- develop
configuration:
- Debug
- Release
environment:
matrix:
- VS_VERSION_MAJOR: 12
- VS_VERSION_MAJOR: 14
BOOST_ROOT: C:\Libraries\boost_1_59_0
platform:
- Win32
- x64
before_build: "scripts\\appveyor.bat"
build:
parallel: true
project: build/cereal.sln
verbosity: minimal
test_script: "scripts\\appveyor.bat test"
artifacts:
- path: build\Testing
- path: out
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/doxygen.in" "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg" @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/.."
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../scripts/updatedoc.in" "${CMAKE_CURRENT_BINARY_DIR}/updatedoc.sh" @ONLY)
add_custom_target(update-doc
COMMAND "${CMAKE_CURRENT_BINARY_DIR}/updatedoc.sh"
DEPENDS doc
COMMENT "Copying documentation to gh-pages branch" VERBATIM
)
endif(DOXYGEN_FOUND)
\ No newline at end of file
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.3.1-20130402 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="user" visible="true" title="cereal" url="../../index.html"/>
<tab type="mainpage" visible="yes" title="Doxygen Documentation"/>
<tab type="pages" visible="no" title="" intro=""/>
<tab type="modules" visible="yes" title="Code Modules" intro=""/>
<tab type="namespaces" visible="no" title="">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="no" title="">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="yes" title="Source File Documentation">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="no" title="" intro=""/>
<tab type="user" visible="true" title="Github" url="https://github.com/USCiLab/cereal"/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
This diff is collapsed.
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
<!--BEGIN GENERATE_TREEVIEW-->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
$navpath
<li class="footer">$generatedby
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
</ul>
</div>
<!--END GENERATE_TREEVIEW-->
<!--BEGIN !GENERATE_TREEVIEW-->
<hr class="footer"/><address class="footer"><small>
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
</a> $doxygenversion
</small></address>
<!--END !GENERATE_TREEVIEW-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-42360142-1', 'uscilab.github.io');
ga('send', 'pageview');
</script>
</body>
</html>
/**
\mainpage cereal code documentation
\tableofcontents
Aside from the <a href="../../index.html">documentation</a> presented on the main cereal site, this doxygen
page offers code level documentation.
\section modules Browse modules
cereal's code is organized into modules of similar functionality. Take a look at the <a href="modules.html">modules</a>
section to learn more. Average users will not need to understand the workings of any code that falls under the
<i>internal</i> module.
\section files Browse files
If you need reference on a specific file, the <a href="files.html">files</a> page lists all files in cereal.
*/
//! \defgroup Archives Input and Output Archive Types
/*! \defgroup Access Access Control and Disambiguation
Provides ways to give cereal access to protected member functions, disambiguate
which serialization function cereal should use, and provide ways of using smart
pointers with types that have no default constructor. */
/*! \defgroup Utility Utility Functionality
Name-value pairs, binary data wrappers, exceptions, and other utility functions */
/*! \defgroup TypeSupport Support for Serializing Various Types
Serialization of many types is shipped with cereal, including most of the standard library as well as a few others. */
/*! \defgroup STLSupport Standard Library Support
Serialization methods for nearly all types found in the C++ standard library.
\ingroup TypeSupport */
/*! \defgroup TypeConcepts Abstract Type Concept Support
Serialization methods for more abstract type concepts that can generalize over many types.
\ingroup TypeSupport */
/*! \defgroup OtherTypes Miscellaneous Types Support
Support for various other types such as smart pointers to polymorphic base classes, boost::variant, etc.
\ingroup TypeSupport */
/*! \defgroup Internal Internal Functionality