blob: 86f8616cef58756b0d5a73dac4dc8e5965b50970 [file] [log] [blame]
<!--
▄▄▄ ██▓███ ▄▄▄ ▄████▄ ██░ ██ ▓█████ ██▓ ▄████ ███▄ █ ██▓▄▄▄█████▓▓█████
▒████▄ ▓██░ ██▒▒████▄ ▒██▀ ▀█ ▓██░ ██▒▓█ ▀ ▓██▒ ██▒ ▀█▒ ██ ▀█ █ ▓██▒▓ ██▒ ▓▒▓█ ▀
▒██ ▀█▄ ▓██░ ██▓▒▒██ ▀█▄ ▒▓█ ▄ ▒██▀▀██░▒███ ▒██▒▒██░▄▄▄░▓██ ▀█ ██▒▒██▒▒ ▓██░ ▒░▒███
░██▄▄▄▄██ ▒██▄█▓▒ ▒░██▄▄▄▄██ ▒▓▓▄ ▄██▒░▓█ ░██ ▒▓█ ▄ ░██░░▓█ ██▓▓██▒ ▐▌██▒░██░░ ▓██▓ ░ ▒▓█ ▄
▓█ ▓██▒▒██▒ ░ ░ ▓█ ▓██▒▒ ▓███▀ ░░▓█▒░██▓░▒████▒ ░██░░▒▓███▀▒▒██░ ▓██░░██░ ▒██▒ ░ ░▒████▒
▒▒ ▓▒█░▒▓▒░ ░ ░ ▒▒ ▓▒█░░ ░▒ ▒ ░ ▒ ░░▒░▒░░ ▒░ ░ ░▓ ░▒ ▒ ░ ▒░ ▒ ▒ ░▓ ▒ ░░ ░░ ▒░ ░
▒ ▒▒ ░░▒ ░ ▒ ▒▒ ░ ░ ▒ ▒ ░▒░ ░ ░ ░ ░ ▒ ░ ░ ░ ░ ░░ ░ ▒░ ▒ ░ ░ ░ ░ ░
░ ▒ ░░ ░ ▒ ░ ░ ░░ ░ ░ ▒ ░░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
-->
<!--
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
"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.
-->
<!DOCTYPE html>
<html>
<head>
<link rel="canonical" href="https://ignite.apache.org/features/cpp.html" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>C++ Support - Apache Ignite</title>
<link media="all" rel="stylesheet" href="/css/all.css?v=1514336027">
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
<!--#include virtual="/includes/sh.html" -->
</head>
<body>
<div id="wrapper">
<!--#include virtual="/includes/header.html" -->
<main id="main" role="main" class="container">
<section id="cpp" class="page-section">
<h1 class="first">Apache Ignite for C++</h1>
<div class="col-sm-12 col-md-12 col-xs-12" style="padding:0 0 20px 0;">
<div class="col-sm-6 col-md-8 col-xs-12" style="padding-left:0; padding-right:0">
<p>
Ignites's In-Memory Data Fabric for C++ is designed to deliver uncompromised
performance for a wide set of in-memory computing use cases through native, optimized C++ APIs.
</p>
<p>
Ignite C++ is built on top of Ignite. This allows you to perform almost all the in-memory data grid operations including
<a href="https://apacheignite-cpp.readme.io/docs/cache-operations" target="_blank">Basic Cache Operations</a>,
<span style="white-space: nowrap"><a href="https://apacheignite-cpp.readme.io/docs/transactions" target="_blank">ACID Transactions</a></span>,
<a href="https://apacheignite-sql.readme.io/docs/cplus-sql-api" target="_blank">SQL Queries</a>, and
<a href="https://apacheignite-sql.readme.io/docs/cplus-sql-api#section-sqlquery" target="_blank">Distributed SQL Joins</a>,
on replicated or partitioned caches distributed across the cluster.
</p>
<p>
Ignite also supports <span style="white-space: nowrap"><a href="https://apacheignite-cpp.readme.io/docs/cross-platform-interoperability" target="_blank">Cross-Platform Interoperability</a></span>
allowing applications to seamlessly interoperate between <b>Java</b>, <b>.NET</b>, and <b>C++</b> by writing and reading objects to and from the cache, respectively, in a common binary format.
Additionally, both Ignite .NET and Ignite C++ provide native APIs and their implementations that delegate most of the calls to Java using JNI.
Here, it is worth mentioning that the JNI overhead is minimal and does not cause any performance degradation, especially in distributed environments where network is the main obstacle.
Furthermore, Ignite provides a pure C++ implementation of the Binary Marshaller to contribute to the perfomance.
</p>
</div>
<div class="col-sm-6 col-md-4 col-xs-12" style="padding-right:0">
<img class="img-responsive" src="/images/cpp.png" width="200" style="float:right;"/>
</div>
</div>
<div class="code-examples">
<div class="page-heading">Code Examples:</div>
<!-- Nav tabs -->
<ul id="messaging-examples" class="nav nav-tabs">
<li class="active"><a href="#put-get" aria-controls="home" data-toggle="tab">Put and Get</a></li>
<li><a href="#transactions" aria-controls="profile" data-toggle="tab">Transactions</a></li>
<li><a href="#sql-query" aria-controls="profile" data-toggle="tab">SQL Query</a></li>
<li><a href="#sql-join" aria-controls="profile" data-toggle="tab">SQL Join</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="put-get">
<pre class="brush:cpp">
// Get cache instance.
Cache&lt;int, std::string&gt; cache = grid.GetCache&lt;int, std::string&gt;("myCache");
// Store keys in cache (values will end up on different cache nodes).
for (int i = 0; i &lt; 10; ++i)
{
std::stringstream value;
value &lt;&lt; i;
cache.Put(i, value.str());
}
for (int i = 0; i &lt; 10; ++i)
std::cout &lt;&lt; "Got [key=" &lt;&lt; i &lt;&lt; ", val=" &lt;&lt; cache.Get(i) &lt;&lt; "]";
</pre>
</div>
<div class="tab-pane" id="transactions">
<pre class="brush:cpp">
Transaction tx = transactions.TxStart();
int hello = cache.Get("Hello");
if (hello == 1)
cache.Put("Hello", 11);
cache.Put("World", 22);
tx.Commit();
</pre>
</div>
<div class="tab-pane" id="sql-query">
<pre class="brush:cpp">
Cache&lt;int, Person&gt; cache = grid.GetOrCreateCache&lt;int, Person&gt;("personCache");
SqlQuery qry("Person", "Salary &lt; 1000");
QueryCursor&lt;int, Person&gt; cursor = cache.Query(qry);
// Iterate over results.
while (cursor.HasNext())
std::cout &lt;&lt; cursor.GetNext().GetKey() &lt;&lt; std::endl;
</pre>
</div>
<div class="tab-pane" id="sql-join">
<pre class="brush:cpp">
Cache&lt;int, Person&gt; cache = grid.GetOrCreateCache&lt;int, Person&gt;("personCache");
// SQL join on Person and Organization
// to find all persons working for Ignite organization.
SqlQuery qry("Person", "from Person as p, \"orgCache\".Organization as org"
"where p.OrgId = org.Id "
"and org.name = Ignite");
QueryCursor&lt;int, Person&gt; cursor = cache.Query(qry);
// Iterate over results.
while (cursor.HasNext())
std::cout &lt;&lt; cursor.GetNext().GetKey() &lt;&lt; std::endl;
</pre>
</div>
</div>
</div>
<div class="page-heading">GitHub Examples:</div>
<p>
Also see <a href="https://github.com/apache/ignite/tree/master/modules/platforms/cpp/examples" target="github">Ignite C++ examples</a>
available on GitHub.
</p>
<p>
<a href="https://apacheignite-cpp.readme.io/" target="_blank">
<b>Get started with Ignite C++ <i class="fa fa-angle-double-right"></i></b>
</a>
</p>
</section>
</main>
<!--#include virtual="/includes/footer.html" -->
</div>
<!--#include virtual="/includes/scripts.html" -->
</body>
</html>