http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignite.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite.h b/modules/platform/src/main/cpp/core/include/ignite/ignite.h deleted file mode 100644 index 6c1263e..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/ignite.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE -#define _IGNITE - -#include "ignite/cache/cache.h" -#include "ignite/impl/ignite_impl.h" -#include "ignite/ignite_configuration.h" - -namespace ignite -{ - /** - * Main interface to operate with Ignite. - */ - class IGNITE_IMPORT_EXPORT Ignite - { - public: - /** - * Default constructor. - */ - Ignite(); - - /** - * Constructor. - */ - Ignite(impl::IgniteImpl* impl); - - /** - * Get Ignite instance name. - * - * @return Name. - */ - char* GetName(); - - /** - * Get cache. - * - * @param name Cache name. - * @return Cache. - */ - template<typename K, typename V> - cache::Cache<K, V> GetCache(const char* name) - { - IgniteError err; - - cache::Cache<K, V> res = GetCache<K, V>(name, &err); - - IgniteError::ThrowIfNeeded(err); - - return res; - } - - /** - * Get cache. - * - * @param name Cache name. - * @param err Error; - * @return Cache. - */ - template<typename K, typename V> - cache::Cache<K, V> GetCache(const char* name, IgniteError* err) - { - impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache<K, V>(name, err); - - return cache::Cache<K, V>(cacheImpl); - } - - /** - * Get or create cache. - * - * @param name Cache name. - * @return Cache. - */ - template<typename K, typename V> - cache::Cache<K, V> GetOrCreateCache(const char* name) - { - IgniteError err; - - cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, &err); - - IgniteError::ThrowIfNeeded(err); - - return res; - } - - /** - * Get or create cache. - * - * @param name Cache name. - * @param err Error; - * @return Cache. - */ - template<typename K, typename V> - cache::Cache<K, V> GetOrCreateCache(const char* name, IgniteError* err) - { - impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache<K, V>(name, err); - - return cache::Cache<K, V>(cacheImpl); - } - - /** - * Create cache. - * - * @param name Cache name. - * @return Cache. - */ - template<typename K, typename V> - cache::Cache<K, V> CreateCache(const char* name) - { - IgniteError err; - - cache::Cache<K, V> res = CreateCache<K, V>(name, &err); - - IgniteError::ThrowIfNeeded(err); - - return res; - } - - /** - * Create cache. - * - * @param name Cache name. - * @param err Error; - * @return Cache. - */ - template<typename K, typename V> - cache::Cache<K, V> CreateCache(const char* name, IgniteError* err) - { - impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache<K, V>(name, err); - - return cache::Cache<K, V>(cacheImpl); - } - private: - /** Implementation delegate. */ - ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl; - }; -} - -#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h b/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h deleted file mode 100644 index ce2d730..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_CONFIGURATION -#define _IGNITE_CONFIGURATION - -#include <stdint.h> - -namespace ignite -{ - /** - * Single JVM option. - */ - struct IgniteJvmOption - { - /** Option. */ - char* opt; - - /** - * Default constructor. - */ - IgniteJvmOption() : opt(NULL) - { - // No-op. - } - - /** - * Constructor. - * - * @param opt Option. - */ - IgniteJvmOption(char* opt) : opt(opt) - { - // No-op. - } - }; - - /** - * Ignite configuration. - */ - struct IgniteConfiguration - { - /** Path to Ignite home. */ - char* igniteHome; - - /** Path to Spring configuration file. */ - char* springCfgPath; - - /** Path ot JVM libbrary. */ - char* jvmLibPath; - - /** JVM classpath. */ - char* jvmClassPath; - - /** Initial amount of JVM memory. */ - int32_t jvmInitMem; - - /** Maximum amount of JVM memory. */ - int32_t jvmMaxMem; - - /** Additional JVM options. */ - IgniteJvmOption* jvmOpts; - - /** Additional JVM options count. */ - int32_t jvmOptsLen; - - /** - * Constructor. - */ - IgniteConfiguration() : igniteHome(NULL), springCfgPath(NULL), jvmLibPath(NULL), jvmClassPath(NULL), - jvmInitMem(512), jvmMaxMem(1024), jvmOpts(NULL), jvmOptsLen(0) - { - // No-op. - } - }; -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h b/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h deleted file mode 100644 index 4438a0e..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h +++ /dev/null @@ -1,260 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_ERROR -#define _IGNITE_ERROR - -#include <sstream> -#include <stdint.h> - -#include <ignite/common/common.h> - -#define IGNITE_ERROR_1(code, part1) { \ - std::stringstream stream; \ - stream << (part1); \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -#define IGNITE_ERROR_2(code, part1, part2) { \ - std::stringstream stream; \ - stream << (part1) << (part2); \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -#define IGNITE_ERROR_3(code, part1, part2, part3) { \ - std::stringstream stream; \ - stream << (part1) << (part2) << (part3); \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -#define IGNITE_ERROR_FORMATTED_1(code, msg, key1, val1) { \ - std::stringstream stream; \ - stream << msg << " [" << key1 << "=" << (val1) << "]"; \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -#define IGNITE_ERROR_FORMATTED_2(code, msg, key1, val1, key2, val2) { \ - std::stringstream stream; \ - stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << "]"; \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -#define IGNITE_ERROR_FORMATTED_3(code, msg, key1, val1, key2, val2, key3, val3) { \ - std::stringstream stream; \ - stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << ", " << key3 << "=" << (val3) << "]"; \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -#define IGNITE_ERROR_FORMATTED_4(code, msg, key1, val1, key2, val2, key3, val3, key4, val4) { \ - std::stringstream stream; \ - stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << ", " << key3 << "=" << (val3) << ", " << key4 << "=" << (val4) << "]"; \ - throw ignite::IgniteError(code, stream.str().c_str()); \ -} - -namespace ignite -{ - /** - * Ignite error information. - */ - class IGNITE_IMPORT_EXPORT IgniteError - { - public: - /** Success. */ - static const int IGNITE_SUCCESS = 0; - - /** Failed to initialize JVM. */ - static const int IGNITE_ERR_JVM_INIT = 1; - - /** Failed to attach to JVM. */ - static const int IGNITE_ERR_JVM_ATTACH = 2; - - /** JVM library is not found. */ - static const int IGNITE_ERR_JVM_LIB_NOT_FOUND = 3; - - /** Failed to load JVM library. */ - static const int IGNITE_ERR_JVM_LIB_LOAD_FAILED = 4; - - /** JVM classpath is not provided. */ - static const int IGNITE_ERR_JVM_NO_CLASSPATH = 5; - - /** JVM error: no class definition found. */ - static const int IGNITE_ERR_JVM_NO_CLASS_DEF_FOUND = 6; - - /** JVM error: no such method. */ - static const int IGNITE_ERR_JVM_NO_SUCH_METHOD = 7; - - /** Memory operation error. */ - static const int IGNITE_ERR_MEMORY = 1001; - - /** Portable error. */ - static const int IGNITE_ERR_PORTABLE = 1002; - - /** Generic Ignite error. */ - static const int IGNITE_ERR_GENERIC = 2000; - - /** Illegal argument passed. */ - static const int IGNITE_ERR_ILLEGAL_ARGUMENT = 2001; - - /** Illegal state. */ - static const int IGNITE_ERR_ILLEGAL_STATE = 2002; - - /** Unsupported operation. */ - static const int IGNITE_ERR_UNSUPPORTED_OPERATION = 2003; - - /** Thread has been interrup. */ - static const int IGNITE_ERR_INTERRUPTED = 2004; - - /** Cluster group is empty. */ - static const int IGNITE_ERR_CLUSTER_GROUP_EMPTY = 2005; - - /** Cluster topology problem. */ - static const int IGNITE_ERR_CLUSTER_TOPOLOGY = 2006; - - /** Compute execution rejected. */ - static const int IGNITE_ERR_COMPUTE_EXECUTION_REJECTED = 2007; - - /** Compute job failover. */ - static const int IGNITE_ERR_COMPUTE_JOB_FAILOVER = 2008; - - /** Compute task cancelled. */ - static const int IGNITE_ERR_COMPUTE_TASK_CANCELLED = 2009; - - /** Compute task timeout. */ - static const int IGNITE_ERR_COMPUTE_TASK_TIMEOUT = 2010; - - /** Compute user undeclared exception. */ - static const int IGNITE_ERR_COMPUTE_USER_UNDECLARED_EXCEPTION = 2011; - - /** Generic cache error. */ - static const int IGNITE_ERR_CACHE = 2012; - - /** Generic cache loader error. */ - static const int IGNITE_ERR_CACHE_LOADER = 2013; - - /** Generic cache writer error. */ - static const int IGNITE_ERR_CACHE_WRITER = 2014; - - /** Generic cache entry processor error. */ - static const int IGNITE_ERR_ENTRY_PROCESSOR = 2015; - - /** Cache atomic update timeout. */ - static const int IGNITE_ERR_CACHE_ATOMIC_UPDATE_TIMEOUT = 2016; - - /** Cache partial update. */ - static const int IGNITE_ERR_CACHE_PARTIAL_UPDATE = 2017; - - /** Transaction optimisitc exception. */ - static const int IGNITE_ERR_TX_OPTIMISTIC = 2018; - - /** Transaction timeout. */ - static const int IGNITE_ERR_TX_TIMEOUT = 2019; - - /** Transaction rollback. */ - static const int IGNITE_ERR_TX_ROLLBACK = 2020; - - /** Transaction heuristic exception. */ - static const int IGNITE_ERR_TX_HEURISTIC = 2021; - - /** Authentication error. */ - static const int IGNITE_ERR_AUTHENTICATION = 2022; - - /** Security error. */ - static const int IGNITE_ERR_SECURITY = 2023; - - /** Unknown error. */ - static const int IGNITE_ERR_UNKNOWN = -1; - - /** - * Throw an error if code is not IGNITE_SUCCESS. - * - * @param err Error. - */ - static void ThrowIfNeeded(IgniteError& err); - - /** - * Create empty error. - */ - IgniteError(); - - /** - * Create error with specific code. - * - * @param code Error code. - */ - IgniteError(const int32_t code); - - /** - * Create error with specific code and message. - * - * @param code Error code. - * @param msg Message. - */ - IgniteError(const int32_t code, const char* msg); - - /** - * Copy constructor. - * - * @param other Other instance. - */ - IgniteError(const IgniteError& other); - - /** - * Assignment operator. - * - * @param other Other instance. - * @return Assignment result. - */ - IgniteError& operator=(const IgniteError& other); - - /** - * Destructor. - */ - ~IgniteError(); - - /** - * Get error code. - * - * @return Error code. - */ - int32_t GetCode(); - - /** - * Get error message. - * - * @return Error message. - */ - const char* GetText(); - - /** - * Set error. - * - * @param jniCode Error code. - * @param jniCls Error class. - * @param jniMsg Error message. - * @param err Error. - */ - static void SetError(const int jniCode, const char* jniCls, const char* jniMsg, IgniteError* err); - private: - /** Error code. */ - int32_t code; - - /** Error message. */ - char* msg; - }; -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignition.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignition.h b/modules/platform/src/main/cpp/core/include/ignite/ignition.h deleted file mode 100644 index 8d32448..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/ignition.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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. - */ - -/** - * \mainpage Apache Ignite C++ Library - * - * The Apache Ignite is a proven software solution, which delivers unprecedented speed - * and unlimited scale to accelerate your business and time to insights. It enables high-performance transactions, - * real-time streaming and fast analytics in a single, comprehensive data access and processing layer. The In-Memory - * Data Fabric is designed to easily power both existing and new applications in a distributed, massively - * parallel architecture on affordable, industry-standard hardware. - * <p> - * The Apache Ignite provides a unified API that spans all key types of applications - * (Java, .NET, C++) and connects them with multiple data stores containing structured, semi-structured and - * unstructured data (SQL, NoSQL, Hadoop). It offers a secure, highly available and manageable data environment - * that allows companies to process full ACID transactions and generate valuable insights from real-time, - * interactive and batch queries. - * <p> - * The In-Memory Data Fabric offers a strategic approach to in-memory computing that delivers performance, - * scale and comprehensive capabilities far above and beyond what traditional in-memory databases, - * data grids or other in-memory-based point solutions can offer by themselves. - * - * \section ultimate_speed_and_scale Ultimate Speed and Scale - * - * The Apache Ignite accesses and processes data from distributed enterprise and - * cloud-based data stores orders of magnitudes faster, and shares them with today's most demanding transactional, - * analytical and hybrid applications. The In-Memory Data Fabric delivers unprecedented throughput - * and low latency performance in a virtually unlimited, global scale-out architecture for both new and - * existing applications. - * - * \section comprehensive_and_proven Comprehensive and Proven - * - * The Apache Ignite is the product of seven years of meticulous research and development, - * built from the ground up (i.e. no bolt-on's), and run successfully by hundreds of organizations worldwide. - * It is a comprehensive in-memory solution that includes a clustering and compute grid, a database-agnostic data grid, - * a real-time streaming engine as well as plug-and-play Hadoop acceleration. The In-Memory Data Fabric - * connects multiple data sources (relational, NoSQL, Hadoop) with Java, .NET and C++ applications, and offers - * a secure and highly available architecture; it also provides a fully-featured, graphical management interface. - * <p> - * The Apache Ignite is used today by Fortune 500 companies, top government agencies as well as - * innovative mobile and web companies in a broad range of business scenarios, such as automated trading systems, - * fraud detection, big data analytics, social networks, online gaming, and bioinformatics. - */ - -#ifndef _IGNITE_IGNITION -#define _IGNITE_IGNITION - -#include "ignite/ignite.h" -#include "ignite/ignite_configuration.h" -#include "ignite/ignite_error.h" - -namespace ignite -{ - /** - * This class defines a factory for the main Ignite API. - */ - class IGNITE_IMPORT_EXPORT Ignition - { - public: - /** - * Start Ignite instance. - * - * @param cfg Configuration. - * @return Ignite instance or null in case of error. - */ - static Ignite Start(const IgniteConfiguration& cfg); - - /* - * Start Ignite instance. - * - * @param cfg Configuration. - * @param err Error. - * @return Ignite instance or null in case of error. - */ - static Ignite Start(const IgniteConfiguration& cfg, IgniteError* err); - - /** - * Start Ignite instance with specific name. - * - * @param cfg Configuration. - * @param name Ignite name. - * @return Ignite instance or null in case of error. - */ - static Ignite Start(const IgniteConfiguration& cfg, const char* name); - - /** - * Start Ignite instance with specific name. - * - * @param cfg Configuration. - * @param name Ignite name. - * @param err Error. - * @return Ignite instance or null in case of error. - */ - static Ignite Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err); - - /** - * Get default Ignite instance. - * - * @return Default Ignite instance. - */ - static Ignite Get(); - - /** - * Get default Ignite instance. - * - * @param err Error. - * @return Default Ignite instance. - */ - static Ignite Get(IgniteError* err); - - /** - * Get Ignite instance with the given name. - * - * @param name Ignite name. - * @return Ignite instance. - */ - static Ignite Get(const char* name); - - /** - * Get Ignite instance with the given name. - * - * @param name Ignite name. - * @param err Error. - * @return Ignite instance. - */ - static Ignite Get(const char* name, IgniteError* err); - - /** - * Stop default Ignite instance. - * - * @param cancel Cancel flag. - * @return True if default Ignite instance was stopped by this call. - */ - static bool Stop(const bool cancel); - - /** - * Stop default Ignite instance. - * - * @param cancel Cancel flag. - * @param err Error. - * @return True if Ignite instance was stopped by this call. - */ - static bool Stop(const bool cancel, IgniteError* err); - - /** - * Stop Ignite instance with the given name. - * - * @param name Ignite name. - * @param cancel Cancel flag. - * @return True if Ignite instance was stopped by this call. - */ - static bool Stop(const char* name, const bool cancel); - - /** - * Stop Ignite instance with the given name. - * - * @param name Ignite name. - * @param cancel Cancel flag. - * @param err Error. - * @return True if Ignite instance was stopped by this call. - */ - static bool Stop(const char* name, const bool cancel, IgniteError* err); - - /** - * Stop all running Ignite instances. - * - * @param cancel Cancel flag. - */ - static void StopAll(const bool cancel); - - /** - * Stop all running Ignite instances. - * - * @param cancel Cancel flag. - * @param err Error. - */ - static void StopAll(const bool cancel, IgniteError* err); - }; -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h deleted file mode 100644 index 8c744e0..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h +++ /dev/null @@ -1,418 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_CACHE_IMPL -#define _IGNITE_CACHE_IMPL - -#include "ignite/cache/query/query_scan.h" -#include "ignite/cache/query/query_sql.h" -#include "ignite/cache/query/query_text.h" -#include "ignite/impl/ignite_environment.h" -#include "ignite/impl/cache/query/query_impl.h" -#include "ignite/impl/operations.h" - -namespace ignite -{ - namespace impl - { - namespace cache - { - /** - * Cache implementation. - */ - class IGNITE_IMPORT_EXPORT CacheImpl - { - public: - /** - * Constructor used to create new instance. - * - * @param name Name. - * @param env Environment. - * @param javaRef Reference to java object. - */ - CacheImpl(char* name, ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef); - - /** - * Destructor. - */ - ~CacheImpl(); - - /** - * Get name. - * - * @return Cache name. - */ - char* GetName(); - - /** - * Perform IsEmpty. - * - * @param err Error. - * @return Result. - */ - bool IsEmpty(IgniteError* err); - - /** - * Perform ContainsKey. - * - * @param inOp Input. - * @param err Error. - * @return Result. - */ - bool ContainsKey(InputOperation& inOp, IgniteError* err); - - /** - * Perform ContainsKeys. - * - * @param inOp Input. - * @param err Error. - * @return Result. - */ - bool ContainsKeys(InputOperation& inOp, IgniteError* err); - - /** - * Perform LocalPeek. - * - * @param inOp Input. - * @param outOp Output. - * @param peekModes Peek modes. - * @param err Error. - */ - void LocalPeek(InputOperation& inOp, OutputOperation& outOp, - int32_t peekModes, IgniteError* err); - - /** - * Perform Get. - * - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void Get(InputOperation& inOp, OutputOperation& outOp, IgniteError* err); - - /** - * Perform GetAll. - * - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void GetAll(InputOperation& inOp, OutputOperation& outOp, IgniteError* err); - - /** - * Perform Put. - * - * @param inOp Input. - * @param err Error. - */ - void Put(InputOperation& inOp, IgniteError* err); - - /** - * Perform PutAll. - * - * @param inOp Input. - * @param err Error. - */ - void PutAll(InputOperation& inOp, IgniteError* err); - - /** - * Perform GetAndPut. - * - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void GetAndPut(InputOperation& inOp, OutputOperation& outOp, IgniteError* err); - - /** - * Perform GetAndReplace. - * - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void GetAndReplace(InputOperation& inOp, OutputOperation& outOp, IgniteError* err); - - /** - * Perform GetAndRemove. - * - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void GetAndRemove(InputOperation& inOp, OutputOperation& outOp, IgniteError* err); - - /** - * Perform PutIfAbsent. - * - * @param inOp Input. - * @param err Error. - * @return Result - */ - bool PutIfAbsent(InputOperation& inOp, IgniteError* err); - - /** - * Perform GetAndPutIfAbsent. - * - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void GetAndPutIfAbsent(InputOperation& inOp, OutputOperation& outOp, IgniteError* err); - - /** - * Perform Replace(K, V). - * - * @param inOp Input. - * @param err Error. - * @return Result - */ - bool Replace(InputOperation& inOp, IgniteError* err); - - /** - * Perform Replace(K, V, V). - * - * @param inOp Input. - * @param err Error. - * @return Result - */ - bool ReplaceIfEqual(InputOperation& inOp, IgniteError* err); - - /** - * Perform LocalEvict. - * - * @param inOp Input. - * @param err Error. - */ - void LocalEvict(InputOperation& inOp, IgniteError* err); - - /** - * Perform Clear. - * - * @param err Error. - */ - void Clear(IgniteError* err); - - /** - * Perform Clear. - * - * @param inOp Input. - * @param err Error. - */ - void Clear(InputOperation& inOp, IgniteError* err); - - /** - * Perform ClearAll. - * - * @param inOp Input. - * @param err Error. - */ - void ClearAll(InputOperation& inOp, IgniteError* err); - - /** - * Perform LocalClear. - * - * @param inOp Input. - * @param err Error. - */ - void LocalClear(InputOperation& inOp, IgniteError* err); - - /** - * Perform LocalClearAll. - * - * @param inOp Input. - * @param err Error. - */ - void LocalClearAll(InputOperation& inOp, IgniteError* err); - - /** - * Perform Remove(K). - * - * @param inOp Input. - * @param err Error. - * @return Result - */ - bool Remove(InputOperation& inOp, IgniteError* err); - - /** - * Perform Remove(K, V). - * - * @param inOp Input. - * @param err Error. - * @return Result - */ - bool RemoveIfEqual(InputOperation& inOp, IgniteError* err); - - /** - * Perform RemoveAll. - * - * @param inOp Input. - * @param err Error. - */ - void RemoveAll(InputOperation& inOp, IgniteError* err); - - /** - * Perform RemoveAll. - * - * @param err Error. - */ - void RemoveAll(IgniteError* err); - - /** - * Perform Size. - * - * @param peekModes Peek modes. - * @param err Error. - * @return Result. - */ - int32_t Size(const int32_t peekModes, IgniteError* err); - - /** - * Perform LocalSize. - * - * @param peekModes Peek modes. - * @param err Error. - * @return Result. - */ - int32_t LocalSize(const int32_t peekModes, IgniteError* err); - - /** - * Invoke query. - * - * @param qry Query. - * @param err Error. - * @return Query cursor. - */ - query::QueryCursorImpl* QuerySql(const ignite::cache::query::SqlQuery& qry, IgniteError* err); - - /* - * Invoke text query. - * - * @param qry Query. - * @param err Error. - * @return Query cursor. - */ - query::QueryCursorImpl* QueryText(const ignite::cache::query::TextQuery& qry, IgniteError* err); - - /* - * Invoke scan query. - * - * @param qry Query. - * @param err Error. - * @return Query cursor. - */ - query::QueryCursorImpl* QueryScan(const ignite::cache::query::ScanQuery& qry, IgniteError* err); - - private: - /** Name. */ - char* name; - - /** Environment. */ - ignite::common::concurrent::SharedPointer<IgniteEnvironment> env; - - /** Handle to Java object. */ - jobject javaRef; - - IGNITE_NO_COPY_ASSIGNMENT(CacheImpl) - - /** - * Write data to memory. - * - * @param mem Memory. - * @param inOp Input opeartion. - * @param err Error. - * @return Memory pointer. - */ - int64_t WriteTo(interop::InteropMemory* mem, InputOperation& inOp, IgniteError* err); - - /** - * Read data from memory. - * - * @param mem Memory. - * @param outOp Output operation. - */ - void ReadFrom(interop::InteropMemory* mem, OutputOperation& outOp); - - /** - * Internal cache size routine. - * - * @param peekModes Peek modes. - * @param loc Local flag. - * @param err Error. - * @return Size. - */ - int SizeInternal(const int32_t peekModes, const bool loc, IgniteError* err); - - /** - * Internal out operation. - * - * @param opType Operation type. - * @param inOp Input. - * @param err Error. - * @return Result. - */ - bool OutOpInternal(const int32_t opType, InputOperation& inOp, IgniteError* err); - - /** - * Internal out-in operation. - * - * @param opType Operation type. - * @param inOp Input. - * @param outOp Output. - * @param err Error. - */ - void OutInOpInternal(const int32_t opType, InputOperation& inOp, OutputOperation& outOp, - IgniteError* err); - - /** - * Internal query execution routine. - * - * @param qry Query. - * @param typ Query type. - * @param err Error. - */ - template<typename T> - query::QueryCursorImpl* QueryInternal(const T& qry, int32_t typ, IgniteError* err) - { - ignite::common::java::JniErrorInfo jniErr; - - ignite::common::concurrent::SharedPointer<interop::InteropMemory> mem = env.Get()->AllocateMemory(); - interop::InteropMemory* mem0 = mem.Get(); - interop::InteropOutputStream out(mem0); - portable::PortableWriterImpl writer(&out, env.Get()->GetMetadataManager()); - ignite::portable::PortableRawWriter rawWriter(&writer); - - qry.Write(rawWriter); - - out.Synchronize(); - - jobject qryJavaRef = env.Get()->Context()->CacheOutOpQueryCursor(javaRef, typ, mem.Get()->PointerLong(), - &jniErr); - - IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); - - if (jniErr.code == ignite::common::java::IGNITE_JNI_ERR_SUCCESS) - return new query::QueryCursorImpl(env, qryJavaRef); - else - return NULL; - } - }; - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h deleted file mode 100644 index e65eeb6..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_CACHE_QUERY_IMPL -#define _IGNITE_CACHE_QUERY_IMPL - -#include "ignite/ignite_error.h" -#include "ignite/impl/ignite_environment.h" -#include "ignite/impl/operations.h" - -namespace ignite -{ - namespace impl - { - namespace cache - { - namespace query - { - /** - * Query cursor implementation. - */ - class IGNITE_IMPORT_EXPORT QueryCursorImpl - { - public: - /** - * Constructor. - * - * @param env Environment. - * @param javaRef Java reference. - */ - QueryCursorImpl(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef); - - /** - * Destructor. - */ - ~QueryCursorImpl(); - - /** - * Check whether next result exists. - * - * @param err Error. - * @return True if exists. - */ - bool HasNext(IgniteError* err); - - /** - * Get next object. - * - * @param op Operation. - * @param err Error. - */ - void GetNext(OutputOperation& op, IgniteError* err); - - /** - * Get all cursor entries. - * - * @param op Operation. - * @param err Error. - */ - void GetAll(OutputOperation& op, IgniteError* err); - - private: - /** Environment. */ - ignite::common::concurrent::SharedPointer<impl::IgniteEnvironment> env; - - /** Handle to Java object. */ - jobject javaRef; - - /** Whether iteration methods were called. */ - bool iterCalled; - - /** Whether GetAll() method was called. */ - bool getAllCalled; - - /** Whether next entry is available. */ - bool hasNext; - - IGNITE_NO_COPY_ASSIGNMENT(QueryCursorImpl); - - /** - * Create Java-side iterator if needed. - * - * @param err Error. - * @return True in case of success, false if an error is thrown. - */ - bool CreateIteratorIfNeeded(IgniteError* err); - - /** - * Check whether Java-side iterator has next element. - * - * @param err Error. - * @return True if the next element is available. - */ - bool IteratorHasNext(IgniteError* err); - }; - } - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h b/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h deleted file mode 100644 index 5e1b60a..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_HANDLE_REGISTRY -#define _IGNITE_HANDLE_REGISTRY - -#include <map> -#include <stdint.h> - -#include <ignite/common/concurrent.h> - -namespace ignite -{ - namespace impl - { - /** - * Something what can be registered inside handle registry. - */ - class IGNITE_IMPORT_EXPORT HandleRegistryEntry - { - public: - /** - * Destructor. - */ - virtual ~HandleRegistryEntry(); - }; - - /** - * Handle registry segment containing thread-specific data for slow-path access. - */ - class IGNITE_IMPORT_EXPORT HandleRegistrySegment - { - public: - /** - * Constructor. - */ - HandleRegistrySegment(); - - /** - * Destructor. - */ - ~HandleRegistrySegment(); - - /** - * Get entry from segment. - * - * @param hnd Handle. - * @return Associated entry or NULL if it doesn't exists. - */ - ignite::common::concurrent::SharedPointer<HandleRegistryEntry> Get(int64_t hnd); - - /** - * Put entry into segment. - * - * @param hnd Handle. - * @param entry Associated entry (cannot be NULL). - */ - void Put(int64_t hnd, const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& entry); - - /** - * Remove entry from the segment. - * - * @param hnd Handle. - */ - void Remove(int64_t hnd); - - /** - * Clear all entries from the segment. - */ - void Clear(); - private: - /** Map with data. */ - std::map<int64_t, ignite::common::concurrent::SharedPointer<HandleRegistryEntry>>* map; - - /** Mutex. */ - ignite::common::concurrent::CriticalSection* mux; - - IGNITE_NO_COPY_ASSIGNMENT(HandleRegistrySegment); - }; - - /** - * Handle registry. - */ - class IGNITE_IMPORT_EXPORT HandleRegistry - { - public: - /** - * Constructor. - * - * @param fastCap Fast-path capacity. - * @param segmentCnt Slow-path segments count. - */ - HandleRegistry(int32_t fastCap, int32_t slowSegmentCnt); - - /** - * Destructor. - */ - ~HandleRegistry(); - - /** - * Allocate handle. - * - * @param target Target. - * @return Handle. - */ - int64_t Allocate(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target); - - /** - * Allocate handle in critical mode. - * - * @param target Target. - * @return Handle. - */ - int64_t AllocateCritical(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target); - - /** - * Allocate handle in safe mode. - * - * @param target Target. - * @return Handle. - */ - int64_t AllocateSafe(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target); - - /** - * Allocate handle in critical and safe modes. - * - * @param target Target. - * @return Handle. - */ - int64_t AllocateCriticalSafe(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target); - - /** - * Release handle. - * - * @param hnd Handle. - */ - void Release(int64_t hnd); - - /** - * Get target. - * - * @param hnd Handle. - * @param Target. - */ - ignite::common::concurrent::SharedPointer<HandleRegistryEntry> Get(int64_t hnd); - - /** - * Close the registry. - */ - void Close(); - private: - /** Fast-path container capacity. */ - int32_t fastCap; - - /** Fast-path counter. */ - int32_t fastCtr; - - /** Fast-path container. */ - ignite::common::concurrent::SharedPointer<HandleRegistryEntry>* fast; - - /** Amount of slow-path segments. */ - int32_t slowSegmentCnt; - - /** Slow-path counter. */ - int64_t slowCtr; - - /** Slow-path segments. */ - HandleRegistrySegment** slow; - - /** Close flag. */ - int32_t closed; - - IGNITE_NO_COPY_ASSIGNMENT(HandleRegistry); - - /** - * Internal allocation routine. - * - * @param target Target. - * @param Critical mode flag. - * @param Safe mode flag. - */ - int64_t Allocate0(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target, - bool critical, bool safe); - }; - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h b/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h deleted file mode 100644 index 2f195b2..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_ENVIRONMENT -#define _IGNITE_ENVIRONMENT - -#include <ignite/common/concurrent.h> -#include <ignite/common/java.h> - -#include "ignite/impl/interop/interop_memory.h" -#include "portable/portable_metadata_manager.h" - -namespace ignite -{ - namespace impl - { - /** - * Defines environment in which Ignite operates. - */ - class IGNITE_IMPORT_EXPORT IgniteEnvironment - { - public: - /** - * Default constructor. - */ - IgniteEnvironment(); - - /** - * Destructor. - */ - ~IgniteEnvironment(); - - /** - * Populate callback handlers. - * - * @param Target (current env wrapped into a shared pointer). - * @return JNI handlers. - */ - ignite::common::java::JniHandlers GetJniHandlers(ignite::common::concurrent::SharedPointer<IgniteEnvironment>* target); - - /** - * Perform initialization on successful start. - * - * @param ctx Context. - */ - void Initialize(ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx); - - /** - * Start callback. - * - * @param memPtr Memory pointer. - */ - void OnStartCallback(long long memPtr); - - /** - * Get name of Ignite instance. - * - * @return Name. - */ - char* InstanceName(); - - /** - * Get JNI context. - * - * @return Context. - */ - ignite::common::java::JniContext* Context(); - - /** - * Get memory for interop operations. - * - * @return Memory. - */ - ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory(); - - /** - * Get memory chunk for interop operations with desired capacity. - * - * @param cap Capacity. - * @return Memory. - */ - ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory(int32_t cap); - - /** - * Get memory chunk located at the given pointer. - * - * @param memPtr Memory pointer. - * @retrun Memory. - */ - ignite::common::concurrent::SharedPointer<interop::InteropMemory> GetMemory(int64_t memPtr); - - /** - * Get metadata manager. - * - * @param Metadata manager. - */ - portable::PortableMetadataManager* GetMetadataManager(); - private: - /** Context to access Java. */ - ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx; - - /** Startup latch. */ - ignite::common::concurrent::SingleLatch* latch; - - /** Ignite name. */ - char* name; - - /** Metadata manager. */ - portable::PortableMetadataManager* metaMgr; - - IGNITE_NO_COPY_ASSIGNMENT(IgniteEnvironment); - }; - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h deleted file mode 100644 index 52472c6..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_IMPL -#define _IGNITE_IMPL - -#include <ignite/common/concurrent.h> -#include <ignite/common/java.h> - -#include "ignite/impl/cache/cache_impl.h" -#include "ignite/impl/ignite_environment.h" -#include "ignite/impl/utils.h" - -namespace ignite -{ - namespace impl - { - /** - * Ignite implementation. - */ - class IgniteImpl - { - friend class Ignite; - public: - /** - * Constructor used to create new instance. - * - * @param env Environment. - * @param javaRef Reference to java object. - */ - IgniteImpl(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef); - - /** - * Destructor. - */ - ~IgniteImpl(); - - /** - * Get name of the Ignite. - * - * @param Name. - */ - char* GetName(); - - /** - * Get cache. - * - * @param name Cache name. - * @param err Error. - */ - template<typename K, typename V> - cache::CacheImpl* GetCache(const char* name, IgniteError* err) - { - ignite::common::java::JniErrorInfo jniErr; - - jobject cacheJavaRef = env.Get()->Context()->ProcessorCache(javaRef, name, &jniErr); - - if (!cacheJavaRef) - { - IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); - - return NULL; - } - - char* name0 = utils::CopyChars(name); - - return new cache::CacheImpl(name0, env, cacheJavaRef); - } - - /** - * Get or create cache. - * - * @param name Cache name. - * @param err Error. - */ - template<typename K, typename V> - cache::CacheImpl* GetOrCreateCache(const char* name, IgniteError* err) - { - ignite::common::java::JniErrorInfo jniErr; - - jobject cacheJavaRef = env.Get()->Context()->ProcessorGetOrCreateCache(javaRef, name, &jniErr); - - if (!cacheJavaRef) - { - IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); - - return NULL; - } - - char* name0 = utils::CopyChars(name); - - return new cache::CacheImpl(name0, env, cacheJavaRef); - } - - /** - * Create cache. - * - * @param name Cache name. - * @param err Error. - */ - template<typename K, typename V> - cache::CacheImpl* CreateCache(const char* name, IgniteError* err) - { - ignite::common::java::JniErrorInfo jniErr; - - jobject cacheJavaRef = env.Get()->Context()->ProcessorCreateCache(javaRef, name, &jniErr); - - if (!cacheJavaRef) - { - IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err); - - return NULL; - } - - char* name0 = utils::CopyChars(name); - - return new cache::CacheImpl(name0, env, cacheJavaRef); - } - private: - /** Environment. */ - ignite::common::concurrent::SharedPointer<IgniteEnvironment> env; - - /** Native Java counterpart. */ - jobject javaRef; - - IGNITE_NO_COPY_ASSIGNMENT(IgniteImpl) - }; - } - -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h deleted file mode 100644 index da4fdb9..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_IMPL_INTEROP -#define _IGNITE_IMPL_INTEROP - -#include "ignite/impl/interop/interop_memory.h" -#include "ignite/impl/interop/interop_output_stream.h" -#include "ignite/impl/interop/interop_input_stream.h" - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h deleted file mode 100644 index d8fcfc3..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_IMPL_INTEROP_INPUT_STREAM -#define _IGNITE_IMPL_INTEROP_INPUT_STREAM - -#include "ignite/impl/interop/interop_memory.h" - -namespace ignite -{ - namespace impl - { - namespace interop - { - /** - * Interop input stream implementation. - */ - class IGNITE_IMPORT_EXPORT InteropInputStream { - public: - /** - * Constructor. - * - * @param mem Memory. - */ - InteropInputStream(InteropMemory* mem); - - /** - * Read signed 8-byte int. - * - * @return Value. - */ - int8_t ReadInt8(); - - /** - * Read signed 8-byte int array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadInt8Array(int8_t* const res, const int32_t len); - - /** - * Read bool. - * - * @return Value. - */ - bool ReadBool(); - - /** - * Read bool array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadBoolArray(bool* const res, const int32_t len); - - /** - * Read signed 16-byte int. - * - * @return Value. - */ - int16_t ReadInt16(); - - /** - * Read signed 16-byte int array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadInt16Array(int16_t* const res, const int32_t len); - - /** - * Read unsigned 16-byte int. - * - * @return Value. - */ - uint16_t ReadUInt16(); - - /** - * Read unsigned 16-byte int array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadUInt16Array(uint16_t* const res, const int32_t len); - - /** - * Read signed 32-byte int. - * - * @return Value. - */ - int32_t ReadInt32(); - - /** - * Read signed 32-byte int at the given position. - * - * @param pos Position. - * @return Value. - */ - int32_t ReadInt32(int32_t pos); - - /** - * Read signed 32-byte int array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadInt32Array(int32_t* const res, const int32_t len); - - /** - * Read signed 64-byte int. - * - * @return Value. - */ - int64_t ReadInt64(); - - /** - * Read signed 64-byte int array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadInt64Array(int64_t* const res, const int32_t len); - - /** - * Read float. - * - * @return Value. - */ - float ReadFloat(); - - /** - * Read float array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadFloatArray(float* const res, const int32_t len); - - /** - * Read double. - * - * @return Value. - */ - double ReadDouble(); - - /** - * Read double array. - * - * @param res Allocated array. - * @param len Length. - */ - void ReadDoubleArray(double* const res, const int32_t len); - - /** - * Get remaining bytes. - * - * @return Remaining bytes. - */ - int32_t Remaining(); - - /** - * Get position. - * - * @return Position. - */ - int32_t Position(); - - /** - * Set position. - * - * @param Position. - */ - void Position(int32_t pos); - - /** - * Synchronize data from underlying memory. - */ - void Synchronize(); - private: - /** Memory. */ - InteropMemory* mem; - - /** Pointer to data. */ - int8_t* data; - - /** Length. */ - int len; - - /** Current position. */ - int pos; - - /** - * Ensure there is enough data in the stream. - * - * @param cnt Amount of byte expected to be available. - */ - void EnsureEnoughData(int32_t cnt); - - /** - * Copy data from the stream shifting it along the way. - * - * @param ptr Pointer to data. - * @param off Offset. - * @param cnt Amount of data to copy. - */ - void CopyAndShift(int8_t* dest, int32_t off, int32_t cnt); - - /** - * Shift stream to the right. - * - * @param cnt Amount of bytes to shift the stream to. - */ - void Shift(int32_t cnt); - }; - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h deleted file mode 100644 index 00cba43..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_IMPL_INTEROP_MEMORY -#define _IGNITE_IMPL_INTEROP_MEMORY - -#include <stdint.h> - -#include <ignite/common/common.h> - -namespace ignite -{ - namespace impl - { - namespace interop - { - /** Memory header length. */ - const int IGNITE_MEM_HDR_LEN = 20; - - /** Memory header offset: capacity. */ - const int IGNITE_MEM_HDR_OFF_CAP = 8; - - /** Memory header offset: length. */ - const int IGNITE_MEM_HDR_OFF_LEN = 12; - - /** Memory header offset: flags. */ - const int IGNITE_MEM_HDR_OFF_FLAGS = 16; - - /** Flag: external. */ - const int IGNITE_MEM_FLAG_EXT = 0x1; - - /** Flag: pooled. */ - const int IGNITE_MEM_FLAG_POOLED = 0x2; - - /** Flag: acquired. */ - const int IGNITE_MEM_FLAG_ACQUIRED = 0x4; - - /** - * Interop memory. - */ - class IGNITE_IMPORT_EXPORT InteropMemory - { - public: - /** - * Get raw data pointer. - * - * @param memPtr Memory pointer. - * @return Raw data pointer. - */ - static int8_t* Data(int8_t* memPtr); - - /** - * Set raw data pointer. - * - * @param memPtr Memory pointer. - * @param ptr Raw data pointer. - */ - static void Data(int8_t* memPtr, void* ptr); - - /** - * Get capacity. - * - * @param memPtr Memory pointer. - * @return Capacity. - */ - static int32_t Capacity(int8_t* memPtr); - - /** - * Set capacity. - * - * @param memPtr Memory pointer. - * @param val Value. - */ - static void Capacity(int8_t* memPtr, int32_t val); - - /** - * Get length. - * - * @param memPtr Memory pointer. - * @return Length. - */ - static int32_t Length(int8_t* memPtr); - - /** - * Set length. - * - * @param memPtr Memory pointer. - * @param val Value. - */ - static void Length(int8_t* memPtr, int32_t val); - - /** - * Get flags. - * - * @param memPtr Memory pointer. - * @return Flags. - */ - static int32_t Flags(int8_t* memPtr); - - /** - * Set flags. - * - * @param memPtr Memory pointer. - * @param val Value. - */ - static void Flags(int8_t* memPtr, int32_t val); - - /** - * Get "external" flag state. - * - * @param memPtr Memory pointer. - * @return Flag state. - */ - static bool IsExternal(int8_t* memPtr); - - /** - * Get "external" flag state. - * - * @param flags Flags. - * @return Flag state. - */ - static bool IsExternal(int32_t flags); - - /** - * Get "pooled" flag state. - * - * @param memPtr Memory pointer. - * @return Flag state. - */ - static bool IsPooled(int8_t* memPtr); - - /** - * Get "pooled" flag state. - * - * @param flags Flags. - * @return Flag state. - */ - static bool IsPooled(int32_t flags); - - /** - * Get "acquired" flag state. - * - * @param memPtr Memory pointer. - * @return Flag state. - */ - static bool IsAcquired(int8_t* memPtr); - - /** - * Get "acquired" flag state. - * - * @param flags Flags. - * @return Flag state. - */ - static bool IsAcquired(int32_t flags); - - /** - * Destructor. - */ - virtual ~InteropMemory() { } - - /** - * Get cross-platform memory pointer. - * - * @return Memory pointer. - */ - int8_t* Pointer(); - - /** - * Get cross-platform pointer in long form. - */ - int64_t PointerLong(); - - /** - * Get raw data pointer. - * - * @return Data pointer. - */ - int8_t* Data(); - - /** - * Get capacity. - * - * @return Capacity. - */ - int32_t Capacity(); - - /** - * Get length. - * - * @return Length. - */ - int32_t Length(); - - /** - * Set length. - * - * @param val Length. - */ - void Length(int32_t val); - - /** - * Reallocate memory. - * - * @param cap Desired capactiy. - */ - virtual void Reallocate(int32_t cap) = 0; - protected: - /** Memory pointer. */ - int8_t* memPtr; - }; - - /** - * Interop unpooled memory. - */ - class IGNITE_IMPORT_EXPORT InteropUnpooledMemory : public InteropMemory - { - public: - /** - * Constructor create new unpooled memory object from scratch. - * - * @param cap Capacity. - */ - explicit InteropUnpooledMemory(int32_t cap); - - /** - * Constructor creating unpooled memory object from existing memory pointer. - * - * @param memPtr Memory pointer. - */ - explicit InteropUnpooledMemory(int8_t* memPtr); - - /** - * Destructor. - */ - ~InteropUnpooledMemory(); - - virtual void Reallocate(int32_t cap); - private: - /** Whether this instance is owner of memory chunk. */ - bool owning; - - IGNITE_NO_COPY_ASSIGNMENT(InteropUnpooledMemory) - }; - - /** - * Interop external memory. - */ - class IGNITE_IMPORT_EXPORT InteropExternalMemory : public InteropMemory - { - public: - /** - * Constructor. - * - * @param memPtr External memory pointer. - */ - explicit InteropExternalMemory(int8_t* memPtr); - - virtual void Reallocate(int32_t cap); - private: - IGNITE_NO_COPY_ASSIGNMENT(InteropExternalMemory) - }; - } - } -} - -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h ---------------------------------------------------------------------- diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h deleted file mode 100644 index 5a08aed..0000000 --- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h +++ /dev/null @@ -1,234 +0,0 @@ -/* - * 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. - */ - -#ifndef _IGNITE_IMPL_INTEROP_OUTPUT_STREAM -#define _IGNITE_IMPL_INTEROP_OUTPUT_STREAM - -#include "ignite/impl/interop/interop_memory.h" - -namespace ignite -{ - namespace impl - { - namespace interop - { - /** - * Interop output stream. - */ - class IGNITE_IMPORT_EXPORT InteropOutputStream { - public: - /** - * Create new output stream with the given capacity. - * - * @param mem Memory. - */ - InteropOutputStream(InteropMemory* mem); - - /** - * Write signed 8-byte integer. - * - * @param val Value. - */ - void WriteInt8(const int8_t val); - - /** - * Write signed 8-byte integer at the given position. - * - * @param val Value. - */ - void WriteInt8(const int8_t val, const int32_t pos); - - /** - * Write signed 8-byte integer array. - * - * @param val Value. - * @param len Length. - */ - void WriteInt8Array(const int8_t* val, const int32_t len); - - /** - * Write bool. - * - * @param val Value. - */ - void WriteBool(const bool val); - - /** - * Write bool array. - * - * @param val Value. - * @param len Length. - */ - void WriteBoolArray(const bool* val, const int32_t len); - - /** - * Write signed 16-byte integer. - * - * @param val Value. - */ - void WriteInt16(const int16_t val); - - /** - * Write signed 16-byte integer array. - * - * @param val Value. - * @param len Length. - */ - void WriteInt16Array(const int16_t* val, const int32_t len); - - /** - * Write unsigned 16-byte integer. - * - * @param val Value. - */ - void WriteUInt16(const uint16_t val); - - /** - * Write unsigned 16-byte integer array. - * - * @param val Value. - * @param len Length. - */ - void WriteUInt16Array(const uint16_t* val, const int32_t len); - - /** - * Write signed 32-byte integer. - * - * @param val Value. - */ - void WriteInt32(const int32_t val); - - /** - * Write signed 32-byte integer at the given position. - * - * @param pos Position. - * @param val Value. - */ - void WriteInt32(const int32_t pos, const int32_t val); - - /** - * Write signed 32-byte integer array. - * - * @param val Value. - * @param len Length. - */ - void WriteInt32Array(const int32_t* val, const int32_t len); - - /** - * Write signed 64-byte integer. - * - * @param val Value. - */ - void WriteInt64(const int64_t val); - - /** - * Write signed 64-byte integer array. - * - * @param val Value. - * @param len Length. - */ - void WriteInt64Array(const int64_t* val, const int32_t len); - - /** - * Write float. - * - * @param val Value. - */ - void WriteFloat(const float val); - - /** - * Write float array. - * - * @param val Value. - * @param len Length. - */ - void WriteFloatArray(const float* val, const int32_t len); - - /** - * Write double. - * - * @param val Value. - */ - void WriteDouble(const double val); - - /** - * Write double array. - * - * @param val Value. - * @param len Length. - */ - void WriteDoubleArray(const double* val, const int32_t len); - - /** - * Get current stream position. - */ - int32_t Position(); - - /** - * Set current stream position (absolute). - * - * @param val Position (absolute). - */ - void Position(const int32_t val); - - /** - * Synchronize data with underlying memory. - */ - void Synchronize(); - private: - /** Memory. */ - InteropMemory* mem; - - /** Pointer to data. */ - int8_t* data; - - /** Capacity. */ - int cap; - - /** Current position. */ - int pos; - - IGNITE_NO_COPY_ASSIGNMENT(InteropOutputStream) - - /** - * Ensure that stream enough capacity optionally extending it. - * - * @param reqCap Requsted capacity. - */ - void EnsureCapacity(int32_t reqCap); - - /** - * Shift stream to the right. - * - * @param cnt Amount of bytes to shift the stream to. - */ - void Shift(int32_t cnt); - - /** - * Copy data to the stream shifting it along the way. - * - * @param ptr Pointer to data. - * @param off Offset. - * @param len Length. - */ - void CopyAndShift(const int8_t* src, int32_t off, int32_t len); - }; - } - } -} - -#endif \ No newline at end of file
