You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/09/22 17:02:14 UTC
[40/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h
deleted file mode 100644
index 5e4b7ad..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h
+++ /dev/null
@@ -1,355 +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_PORTABLE_READER
-#define _IGNITE_PORTABLE_READER
-
-#include <stdint.h>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#include "ignite/portable/portable_raw_reader.h"
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable reader.
- */
- class IGNITE_IMPORT_EXPORT PortableReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- PortableReader(ignite::impl::portable::PortableReaderImpl* impl);
-
- /**
- * Read 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param fieldName Field name.
- * @param fieldName Field name.
- * @return Result.
- */
- int8_t ReadInt8(const char* fieldName);
-
- /**
- * Read array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len);
-
- /**
- * Read bool. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- bool ReadBool(const char* fieldName);
-
- /**
- * Read array of bools. Maps to "bool[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadBoolArray(const char* fieldName, bool* res, const int32_t len);
-
- /**
- * Read 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int16_t ReadInt16(const char* fieldName);
-
- /**
- * Read array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len);
-
- /**
- * Read 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- uint16_t ReadUInt16(const char* fieldName);
-
- /**
- * Read array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len);
-
- /**
- * Read 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int32_t ReadInt32(const char* fieldName);
-
- /**
- * Read array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len);
-
- /**
- * Read 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int64_t ReadInt64(const char* fieldName);
-
- /**
- * Read array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len);
-
- /**
- * Read float. Maps to "float" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- float ReadFloat(const char* fieldName);
-
- /**
- * Read array of floats. Maps to "float[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadFloatArray(const char* fieldName, float* res, const int32_t len);
-
- /**
- * Read double. Maps to "double" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- double ReadDouble(const char* fieldName);
-
- /**
- * Read array of doubles. Maps to "double[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadDoubleArray(const char* fieldName, double* res, const int32_t len);
-
- /**
- * Read Guid. Maps to "UUID" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- Guid ReadGuid(const char* fieldName);
-
- /**
- * Read array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadGuidArray(const char* fieldName, Guid* res, const int32_t len);
-
- /**
- * Read string.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of string. NULL terminator will be set in case len is
- * greater than real string length.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadString(const char* fieldName, char* res, const int32_t len);
-
- /**
- * Read string from the stream.
- *
- * @param fieldName Field name.
- * @return String.
- */
- std::string ReadString(const char* fieldName)
- {
- int32_t len = ReadString(fieldName, NULL, 0);
-
- if (len != -1)
- {
- ignite::impl::utils::SafeArray<char> arr(len + 1);
-
- ReadString(fieldName, arr.target, len + 1);
-
- return std::string(arr.target);
- }
- else
- return std::string();
- }
-
- /**
- * Start string array read.
- *
- * @param fieldName Field name.
- * @return String array reader.
- */
- PortableStringArrayReader ReadStringArray(const char* fieldName);
-
- /**
- * Start array read.
- *
- * @param fieldName Field name.
- * @return Array reader.
- */
- template<typename T>
- PortableArrayReader<T> ReadArray(const char* fieldName)
- {
- int32_t size;
-
- int32_t id = impl->ReadArray(fieldName, &size);
-
- return PortableArrayReader<T>(impl, id, size);
- }
-
- /**
- * Start collection read.
- *
- * @param fieldName Field name.
- * @return Collection reader.
- */
- template<typename T>
- PortableCollectionReader<T> ReadCollection(const char* fieldName)
- {
- CollectionType typ;
- int32_t size;
-
- int32_t id = impl->ReadCollection(fieldName, &typ, &size);
-
- return PortableCollectionReader<T>(impl, id, typ, size);
- }
-
- /**
- * Start map read.
- *
- * @param fieldName Field name.
- * @return Map reader.
- */
- template<typename K, typename V>
- PortableMapReader<K, V> ReadMap(const char* fieldName)
- {
- MapType typ;
- int32_t size;
-
- int32_t id = impl->ReadMap(fieldName, &typ, &size);
-
- return PortableMapReader<K, V>(impl, id, typ, size);
- }
-
- /**
- * Read object.
- *
- * @param fieldName Field name.
- * @return Object.
- */
- template<typename T>
- T ReadObject(const char* fieldName)
- {
- return impl->ReadObject<T>(fieldName);
- }
-
- /**
- * Get raw reader for this reader.
- *
- * @return Raw reader.
- */
- PortableRawReader RawReader();
- private:
- /** Implementation delegate. */
- ignite::impl::portable::PortableReaderImpl* impl;
- };
- }
-}
-
-#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/portable/portable_type.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h
deleted file mode 100644
index fb086ef..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h
+++ /dev/null
@@ -1,293 +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_PORTABLE_TYPE
-#define _IGNITE_PORTABLE_TYPE
-
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#include "ignite/ignite_error.h"
-
-/**
- * Start portable type definition.
- */
-#define IGNITE_PORTABLE_TYPE_START(T) \
-template<> \
-struct PortableType<T> \
-{
-
-/**
- * End portable type definition.
- */
-#define IGNITE_PORTABLE_TYPE_END \
-};
-
-/**
- * Implementation of GetTypeId() which returns predefined constant.
- */
-#define IGNITE_PORTABLE_GET_TYPE_ID_AS_CONST(id) \
-int32_t GetTypeId() \
-{ \
- return id; \
-}
-
-/**
- * Implementation of GetTypeId() which returns hash of passed type name.
- */
-#define IGNITE_PORTABLE_GET_TYPE_ID_AS_HASH(typeName) \
-int32_t GetTypeId() \
-{ \
- return GetPortableStringHashCode(#typeName); \
-}
-
-/**
- * Implementation of GetTypeName() which returns type name as is.
- */
-#define IGNITE_PORTABLE_GET_TYPE_NAME_AS_IS(typeName) \
-std::string GetTypeName() \
-{ \
- return #typeName; \
-}
-
-/**
- * Default implementation of GetFieldId() function which returns Java-way hash code of the string.
- */
-#define IGNITE_PORTABLE_GET_FIELD_ID_AS_HASH \
-int32_t GetFieldId(const char* name) \
-{ \
- return GetPortableStringHashCode(name); \
-}
-
-/**
- * Implementation of GetHashCode() function which always returns 0.
- */
-#define IGNITE_PORTABLE_GET_HASH_CODE_ZERO(T) \
-int32_t GetHashCode(const T& obj) \
-{ \
- return 0; \
-}
-
-/**
- * Implementation of IsNull() function which always returns false.
- */
-#define IGNITE_PORTABLE_IS_NULL_FALSE(T) \
-bool IsNull(const T& obj) \
-{ \
- return false; \
-}
-
-/**
- * Implementation of IsNull() function which return true if passed object is null pointer.
- */
-#define IGNITE_PORTABLE_IS_NULL_IF_NULLPTR(T) \
-bool IsNull(const T& obj) \
-{ \
- return obj; \
-}
-
-/**
- * Implementation of GetNull() function which returns an instance created with defult constructor.
- */
-#define IGNITE_PORTABLE_GET_NULL_DEFAULT_CTOR(T) \
-T GetNull() \
-{ \
- return T(); \
-}
-
-/**
- * Implementation of GetNull() function which returns NULL pointer.
- */
-#define IGNITE_PORTABLE_GET_NULL_NULLPTR(T) \
-T GetNull() \
-{ \
- return NULL; \
-}
-
-namespace ignite
-{
- namespace portable
- {
- class PortableWriter;
- class PortableReader;
-
- /**
- * Get portable string hash code.
- *
- * @param val Value.
- * @return Hash code.
- */
- IGNITE_IMPORT_EXPORT int32_t GetPortableStringHashCode(const char* val);
-
- /**
- * Portable type structure. Defines a set of functions required for type to be serialized and deserialized.
- */
- template<typename T>
- struct IGNITE_IMPORT_EXPORT PortableType
- {
- /**
- * Get portable object type ID.
- *
- * @return Type ID.
- */
- int32_t GetTypeId()
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "GetTypeId function is not defined for portable type.");
- }
-
- /**
- * Get portable object type name.
- *
- * @return Type name.
- */
- std::string GetTypeName()
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "GetTypeName function is not defined for portable type.");
- }
-
- /**
- * Get portable object field ID.
- *
- * @param name Field name.
- * @return Field ID.
- */
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- /**
- * Get portable object hash code.
- *
- * @param obj Portable object.
- * @return Hash code.
- */
- int32_t GetHashCode(const T& obj)
- {
- return 0;
- }
-
- /**
- * Write portable object.
- *
- * @param writer Writer.
- * @param obj Object.
- */
- void Write(PortableWriter& writer, const T& obj)
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Write function is not defined for portable type.");
- }
-
- /**
- * Read portable object.
- *
- * @param reader Reader.
- * @return Object.
- */
- T Read(PortableReader& reader)
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Read function is not defined for portable type.");
- }
-
- /**
- * Check whether passed portable object should be interpreted as NULL.
- *
- * @param obj Portable object to test.
- * @return True if portable object should be interpreted as NULL.
- */
- bool IsNull(const T& obj)
- {
- return false;
- }
-
- /**
- * Get NULL value for the given portable type.
- *
- * @return NULL value.
- */
- T GetNull()
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "GetNull function is not defined for portable type.");
- }
- };
-
- /*
- * Templated portable type for pointers.
- */
- template <typename T>
- struct IGNITE_IMPORT_EXPORT PortableType<T*>
- {
- /** Actual type. */
- PortableType<T> typ;
-
- /**
- * Constructor.
- */
- PortableType()
- {
- typ = PortableType<T>();
- }
-
- int32_t GetTypeId()
- {
- return typ.GetTypeId();
- }
-
- std::string GetTypeName()
- {
- return typ.GetTypeName();
- }
-
- int32_t GetFieldId(const char* name)
- {
- return typ.GetFieldId(name);
- }
-
- int32_t GetHashCode(T* const& obj)
- {
- return typ.GetHashCode(*obj);
- }
-
- void Write(PortableWriter& writer, T* const& obj)
- {
- typ.Write(writer, *obj);
- }
-
- T* Read(PortableReader& reader)
- {
- T* res = new T();
-
- *res = typ.Read(reader);
-
- return res;
- }
-
- bool IsNull(T* const& obj)
- {
- return !obj || typ.IsNull(*obj);
- }
-
- T* GetNull()
- {
- return NULL;
- }
- };
- }
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h
deleted file mode 100644
index 5dc9494..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h
+++ /dev/null
@@ -1,335 +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_PORTABLE_WRITER
-#define _IGNITE_PORTABLE_WRITER
-
-#include <string>
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#include "ignite/portable/portable_raw_writer.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable writer.
- */
- class IGNITE_IMPORT_EXPORT PortableWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- PortableWriter(ignite::impl::portable::PortableWriterImpl* impl);
-
- /**
- * Write 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt8(const char* fieldName, const int8_t val);
-
- /**
- * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len);
-
- /**
- * Write bool. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteBool(const char* fieldName, const bool val);
-
- /**
- * Write array of bools. Maps to "bool[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteBoolArray(const char* fieldName, const bool* val, const int32_t len);
-
- /**
- * Write 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt16(const char* fieldName, const int16_t val);
-
- /**
- * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len);
-
- /**
- * Write 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteUInt16(const char* fieldName, const uint16_t val);
-
- /**
- * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len);
-
- /**
- * Write 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt32(const char* fieldName, const int32_t val);
-
- /**
- * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len);
-
- /**
- * Write 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt64(const char* fieldName, const int64_t val);
-
- /**
- * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len);
-
- /**
- * Write float. Maps to "float" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteFloat(const char* fieldName, const float val);
-
- /**
- * Write array of floats. Maps to "float[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteFloatArray(const char* fieldName, const float* val, const int32_t len);
-
- /**
- * Write double. Maps to "double" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteDouble(const char* fieldName, const double val);
-
- /**
- * Write array of doubles. Maps to "double[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteDoubleArray(const char* fieldName, const double* val, const int32_t len);
-
- /**
- * Write Guid. Maps to "UUID" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteGuid(const char* fieldName, const Guid val);
-
- /**
- * Write array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val Null-terminated character sequence.
- */
- void WriteString(const char* fieldName, const char* val);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val String.
- * @param len String length (characters).
- */
- void WriteString(const char* fieldName, const char* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val String.
- */
- void WriteString(const char* fieldName, const std::string& val)
- {
- WriteString(fieldName, val.c_str());
- }
-
- /**
- * Start string array write.
- *
- * @param fieldName Field name.
- * @return String array writer.
- */
- PortableStringArrayWriter WriteStringArray(const char* fieldName);
-
- /**
- * Write NULL value.
- *
- * @param fieldName Field name.
- */
- void WriteNull(const char* fieldName);
-
- /**
- * Start array write.
- *
- * @param fieldName Field name.
- * @return Array writer.
- */
- template<typename T>
- PortableArrayWriter<T> WriteArray(const char* fieldName)
- {
- int32_t id = impl->WriteArray(fieldName);
-
- return PortableArrayWriter<T>(impl, id);
- }
-
- /**
- * Start collection write.
- *
- * @param fieldName Field name.
- * @return Collection writer.
- */
- template<typename T>
- PortableCollectionWriter<T> WriteCollection(const char* fieldName)
- {
- return WriteCollection<T>(fieldName, IGNITE_COLLECTION_UNDEFINED);
- }
-
- /**
- * Start collection write.
- *
- * @param fieldName Field name.
- * @param type Collection type.
- * @return Collection writer.
- */
- template<typename T>
- PortableCollectionWriter<T> WriteCollection(const char* fieldName, ignite::portable::CollectionType typ)
- {
- int32_t id = impl->WriteCollection(fieldName, typ);
-
- return PortableCollectionWriter<T>(impl, id);
- }
-
- /**
- * Start map write.
- *
- * @param fieldName Field name.
- * @param typ Map type.
- * @return Map writer.
- */
- template<typename K, typename V>
- PortableMapWriter<K, V> WriteMap(const char* fieldName)
- {
- return WriteMap<K, V>(fieldName, IGNITE_MAP_UNDEFINED);
- }
-
- /**
- * Start map write.
- *
- * @param fieldName Field name.
- * @param typ Map type.
- * @return Map writer.
- */
- template<typename K, typename V>
- PortableMapWriter<K, V> WriteMap(const char* fieldName, ignite::portable::MapType typ)
- {
- int32_t id = impl->WriteMap(fieldName, typ);
-
- return PortableMapWriter<K, V>(impl, id);
- }
-
- /**
- * Write object.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- template<typename T>
- void WriteObject(const char* fieldName, T val)
- {
- impl->WriteObject<T>(fieldName, val);
- }
-
- /**
- * Get raw writer for this reader.
- *
- * @return Raw writer.
- */
- PortableRawWriter RawWriter();
- private:
- /** Implementation delegate. */
- ignite::impl::portable::PortableWriterImpl* impl;
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am b/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am
deleted file mode 100644
index 2ee13eff..0000000
--- a/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am
+++ /dev/null
@@ -1,20 +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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = ignite/impl/utils.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h b/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h
deleted file mode 100644
index 8bbd2f7..0000000
--- a/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h
+++ /dev/null
@@ -1,155 +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_UTILS
-#define _IGNITE_UTILS
-
-#include <cstring>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#ifdef IGNITE_FRIEND
- #define IGNITE_FRIEND_EXPORT IGNITE_EXPORT
-#else
- #define IGNITE_FRIEND_EXPORT
-#endif
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- /**
- * Copy characters.
- *
- * @param val Value.
- * @return Result.
- */
- IGNITE_FRIEND_EXPORT char* CopyChars(const char* val);
-
- /**
- * Release characters.
- *
- * @param val Value.
- */
- IGNITE_FRIEND_EXPORT void ReleaseChars(char* val);
-
- /**
- * Read system environment variable taking thread-safety in count.
- *
- * @param name Environment variable name.
- * @param found Whether environment variable with such name was found.
- * @return Environment variable value.
- */
- IGNITE_FRIEND_EXPORT std::string GetEnv(const std::string& name, bool* found);
-
- /**
- * Ensure that file on the given path exists in the system.
- *
- * @param path Path.
- * @return True if file exists, false otherwise.
- */
- IGNITE_FRIEND_EXPORT bool FileExists(const std::string& path);
-
- /**
- * Attempts to find JVM library to load it into the process later.
- * First search is performed using the passed path argument (is not NULL).
- * Then JRE_HOME is evaluated. Last, JAVA_HOME is evaluated.
- *
- * @param Explicitly defined path (optional).
- * @param found Whether library was found.
- * @return Path to the file.
- */
- IGNITE_FRIEND_EXPORT std::string FindJvmLibrary(const std::string* path, bool* found);
-
- /**
- * Load JVM library into the process.
- *
- * @param path Optional path to the library.
- * @return Whether load was successful.
- */
- IGNITE_FRIEND_EXPORT bool LoadJvmLibrary(const std::string& path);
-
- /**
- * Resolve IGNITE_HOME directory. Resolution is performed in several
- * steps:
- * 1) Check for path provided as argument.
- * 2) Check for environment variable.
- * 3) Check for current working directory.
- * Result of these 3 checks are evaluated based on existence of certain
- * predefined folders inside possible GG home. If they are found,
- * IGNITE_HOME is considered resolved.
- *
- * @param path Optional path to evaluate.
- * @param found Whether IGNITE_HOME home was found.
- * @return Resolved GG home.
- */
- IGNITE_FRIEND_EXPORT std::string ResolveIgniteHome(const std::string* path, bool* found);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @param test Whether test classpath must be used.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool test);
-
- /**
- * Safe array which automatically reclaims occupied memory when out of scope.
- */
- template<typename T>
- struct IGNITE_FRIEND_EXPORT SafeArray
- {
- /**
- * Constructor.
- */
- SafeArray(int cap)
- {
- target = new T[cap];
- }
-
- /**
- * Destructor.
- */
- ~SafeArray()
- {
- delete[] target;
- }
-
- IGNITE_NO_COPY_ASSIGNMENT(SafeArray);
-
- /** Target array. */
- T* target;
- };
- }
- }
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp b/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp
deleted file mode 100644
index ec45eb6..0000000
--- a/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp
+++ /dev/null
@@ -1,439 +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.
- */
-#include <sys/stat.h>
-#include <dirent.h>
-#include <dlfcn.h>
-
-#include "ignite/impl/utils.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- const char* JAVA_HOME = "JAVA_HOME";
- const char* JAVA_DLL = "/jre/lib/amd64/server/libjvm.so";
-
- const char* IGNITE_HOME = "IGNITE_HOME";
-
- const char* PROBE_BIN = "/bin";
- const char* PROBE_EXAMPLES = "/examples";
-
- const char* IGNITE_NATIVE_TEST_CLASSPATH = "IGNITE_NATIVE_TEST_CLASSPATH";
-
- /**
- * Helper method to set boolean result to reference with proper NULL-check.
- *
- * @param res Result.
- * @param outRes Where to set the result.
- */
- inline void SetBoolResult(bool res, bool* outRes)
- {
- if (outRes)
- *outRes = res;
- }
-
- /**
- * Check if string ends with the given ending.
- *
- * @param str String to check.
- * @param ending Ending.
- * @return Result.
- */
- inline bool StringEndsWith(const std::string& str, const std::string& ending)
- {
- if (str.length() > ending.length())
- return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
- return false;
- }
-
- /**
- * Helper function for GG home resolution. Checks whether certain folders
- * exist in the path. Optionally goes upwards in directory hierarchy.
- *
- * @param path Path to evaluate.
- * @param up Whether to go upwards.
- * @res Resolution result.
- * @return Resolved directory.
- */
- std::string ResolveIgniteHome0(const std::string& path, bool up, bool* res)
- {
- struct stat pathStat;
-
- if (stat(path.c_str(), &pathStat) != -1 && S_ISDIR(pathStat.st_mode))
- {
- // Remove trailing slashes, otherwise we will have an infinite loop.
- std::string path0 = path;
-
- while (true) {
- char lastChar = *path0.rbegin();
-
- if (lastChar == '/' || lastChar == ' ') {
- size_t off = path0.find_last_of(lastChar);
-
- path0.erase(off, 1);
- }
- else
- break;
- }
-
- std::string binStr = path0 + PROBE_BIN;
- struct stat binStat;
-
- std::string examplesStr = path0 + PROBE_EXAMPLES;
- struct stat examplesStat;
-
- if (stat(binStr.c_str(), &binStat) != -1 && S_ISDIR(binStat.st_mode) &&
- stat(examplesStr.c_str(), &examplesStat) != -1 && S_ISDIR(examplesStat.st_mode))
- {
- SetBoolResult(true, res);
-
- return std::string(path0);
- }
-
- if (up)
- {
- // Evaluate parent directory.
- size_t slashPos = path0.find_last_of("/");
-
- if (slashPos != std::string::npos)
- {
- std::string parent = path0.substr(0, slashPos);
-
- return ResolveIgniteHome0(parent, true, res);
- }
- }
-
- }
-
- SetBoolResult(false, res);
-
- return std::string();
- }
-
- /**
- * Create classpath picking JARs from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathJars(const std::string& path)
- {
- std::string res = std::string();
-
- DIR* dir = opendir(path.c_str());
-
- if (dir)
- {
- struct dirent* entry;
-
- while ((entry = readdir(dir)) != NULL)
- {
- if (strstr(entry->d_name, ".jar"))
- {
- res.append(path);
- res.append("/");
- res.append(entry->d_name);
- res.append(":");
- }
- }
-
- closedir(dir);
- }
-
- return res;
- }
-
- /**
- * Create classpath picking compiled classes from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathExploded(const std::string& path, bool down)
- {
- std::string res = std::string();
-
- if (FileExists(path))
- {
- // 1. Append "target\classes".
- std::string classesPath = path + "/target/classes";
-
- if (FileExists(classesPath)) {
- res += classesPath;
- res += ":";
- }
-
- // 2. Append "target\test-classes"
- std::string testClassesPath = path + "/target/test-classes";
-
- if (FileExists(testClassesPath)) {
- res += testClassesPath;
- res += ":";
- }
-
- // 3. Append "target\libs"
- std::string libsPath = path + "/target/libs";
-
- if (FileExists(libsPath)) {
- std::string libsCp = ClasspathJars(libsPath);
- res += libsCp;
- }
-
- // 4. Do the same for child if needed.
- if (down)
- {
- DIR* dir = opendir(path.c_str());
-
- if (dir)
- {
- struct dirent* entry;
-
- while ((entry = readdir(dir)) != NULL)
- {
- std::string entryPath = entry->d_name;
-
- if (entryPath.compare(".") != 0 && entryPath.compare("..") != 0)
- {
- std::string entryFullPath = path + "/" + entryPath;
-
- struct stat entryFullStat;
-
- if (stat(entryFullPath.c_str(), &entryFullStat) != -1 && S_ISDIR(entryFullStat.st_mode))
- {
- std::string childCp = ClasspathExploded(entryFullPath, false);
-
- res += childCp;
- }
- }
- }
-
- closedir(dir);
- }
- }
- }
-
- return res;
- }
-
- /**
- * Helper function to create classpath based on Ignite home directory.
- *
- * @param home Home directory; expected to be valid.
- * @param forceTest Force test classpath.
- */
- std::string CreateIgniteHomeClasspath(const std::string& home, bool forceTest)
- {
- std::string res = std::string();
-
- // 1. Add exploded test directories.
- if (forceTest)
- {
- std::string examplesPath = home + "/examples";
- std::string examplesCp = ClasspathExploded(examplesPath, true);
- res.append(examplesCp);
-
- std::string modulesPath = home + "/modules";
- std::string modulesCp = ClasspathExploded(modulesPath, true);
- res.append(modulesCp);
- }
-
- // 2. Add regular jars from "libs" folder excluding "optional".
- std::string libsPath = home + "/libs";
-
- if (FileExists(libsPath))
- {
- res.append(ClasspathJars(libsPath));
-
- // Append inner directories.
- DIR* dir = opendir(libsPath.c_str());
-
- if (dir)
- {
- struct dirent* entry;
-
- while ((entry = readdir(dir)) != NULL)
- {
- std::string entryPath = entry->d_name;
-
- if (entryPath.compare(".") != 0 && entryPath.compare("..") != 0 &&
- entryPath.compare("optional") != 0)
- {
- std::string entryFullPath = libsPath;
-
- entryFullPath.append("/");
- entryFullPath.append(entryPath);
-
- struct stat entryFullStat;
-
- if (stat(entryFullPath.c_str(), &entryFullStat) != -1 &&
- S_ISDIR(entryFullStat.st_mode))
- res.append(ClasspathJars(entryFullPath));
- }
- }
-
- closedir(dir);
- }
- }
-
- // 3. Return.
- return res;
- }
-
- char* CopyChars(const char* val)
- {
- if (val) {
- size_t len = strlen(val);
- char* dest = new char[len + 1];
- strcpy(dest, val);
- *(dest + len) = 0;
- return dest;
- }
- else
- return NULL;
- }
-
- void ReleaseChars(char* val)
- {
- if (val)
- delete[] val;
- }
-
- std::string GetEnv(const std::string& name, bool* found)
- {
- char* val = std::getenv(name.c_str());
-
- if (val) {
- SetBoolResult(true, found);
-
- return std::string(val);
- }
- else {
- SetBoolResult(false, found);
-
- return std::string();
- }
- }
-
- bool FileExists(const std::string& path)
- {
- struct stat s;
-
- int res = stat(path.c_str(), &s);
-
- return res != -1;
- }
-
- std::string FindJvmLibrary(const std::string* path, bool* found)
- {
- SetBoolResult(true, found); // Optimistically assume that we will find it.
-
- if (path) {
- // If path is provided explicitly, then check only it.
- if (FileExists(*path))
- return std::string(path->data());
- }
- else
- {
- bool javaEnvFound;
- std::string javaEnv = GetEnv(JAVA_HOME, &javaEnvFound);
-
- if (javaEnvFound)
- {
- std::string javaDll = javaEnv + JAVA_DLL;
-
- if (FileExists(javaDll))
- return std::string(javaDll);
- }
- }
-
- SetBoolResult(false, found);
-
- return std::string();
- }
-
- bool LoadJvmLibrary(const std::string& path)
- {
- void* hnd = dlopen(path.c_str(), RTLD_LAZY);
-
- return hnd != NULL;
- }
-
- std::string ResolveIgniteHome(const std::string* path, bool* found)
- {
- if (path)
- // 1. Check passed argument.
- return ResolveIgniteHome0(*path, false, found);
- else
- {
- // 2. Check environment variable.
- bool envFound;
- std::string env = GetEnv(IGNITE_HOME, &envFound);
-
- if (envFound)
- return ResolveIgniteHome0(env, false, found);
- }
-
- SetBoolResult(false, found);
-
- return std::string();
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home)
- {
- bool forceTest = false;
-
- if (home)
- {
- bool envFound;
- std::string env = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, &envFound);
-
- forceTest = envFound && env.compare("true") == 0;
- }
-
- return CreateIgniteClasspath(usrCp, home, forceTest);
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool forceTest)
- {
- // 1. Append user classpath if it exists.
- std::string cp = std::string();
-
- if (usrCp)
- {
- cp.append(*usrCp);
-
- if (*cp.rbegin() != ':')
- cp.append(":");
- }
-
- // 2. Append home classpath if home is defined.
- if (home)
- {
- std::string homeCp = CreateIgniteHomeClasspath(*home, forceTest);
-
- cp.append(homeCp);
- }
-
- // 3. Return.
- return cp;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h b/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h
deleted file mode 100644
index 08e76ee..0000000
--- a/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h
+++ /dev/null
@@ -1,155 +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_UTILS
-#define _IGNITE_UTILS
-
-#include <cstring>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#ifdef IGNITE_FRIEND
- #define IGNITE_FRIEND_EXPORT IGNITE_EXPORT
-#else
- #define IGNITE_FRIEND_EXPORT
-#endif
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- /**
- * Copy characters.
- *
- * @param val Value.
- * @return Result.
- */
- IGNITE_FRIEND_EXPORT char* CopyChars(const char* val);
-
- /**
- * Release characters.
- *
- * @param val Value.
- */
- IGNITE_FRIEND_EXPORT void ReleaseChars(char* val);
-
- /**
- * Read system environment variable taking thread-safety in count.
- *
- * @param name Environment variable name.
- * @param found Whether environment variable with such name was found.
- * @return Environment variable value.
- */
- IGNITE_FRIEND_EXPORT std::string GetEnv(const std::string& name, bool* found);
-
- /**
- * Ensure that file on the given path exists in the system.
- *
- * @param path Path.
- * @return True if file exists, false otherwise.
- */
- IGNITE_FRIEND_EXPORT bool FileExists(const std::string& path);
-
- /**
- * Attempts to find JVM library to load it into the process later.
- * First search is performed using the passed path argument (is not NULL).
- * Then JRE_HOME is evaluated. Last, JAVA_HOME is evaluated.
- *
- * @param Explicitly defined path (optional).
- * @param found Whether library was found.
- * @return Path to the file.
- */
- IGNITE_FRIEND_EXPORT std::string FindJvmLibrary(const std::string* path, bool* found);
-
- /**
- * Load JVM library into the process.
- *
- * @param path Optional path to the library.
- * @return Whether load was successful.
- */
- IGNITE_FRIEND_EXPORT bool LoadJvmLibrary(const std::string& path);
-
- /**
- * Resolve IGNITE_HOME directory. Resolution is performed in several
- * steps:
- * 1) Check for path provided as argument.
- * 2) Check for environment variable.
- * 3) Check for current working directory.
- * Result of these 3 checks are evaluated based on existence of certain
- * predefined folders inside possible GG home. If they are found,
- * IGNITE_HOME is considered resolved.
- *
- * @param path Optional path to evaluate.
- * @param found Whether IGNITE_HOME home was found.
- * @return Resolved GG home.
- */
- IGNITE_FRIEND_EXPORT std::string ResolveIgniteHome(const std::string* path, bool* found);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @param test Whether test classpath must be used.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool test);
-
- /**
- * Safe array which automatically reclaims occupied memory when out of scope.
- */
- template<typename T>
- struct IGNITE_FRIEND_EXPORT SafeArray
- {
- /** Target array. */
- T* target;
-
- /**
- * Constructor.
- */
- SafeArray(int cap)
- {
- target = new T[cap];
- }
-
- /**
- * Destructor.
- */
- ~SafeArray()
- {
- delete[] target;
- }
-
- IGNITE_NO_COPY_ASSIGNMENT(SafeArray);
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp b/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp
deleted file mode 100644
index 5a450c3..0000000
--- a/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp
+++ /dev/null
@@ -1,453 +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.
- */
-
-#include <windows.h>
-
-#include "ignite/impl/utils.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- const char* JAVA_HOME = "JAVA_HOME";
- const char* JAVA_DLL = "\\jre\\bin\\server\\jvm.dll";
-
- const char* IGNITE_HOME = "IGNITE_HOME";
-
- const char* PROBE_BIN = "\\bin";
- const char* PROBE_EXAMPLES = "\\examples";
-
- const char* IGNITE_NATIVE_TEST_CLASSPATH = "IGNITE_NATIVE_TEST_CLASSPATH";
-
- /**
- * Helper method to set boolean result to reference with proper NULL-check.
- *
- * @param res Result.
- * @param outRes Where to set the result.
- */
- inline void SetBoolResult(bool res, bool* outRes)
- {
- if (outRes)
- *outRes = res;
- }
-
- /**
- * Check if string ends with the given ending.
- *
- * @param str String to check.
- * @param ending Ending.
- * @return Result.
- */
- inline bool StringEndsWith(const std::string& str, const std::string& ending)
- {
- if (str.length() > ending.length())
- return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
- return false;
- }
-
- /**
- * Helper function for GG home resolution. Checks whether certain folders
- * exist in the path. Optionally goes upwards in directory hierarchy.
- *
- * @param path Path to evaluate.
- * @param up Whether to go upwards.
- * @res Resolution result.
- * @return Resolved directory.
- */
- std::string ResolveIgniteHome0(const std::string& path, bool up, bool* res)
- {
- DWORD attrs = GetFileAttributesA(path.c_str());
-
- if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
- {
- // Remove trailing slashes, otherwise we will have an infinite loop.
- std::string path0 = path;
-
- while (true) {
- char lastChar = *path0.rbegin();
-
- if (lastChar == '/' || lastChar == '\\' || lastChar == ' ') {
- size_t off = path0.find_last_of(lastChar);
-
- path0.erase(off, 1);
- }
- else
- break;
- }
-
- std::string binStr = path0 + PROBE_BIN;
- DWORD binAttrs = GetFileAttributesA(binStr.c_str());
-
- std::string examplesStr = path0 + PROBE_EXAMPLES;
- DWORD examplesAttrs = GetFileAttributesA(examplesStr.c_str());
-
- if (binAttrs != INVALID_FILE_ATTRIBUTES && (binAttrs & FILE_ATTRIBUTE_DIRECTORY) &&
- examplesAttrs != INVALID_FILE_ATTRIBUTES && (examplesAttrs & FILE_ATTRIBUTE_DIRECTORY))
- {
- SetBoolResult(true, res);
- return std::string(path0);
- }
-
- if (up)
- {
- // Evaluate parent directory.
- size_t slashPos = path0.find_last_of("/\\");
-
- if (slashPos != std::string::npos)
- {
- std::string parent = path0.substr(0, slashPos);
-
- return ResolveIgniteHome0(parent, true, res);
- }
- }
- }
-
- SetBoolResult(false, res);
-
- return std::string();
- }
-
- /**
- * Create classpath picking JARs from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathJars(const std::string& path)
- {
- std::string searchPath = path + "\\*.jar";
-
- std::string res = std::string();
-
- WIN32_FIND_DATAA findData;
-
- HANDLE hnd = FindFirstFileA(searchPath.c_str(), &findData);
-
- if (hnd != INVALID_HANDLE_VALUE)
- {
- do
- {
- res.append(path);
- res.append("\\");
- res.append(findData.cFileName);
- res.append(";");
- } while (FindNextFileA(hnd, &findData) != 0);
-
- FindClose(hnd);
- }
-
- return res;
- }
-
- /**
- * Create classpath picking compiled classes from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathExploded(const std::string& path, bool down)
- {
- std::string res = std::string();
-
- if (FileExists(path))
- {
- // 1. Append "target\classes".
- std::string classesPath = path + "\\target\\classes";
-
- if (FileExists(classesPath)) {
- res.append(classesPath);
- res.append(";");
- }
-
- // 2. Append "target\test-classes"
- std::string testClassesPath = path + "\\target\\test-classes";
-
- if (FileExists(testClassesPath)) {
- res.append(testClassesPath);
- res.append(";");
- }
-
- // 3. Append "target\libs"
- std::string libsPath = path + "\\target\\libs";
-
- if (FileExists(libsPath)) {
- std::string libsCp = ClasspathJars(libsPath);
- res.append(libsCp);
- }
-
- // 4. Do the same for child if needed.
- if (down)
- {
- std::string searchPath = path + "\\*";
-
- WIN32_FIND_DATAA findData;
-
- HANDLE hnd = FindFirstFileA(searchPath.c_str(), &findData);
-
- if (hnd != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- std::string childPath = findData.cFileName;
-
- if (childPath.compare(".") != 0 &&
- childPath.compare("..") != 0)
- {
- std::string childCp =
- ClasspathExploded(path + "\\" + childPath, false);
-
- res.append(childCp);
- }
- }
- } while (FindNextFileA(hnd, &findData) != 0);
-
- FindClose(hnd);
- }
- }
- }
-
- return res;
- }
-
- /**
- * Helper function to create classpath based on Ignite home directory.
- *
- * @param home Home directory; expected to be valid.
- * @param forceTest Force test classpath.
- */
- std::string CreateIgniteHomeClasspath(const std::string& home, bool forceTest)
- {
- std::string res = std::string();
-
- // 1. Add exploded test directories.
- if (forceTest)
- {
- std::string examplesPath = home + "\\examples";
- std::string examplesCp = ClasspathExploded(examplesPath, true);
- res.append(examplesCp);
-
- std::string modulesPath = home + "\\modules";
- std::string modulesCp = ClasspathExploded(modulesPath, true);
- res.append(modulesCp);
- }
-
- // 2. Add regular jars from "libs" folder excluding "optional".
- std::string libsPath = home + "\\libs";
-
- if (FileExists(libsPath))
- {
- res.append(ClasspathJars(libsPath));
-
- // Append inner directories.
- std::string libsSearchPath = libsPath + "\\*";
-
- WIN32_FIND_DATAA libsFindData;
-
- HANDLE libsHnd = FindFirstFileA(libsSearchPath.c_str(), &libsFindData);
-
- if (libsHnd != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (libsFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- std::string libsChildPath = libsFindData.cFileName;
-
- if (libsChildPath.compare(".") != 0 &&
- libsChildPath.compare("..") != 0 &&
- libsChildPath.compare("optional") != 0) {
- std::string libsFolder = libsPath + "\\" + libsChildPath;
-
- res.append(ClasspathJars(libsFolder));
- }
- }
- } while (FindNextFileA(libsHnd, &libsFindData) != 0);
-
- FindClose(libsHnd);
- }
- }
-
- // 3. Return.
- return res;
- }
-
- char* CopyChars(const char* val)
- {
- if (val) {
- size_t len = strlen(val);
- char* dest = new char[len + 1];
- strcpy(dest, val);
- *(dest + len) = 0;
- return dest;
- }
- else
- return NULL;
- }
-
- void ReleaseChars(char* val)
- {
- if (val)
- delete[] val;
- }
-
- std::string GetEnv(const std::string& name, bool* found)
- {
- char res0[32767];
-
- DWORD envRes = GetEnvironmentVariableA(name.c_str(), res0, 32767);
-
- if (envRes != 0)
- {
- SetBoolResult(true, found);
-
- return std::string(res0);
- }
- else
- {
- SetBoolResult(false, found);
-
- return std::string();
- }
- }
-
- bool FileExists(const std::string& path)
- {
- WIN32_FIND_DATAA findres;
-
- HANDLE hnd = FindFirstFileA(path.c_str(), &findres);
-
- if (hnd == INVALID_HANDLE_VALUE)
- return false;
- else
- {
- FindClose(hnd);
-
- return true;
- }
- }
-
- std::string FindJvmLibrary(const std::string* path, bool* found)
- {
- SetBoolResult(true, found); // Optimistically assume that we will find it.
-
- if (path) {
- // If path is provided explicitly, then check only it.
- if (FileExists(*path))
- return std::string(path->data());
- }
- else
- {
- bool javaEnvFound;
- std::string javaEnv = GetEnv(JAVA_HOME, &javaEnvFound);
-
- if (javaEnvFound)
- {
- std::string javaDll = javaEnv + JAVA_DLL;
-
- if (FileExists(javaDll))
- return std::string(javaDll);
- }
- }
-
- *found = false;
-
- return std::string();
- }
-
- bool LoadJvmLibrary(const std::string& path)
- {
- HMODULE mod = LoadLibraryA(path.c_str());
-
- return mod != NULL;
- }
-
- std::string ResolveIgniteHome(const std::string* path, bool* found)
- {
- if (path)
- // 1. Check passed argument.
- return ResolveIgniteHome0(*path, false, found);
- else
- {
- // 2. Check environment variable.
- bool envFound;
- std::string env = GetEnv(IGNITE_HOME, &envFound);
-
- if (envFound)
- return ResolveIgniteHome0(env, false, found);
-
- // 3. Check current work dir.
- const DWORD curDirLen = GetCurrentDirectory(0, NULL);
-
- char* curDir = new char[curDirLen];
-
- GetCurrentDirectoryA(curDirLen, curDir);
-
- std::string curDirStr = curDir;
-
- delete[] curDir;
-
- return ResolveIgniteHome0(curDirStr, true, found);
- }
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home)
- {
- bool forceTest = false;
-
- if (home)
- {
- bool envFound;
- std::string env = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, &envFound);
-
- forceTest = envFound && env.compare("true") == 0;
- }
-
- return CreateIgniteClasspath(usrCp, home, forceTest);
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool forceTest)
- {
- // 1. Append user classpath if it exists.
- std::string cp = std::string();
-
- if (usrCp)
- {
- cp.append(*usrCp);
-
- if (*cp.rbegin() != ';')
- cp.append(";");
- }
-
- // 2. Append home classpath if home is defined.
- if (home)
- {
- std::string homeCp = CreateIgniteHomeClasspath(*home, forceTest);
-
- cp.append(homeCp);
- }
-
- // 3. Return.
- return cp;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/README.TXT b/modules/platform/src/main/cpp/core/project/README.TXT
deleted file mode 100644
index 97f4c64..0000000
--- a/modules/platform/src/main/cpp/core/project/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains IDE projects artifacts.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/README.TXT b/modules/platform/src/main/cpp/core/project/vs/README.TXT
deleted file mode 100644
index f4fb456..0000000
--- a/modules/platform/src/main/cpp/core/project/vs/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains Visual Studio project artifacts.
\ No newline at end of file