205 lines
12 KiB
HTML
205 lines
12 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.3.1"/>
|
|
<title>cereal: cereal::specialize< Archive, T, S > Struct Template Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">cereal
|
|
</div>
|
|
<div id="projectbrief">A C++11 library for serialization</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.3.1 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Groups</a></div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div id="nav-path" class="navpath">
|
|
<ul>
|
|
<li class="navelem"><b>cereal</b></li><li class="navelem"><a class="el" href="structcereal_1_1specialize.html">specialize</a></li> </ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#related">Related Functions</a> |
|
|
<a href="structcereal_1_1specialize-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">cereal::specialize< Archive, T, S > Struct Template Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>A class used to disambiguate cases where cereal cannot detect a unique way of serializing a class.
|
|
<a href="structcereal_1_1specialize.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="access_8hpp_source.html">cereal/access.hpp</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for cereal::specialize< Archive, T, S >:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="structcereal_1_1specialize.png" usemap="#cereal::specialize< Archive, T, S >_map" alt=""/>
|
|
<map id="cereal::specialize< Archive, T, S >_map" name="cereal::specialize< Archive, T, S >_map">
|
|
</map>
|
|
</div></div>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
|
|
Related Functions</h2></td></tr>
|
|
<tr><td class="ititle" colspan="2"><p>(Note that these are not member functions.) </p>
|
|
</td></tr>
|
|
<tr class="memitem:ac28bb730353e53b3066cc679e63bb108"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="structcereal_1_1specialize.html#ac28bb730353e53b3066cc679e63bb108">specialization</a> { <b>member_serialize</b>,
|
|
<b>member_load_save</b>,
|
|
<b>non_member_serialize</b>,
|
|
<b>non_member_load_save</b>
|
|
}</td></tr>
|
|
<tr class="separator:ac28bb730353e53b3066cc679e63bb108"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><h3>template<class Archive, class T, specialization S><br/>
|
|
struct cereal::specialize< Archive, T, S ></h3>
|
|
|
|
<p>A class used to disambiguate cases where cereal cannot detect a unique way of serializing a class. </p>
|
|
<p>cereal attempts to figure out which method of serialization (member vs. non-member serialize or load/save pair) at compile time. If for some reason cereal cannot find a non-ambiguous way of serializing a type, it will produce a static assertion complaining about this.</p>
|
|
<p>This can happen because you have both a serialize and load/save pair, or even because a base class has a serialize (public or private with friend access) and a derived class does not overwrite this due to choosing some other serialization type.</p>
|
|
<p>Specializing this class will tell cereal to explicitly use the serialization type you specify and it will not complain about ambiguity in its compile time selection. However, if cereal detects an ambiguity in specializations, it will continue to issue a static assertion.</p>
|
|
<div class="fragment"><div class="line"><span class="keyword">class </span>MyParent</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classcereal_1_1access.html" title="A class that can be made a friend to give cereal access to non public functions.">cereal::access</a>;</div>
|
|
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> Archive></div>
|
|
<div class="line"> <span class="keywordtype">void</span> serialize( Archive & ar ) {}</div>
|
|
<div class="line">};</div>
|
|
<div class="line"></div>
|
|
<div class="line"><span class="comment">// Although serialize is private in MyParent, to cereal::access it will look public,</span></div>
|
|
<div class="line"><span class="comment">// even through MyDerived</span></div>
|
|
<div class="line"><span class="keyword">class </span>MyDerived : <span class="keyword">public</span> MyParent</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> <span class="keyword">public</span>:</div>
|
|
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> Archive></div>
|
|
<div class="line"> <span class="keywordtype">void</span> load( Archive & ar ) {}</div>
|
|
<div class="line"></div>
|
|
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> Archive></div>
|
|
<div class="line"> <span class="keywordtype">void</span> save( Archive & ar ) {}</div>
|
|
<div class="line">};</div>
|
|
<div class="line"></div>
|
|
<div class="line"><span class="comment">// The save/load pair in MyDerived is ambiguous because serialize in MyParent can</span></div>
|
|
<div class="line"><span class="comment">// be accessed from cereal::access. This looks the same as making serialize public</span></div>
|
|
<div class="line"><span class="comment">// in MyParent, making it seem as though MyDerived has both a serialize and a load/save pair.</span></div>
|
|
<div class="line"><span class="comment">// cereal will complain about this at compile time unless we disambiguate:</span></div>
|
|
<div class="line"></div>
|
|
<div class="line"><span class="keyword">namespace </span>cereal</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> <span class="comment">// This struct specialization will tell cereal which is the right way to serialize the ambiguity</span></div>
|
|
<div class="line"> <span class="keyword">template</span> <<span class="keyword">class</span> Archive> <span class="keyword">struct </span>specialize<Archive, MyDerived, cereal::specialization::member_load_save> {};</div>
|
|
<div class="line"></div>
|
|
<div class="line"> <span class="comment">// If we only had a disambiguation for a specific archive type, it would look something like this</span></div>
|
|
<div class="line"> <span class="keyword">template</span> <> <span class="keyword">struct </span>specialize<cereal::BinaryOutputArchive, MyDerived, cereal::specialization::member_load_save> {};</div>
|
|
<div class="line">}</div>
|
|
</div><!-- fragment --><dl class="tparams"><dt>Template Parameters</dt><dd>
|
|
<table class="tparams">
|
|
<tr><td class="paramname">T</td><td>The type to specialize the serialization for </td></tr>
|
|
<tr><td class="paramname">S</td><td>The specialization type to use for T </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
</div><h2 class="groupheader">Friends And Related Function Documentation</h2>
|
|
<a class="anchor" id="ac28bb730353e53b3066cc679e63bb108"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<class Archive , class T , specialization S> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">enum <a class="el" href="structcereal_1_1specialize.html#ac28bb730353e53b3066cc679e63bb108">specialization</a></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">related</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
<p>A specifier used in conjunction with <a class="el" href="structcereal_1_1specialize.html" title="A class used to disambiguate cases where cereal cannot detect a unique way of serializing a class...">cereal::specialize</a> to disambiguate serialization in special cases </p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this struct was generated from the following file:<ul>
|
|
<li>include/cereal/<a class="el" href="access_8hpp_source.html">access.hpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Fri Jul 5 2013 20:54:19 for cereal by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.3.1
|
|
</small></address>
|
|
</body>
|
|
</html>
|