Apache Ignite C++
ignite.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
23 #ifndef _IGNITE
24 #define _IGNITE
25 
26 #include "ignite/cache/cache.h"
27 #include "ignite/impl/ignite_impl.h"
29 
30 namespace ignite
31 {
35  class IGNITE_IMPORT_EXPORT Ignite
36  {
37  friend class impl::IgniteImpl;
38  public:
42  Ignite();
43 
47  Ignite(impl::IgniteImpl* impl);
48 
54  const char* GetName() const;
55 
62  template<typename K, typename V>
63  cache::Cache<K, V> GetCache(const char* name)
64  {
65  IgniteError err;
66 
67  cache::Cache<K, V> res = GetCache<K, V>(name, &err);
68 
70 
71  return res;
72  }
73 
81  template<typename K, typename V>
82  cache::Cache<K, V> GetCache(const char* name, IgniteError* err)
83  {
84  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache<K, V>(name, err);
85 
86  return cache::Cache<K, V>(cacheImpl);
87  }
88 
95  template<typename K, typename V>
97  {
98  IgniteError err;
99 
100  cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, &err);
101 
103 
104  return res;
105  }
106 
114  template<typename K, typename V>
116  {
117  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache<K, V>(name, err);
118 
119  return cache::Cache<K, V>(cacheImpl);
120  }
121 
128  template<typename K, typename V>
129  cache::Cache<K, V> CreateCache(const char* name)
130  {
131  IgniteError err;
132 
133  cache::Cache<K, V> res = CreateCache<K, V>(name, &err);
134 
136 
137  return res;
138  }
139 
147  template<typename K, typename V>
149  {
150  impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache<K, V>(name, err);
151 
152  return cache::Cache<K, V>(cacheImpl);
153  }
154 
160  bool IsValid()
161  {
162  return impl.IsValid();
163  }
164 
165  private:
167  ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl;
168  };
169 }
170 
171 #endif
cache::Cache< K, V > GetCache(const char *name)
Get cache.
Definition: ignite.h:63
Main entry point for all Data Grid APIs.
Definition: cache.h:51
cache::Cache< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite.h:96
Declares ignite::IgniteConfiguration class.
cache::Cache< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite.h:129
cache::Cache< K, V > CreateCache(const char *name, IgniteError *err)
Create cache.
Definition: ignite.h:148
Declares ignite::cache::Cache class.
static void ThrowIfNeeded(IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
bool IsValid()
Check if the instance is valid.
Definition: ignite.h:160
Ignite error information.
Definition: ignite_error.h:78
Apache Ignite API.
Definition: binary_consts.h:28
cache::Cache< K, V > GetOrCreateCache(const char *name, IgniteError *err)
Get or create cache.
Definition: ignite.h:115
Main interface to operate with Ignite.
Definition: ignite.h:35
cache::Cache< K, V > GetCache(const char *name, IgniteError *err)
Get cache.
Definition: ignite.h:82