blob: 737574781005925245c195df9de79a443504dbff [file] [log] [blame]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- Always force latest IE rendering engine or request Chrome Frame -->
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300italic,400italic,400,600' rel='stylesheet' type='text/css'>
<!-- Use title if it's in the page YAML frontmatter -->
<title>
Using PDX Serialization |
Geode Native C++ Docs
</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/stylesheets/all.css" rel="stylesheet" media="screen, print" />
<link href="/stylesheets/print.css" rel="stylesheet" media="print" />
<link href='/images/favicon.ico' rel='shortcut icon'>
<script src="/javascripts/all.js"></script>
</head>
<body class="docs docs_geode-native docs_geode-native_cpp docs_geode-native_cpp_113 docs_geode-native_cpp_113_serialization docs_geode-native_cpp_113_serialization_cpp-serialization docs_geode-native_cpp_113_serialization_cpp-serialization_using-pdxserialization has-subnav">
<div class="viewport">
<div class='wrap'>
<script type="text/javascript">
document.domain = "apache.org";
</script>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<header class="header header-layout">
<h1 class="logo">
<a href="/">
<img src="/images/Apache_Geode_logo_symbol_white.png" style="width:30px;">
Apache Geode Native C++ Documentation
</a>
</h1>
<div class="header-links js-bar-links">
<div class="btn-menu" data-behavior="MenuMobile"></div>
<div class="header-item"><a href="http://geode.apache.org">Back to Product Page</a></div>
<div class="header-item">
<a href="http://geode.apache.org/community" target="_blank">Community</a>
</div>
</div>
</header>
<div class="container">
<!--googleoff: index-->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div id="sub-nav" class="js-sidenav nav-container" role="navigation">
<a class="sidenav-title" data-behavior="SubMenuMobile">Doc Index</a>
<div class="nav-content">
<ul>
<li>
<a href="/docs/geode-native/cpp/113/about-client-users-guide.html">Apache Geode Native Documentation</a>
</li>
<li class="has_submenu">
<a href="/docs/geode-native/cpp/113/getting-started/getting-started-nc-client.html">Getting Started with the Native Library</a>
<ul>
<li>
<a href="/docs/geode-native/cpp/113/getting-started/getting-started-nc-client.html#set_up_dev_environment">Set Up Your Development Environment</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/getting-started/getting-started-nc-client.html#establish_cluster_access">Establish Access to a Geode Cluster</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/getting-started/getting-started-nc-client.html#app_dev_walkthroughs">Application Development Walkthroughs</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/getting-started/getting-started-nc-client.html#programming_examples">Programming Examples</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/getting-started/put-get-example.html">Put/Get/Remove Examples</a>
</li>
</ul>
</li>
<li class="has_submenu">
<a href="/docs/geode-native/cpp/113/configuring/configuration.html">Configuring a Client Application</a>
<ul>
<li>
<a href="/docs/geode-native/cpp/113/configuring/system-level-configuration.html">System Level Configuration</a>
</li>
</ul>
</li>
<li>
<a href="/docs/geode-native/cpp/113/configuring/config-client-cache.html">Configuring the Client Cache</a>
</li>
<li class="has_submenu">
<a href="/docs/geode-native/cpp/113/regions/regions.html">Configuring Regions</a>
<ul>
<li>
<a href="/docs/geode-native/cpp/113/regions/registering-interest-for-entries.html">Registering Interest for Entries</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/regions/region-attributes.html">Region Attributes</a>
</li>
</ul>
</li>
<li>
<a href="/docs/geode-native/cpp/113/serialization/data-serialization.html">Serializing Data</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/remote-queries.html">Remote Queries</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/continuous-queries.html">Continuous Queries</a>
</li>
<li class="has_submenu">
<a href="/docs/geode-native/cpp/113/security/security.html">Security: Authentication and Encryption</a>
<ul>
<li>
<a href="/docs/geode-native/cpp/113/security/authentication.html">Authentication</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/security/sslclientserver.html">TLS/SSL Client-Server Communication Encryption</a>
</li>
</ul>
</li>
<li>
<a href="/docs/geode-native/cpp/113/function-execution.html">Function Execution</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/transactions.html">Transactions</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/configuring/sysprops.html">System Properties</a>
</li>
<li>
<a href="/docs/geode-native/cpp/113/client-cache-ref.html">Client Cache XML Reference</a>
</li>
</ul>
</div>
</div>
<!--googleon: index-->
<main class="content content-layout" id="js-content" role="main">
<a id="top"></a>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<span style="font-weight:200;font-size:31px;" style="float:left;">
<img src="/images/Apache_Geode_logo_symbol.png" style="height:26px;">
Apache Geode Native C++
</span>
<span class="local-header version-info" style="float:right;">
<a href="https://cwiki.apache.org/confluence/display/GEODE/Release+Notes">CHANGELOG</a>
</span>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<h1 class="title-container" >
Using PDX Serialization
</h1>
<div id="js-quick-links" >
</div>
<div class="to-top" id="js-to-top">
<a href="#top" title="back to top"></a>
</div>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<p>Geode Portable Data eXchange (PDX) serialization provides portability for PDX serializable objects so that clients can share data with
Java servers and other non-C++ clients. PDX stores data in named fields that you can access
individually in order to avoid the cost of deserializing the entire data object. PDX also allows you
to mix versions of objects where you have added or removed fields.</p>
<p>When using PDX serialization, you can use either <code>PdxSerializable</code> (for a specific domain object) or <code>PdxSerializer</code> (for all your domain objects).</p>
<p><strong>Use <code>PdxSerializable</code></strong> when the object is one whose definition you control. You can embed the serialization/deserialization capability within
the object, so its conversion from one format to the other is self-contained. You do this by defining an object that inherits from the <code>PdxSerializable</code>
interface, and you register the domain class using the <code>registerPdxType(domainClass)</code> API.</p>
<p><strong>Use <code>PdxSerializer</code></strong> when you cannot or do not wish to modify the object definition, for example, when the object is provided by a third-party.
You define the serialization/deserialization capability in a separate place, then register the domain class for serialization in the cache using
the <code>registerPdxSerializer</code> API.</p>
<p>You can also set the object preference of the cache to the <code>PdxInstance</code> type, which allows you to access fields of a PDX object without deserializing the entire object.</p>
<ul>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/pdxserializable-interface.html">Serialize Using the PdxSerializable Class</a></strong></p>
<p>Domain classes need to inherit the <code>PdxSerializable</code> abstract class to serialize and de-serialize the object. When you write objects using PDX serialization, they are distributed to the server tier in PDX serialized form.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/performing-ops-with-pdx-object.html">Performing put, get, and localDestroy Operations with a PDX Domain Object</a></strong>
This topic demonstrates how you can perform operations on a PDX domain object after you have implemented PDX serializable in your domain class.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/using-pdxserializer.html">Serialize Your Domain Objects with PdxSerializer and PdxWrapper</a></strong></p>
<p>For domain objects that you cannot or do not want to modify, use the <code>PdxSerializer</code> and the <code>PdxWrapper</code> classes to serialize and deserialize the object&rsquo;s fields.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/using-pdxinstance.html">Programming Your Application to Use PdxInstances</a></strong></p>
<p>A <code>PdxInstance</code> is a lightweight wrapper around the raw bytes of the PDX serialized objects kept in the cache. It provides applications with run-time access to files of a PDX serialized object. Geode provides the implementation of the <code>PdxInstance</code> class.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/pdx-ignore-unread-fields.html">Configuring PDX to Ignore Unread Fields During Deserialization</a></strong></p>
<p>Use the <code>setPdxIgnoreUnreadFields</code> API to control whether PDX ignores fields that were unread during deserialization.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/using-pdxinstancefactory.html">Using PdxInstanceFactory to Create PdxInstances</a></strong></p>
<p>You can use the <code>PdxInstanceFactory</code> API to create a <code>PdxInstance</code> from raw data when the domain class is not available on the server.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/using-enum-type-with-pdx.html">Using C++ Enum Type with PDX Serialization</a></strong></p>
<p>Because there is no &ldquo;object&rdquo; base type in C++, enums cannot be directly passed as parameters to the <code>writeObject</code> and <code>readObject</code> API.</p></li>
<li><p><strong><a href="/docs/geode-native/cpp/113/serialization/cpp-serialization/pdx-with-delta-propagation.html">Using PDX Serialization with Delta Propagation</a></strong></p>
<p>To use delta propagation with PDX serialization, you must implement the <code>Delta</code> interface methods.</p></li>
</ul>
</main>
</div>
</div>
</div>
<div id="scrim"></div>
<div class="container">
<footer class="site-footer-links">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="copyright">
<a href='/'>Apache Geode Documentation</a>
&copy; 2020 <a href='http://www.apache.org/'>The Apache Software Foundation</a>.
</div>
<div class="support">
Need help? <a href="http://geode.apache.org/community" target="_blank">Visit the Community</a>
</div>
</footer>
</div><!--end of container-->
</body>
</html>