You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/02/21 17:40:41 UTC
[28/31] geode-native git commit: GEODE-2476: Replace gfcpp with geode.
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableDate.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableDate.hpp b/src/cppcache/include/geode/CacheableDate.hpp
new file mode 100644
index 0000000..c0498df
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableDate.hpp
@@ -0,0 +1,190 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEDATE_H_
+#define GEODE_CACHEABLEDATE_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "CacheableKey.hpp"
+#include "CacheableString.hpp"
+#include "GeodeTypeIds.hpp"
+#include "ExceptionTypes.hpp"
+
+#include <string>
+#include <chrono>
+#include <ctime>
+
+/** @file
+*/
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * Implement a date object based on epoch of January 1, 1970 00:00:00 GMT that
+ * can serve as a distributable key object for caching as well as being a date
+ * value.
+ */
+class CPPCACHE_EXPORT CacheableDate : public CacheableKey {
+ private:
+ /**
+ * Milliseconds since January 1, 1970, 00:00:00 GMT to be consistent with Java
+ * Date.
+ */
+ int64_t m_timevalue;
+
+ public:
+ typedef std::chrono::system_clock clock;
+ typedef std::chrono::time_point<clock> time_point;
+ typedef std::chrono::milliseconds duration;
+
+ /**
+ * @brief serialize this object
+ **/
+ virtual void toData(DataOutput& output) const;
+
+ /**
+ * @brief deserialize this object
+ **/
+ virtual Serializable* fromData(DataInput& input);
+
+ /**
+ * @brief creation function for dates.
+ */
+ static Serializable* createDeserializable();
+
+ /**
+ * @brief Return the classId of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int32_t classId() const;
+
+ /**
+ *@brief return the typeId byte of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int8_t typeId() const;
+
+ /** @return the size of the object in bytes */
+ virtual uint32_t objectSize() const { return sizeof(CacheableDate); }
+
+ /** @return true if this key matches other. */
+ virtual bool operator==(const CacheableKey& other) const;
+
+ /**
+ * @return day of the month.
+ * @deprecated Use localtime or similar for calendar conversions.
+ */
+ __DEPRECATED__("Use localtime or similar for calendar conversions.")
+ virtual int day() const;
+
+ /**
+ * @return month 1(Jan) - 12(Dec) .
+ * @deprecated Use localtime or similar for calendar conversions.
+ */
+ __DEPRECATED__("Use localtime or similar for calendar conversions.")
+ virtual int month() const;
+
+ /**
+ * @return year, example 1999.
+ * @deprecated Use localtime or similar for calendar conversions.
+ */
+ __DEPRECATED__("Use localtime or similar for calendar conversions.")
+ virtual int year() const;
+
+ /** @return milliseconds elapsed since January 1, 1970, 00:00:00 GMT. */
+ virtual int64_t milliseconds() const;
+
+ /**
+ * Returns a hash code value for this object. The result is the exclusive OR
+ * of the two halves of the primitive long value returned by the
+ * milliseconds() method.
+ *
+ * @return the hashcode for this object. */
+ virtual uint32_t hashcode() const;
+
+ operator time_t() const { return m_timevalue / 1000; }
+ operator time_point() const {
+ return clock::from_time_t(0) + duration(m_timevalue);
+ }
+ operator duration() const { return duration(m_timevalue); }
+
+ /**
+ * Factory method for creating an instance of CacheableDate
+ */
+ static CacheableDatePtr create() {
+ return CacheableDatePtr(new CacheableDate());
+ }
+
+ static CacheableDatePtr create(const time_t& value) {
+ return CacheableDatePtr(new CacheableDate(value));
+ }
+
+ static CacheableDatePtr create(const time_point& value) {
+ return CacheableDatePtr(new CacheableDate(value));
+ }
+
+ static CacheableDatePtr create(const duration& value) {
+ return CacheableDatePtr(new CacheableDate(value));
+ }
+
+ virtual CacheableStringPtr toString() const;
+
+ /** Destructor */
+ virtual ~CacheableDate();
+
+ /** used to render as a string for logging. */
+ virtual int32_t logString(char* buffer, int32_t maxLength) const;
+
+ protected:
+ /** Constructor, used for deserialization. */
+ CacheableDate(const time_t value = 0);
+
+ /**
+ * Construct from std::chrono::time_point<std::chrono::system_clock>.
+ */
+ CacheableDate(const time_point& value);
+
+ /**
+ * Construct from std::chrono::seconds since POSIX epoch.
+ */
+ CacheableDate(const duration& value);
+
+ private:
+ // never implemented.
+ void operator=(const CacheableDate& other);
+ CacheableDate(const CacheableDate& other);
+};
+
+inline CacheableKeyPtr createKey(const CacheableDate::time_point& value) {
+ return CacheableKeyPtr(CacheableDate::create(value));
+}
+
+inline CacheablePtr createValue(const CacheableDate::time_point& value) {
+ return CacheablePtr(CacheableDate::create(value));
+}
+
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEDATE_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableEnum.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableEnum.hpp b/src/cppcache/include/geode/CacheableEnum.hpp
new file mode 100644
index 0000000..de456e0
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableEnum.hpp
@@ -0,0 +1,146 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEENUM_H_
+#define GEODE_CACHEABLEENUM_H_
+
+/*
+ * 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 "CacheableKey.hpp"
+#include "CacheableString.hpp"
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+* Since C++ enums cannot be directly passed as a parameter to PdxWriter's
+* writeObject and PdxReader's readObject api
+* wrap C++ enum in to a immutable wrapper CacheableEnum class type by specifying
+* enum class name, enum value name and its ordinal.
+* C++ enum allows explicit setting of ordinal number, but it is up to the user
+* to map java enumName with that of C++ enumName.
+* Currently this wrapper only works as part of PdxSerializable member object and
+* cannot be directly used in Region operations.
+*
+* @see PdxWriter#writeObject
+* @see PdxReader#readObject
+*/
+
+class CPPCACHE_EXPORT CacheableEnum : public CacheableKey {
+ private:
+ CacheableStringPtr m_enumClassName;
+ CacheableStringPtr m_enumName;
+ int32_t m_ordinal;
+ mutable int32_t m_hashcode;
+
+ public:
+ /** Destructor */
+ ~CacheableEnum();
+
+ /**
+ * @brief creation function for enum.
+ */
+ static Serializable* createDeserializable() { return new CacheableEnum(); }
+ /**
+ * @brief serialize this object
+ **/
+ virtual void toData(DataOutput& output) const;
+
+ /**
+ * @brief deserialize this object
+ **/
+ virtual Serializable* fromData(DataInput& input);
+
+ /** @return the size of the object in bytes */
+ virtual uint32_t objectSize() const {
+ uint32_t size = sizeof(CacheableEnum);
+ size += static_cast<uint32_t>(sizeof(int32_t));
+ size += m_enumClassName->objectSize();
+ size += m_enumName->objectSize();
+ return size;
+ }
+
+ /**
+ * @brief Return the classId of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int32_t classId() const { return 0; }
+
+ /**
+ * @brief return the typeId byte of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int8_t typeId() const {
+ // return 0;
+ return static_cast<int8_t>(GeodeTypeIds::CacheableEnum);
+ }
+
+ /**
+ * Display this object as c string.
+ */
+ virtual CacheableStringPtr toString() const {
+ return CacheableString::create("CacheableEnum");
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableEnum.
+ * @param className the name of the enum class that maps to the java enum type.
+ * @param enumName the name of the enum constant that maps to the java enum
+ * type.
+ * @param ordinal the ordinal value of the enum constant that maps to the java
+ * enum type.
+ * @return a {@link CacheableEnum} representing C++ enum.
+ */
+ static CacheableEnumPtr create(const char* enumClassName,
+ const char* enumName, int32_t ordinal) {
+ CacheableEnumPtr str(new CacheableEnum(enumClassName, enumName, ordinal));
+ return str;
+ }
+
+ /**@return enum class name. */
+ const char* getEnumClassName() const { return m_enumClassName->asChar(); }
+
+ /**@return enum name. */
+ const char* getEnumName() const { return m_enumName->asChar(); }
+
+ /**@return enum ordinal. */
+ int32_t getEnumOrdinal() const { return m_ordinal; }
+
+ /** @return the hashcode for this key. */
+ virtual uint32_t hashcode() const;
+
+ /** @return true if this key matches other. */
+ virtual bool operator==(const CacheableKey& other) const;
+
+ protected:
+ CacheableEnum();
+ CacheableEnum(const char* enumClassName, const char* enumName,
+ int32_t ordinal);
+
+ private:
+ // never implemented.
+ void operator=(const CacheableEnum& other);
+ CacheableEnum(const CacheableEnum& other);
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEENUM_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableFileName.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableFileName.hpp b/src/cppcache/include/geode/CacheableFileName.hpp
new file mode 100644
index 0000000..d4da896
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableFileName.hpp
@@ -0,0 +1,121 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEFILENAME_H_
+#define GEODE_CACHEABLEFILENAME_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "CacheableKey.hpp"
+#include "CacheableString.hpp"
+
+/** @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+/**
+ * Implement an immutable wrapper for filenames that can serve as a
+ * distributable filename object for caching as both key and value.
+ */
+class CPPCACHE_EXPORT CacheableFileName : public CacheableString {
+ public:
+ /**
+ *@brief serialize this object
+ **/
+ virtual void toData(DataOutput& output) const;
+
+ /**
+ *@brief deserialize this object
+ * Throw IllegalArgumentException if the packed CacheableString is not less
+ * than 64K bytes.
+ **/
+ virtual Serializable* fromData(DataInput& input);
+
+ /**
+ *@brief Return the classId of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int32_t classId() const;
+
+ /**
+ *@brief return the typeId byte of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int8_t typeId() const;
+
+ /**
+ * @brief creation function for filenames.
+ */
+ static Serializable* createDeserializable() {
+ return new CacheableFileName();
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableFileName from a
+ * C string optionally given the length.
+ */
+ static CacheableFileNamePtr create(const char* value, int32_t len = 0) {
+ CacheableFileNamePtr str = NULLPTR;
+ if (value != NULL) {
+ str = new CacheableFileName();
+ str->initString(value, len);
+ }
+ return str;
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableFileName from a
+ * wide-character C string optionally given the length.
+ */
+ static CacheableFileNamePtr create(const wchar_t* value, int32_t len = 0) {
+ CacheableFileNamePtr str = NULLPTR;
+ if (value != NULL) {
+ str = new CacheableFileName();
+ str->initString(value, len);
+ }
+ return str;
+ }
+
+ /** get the name of the class of this object for logging purpose */
+ virtual const char* className() const { return "CacheableFileName"; }
+
+ /** return the hashcode for this key. */
+ virtual uint32_t hashcode() const;
+
+ protected:
+ /** Default constructor. */
+ inline CacheableFileName() : CacheableString(), m_hashcode(0) {}
+
+ private:
+ // never implemented.
+ void operator=(const CacheableFileName& other);
+ CacheableFileName(const CacheableFileName& other);
+
+ private:
+ mutable int m_hashcode;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEFILENAME_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableKey.hpp b/src/cppcache/include/geode/CacheableKey.hpp
new file mode 100644
index 0000000..3c00dea
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableKey.hpp
@@ -0,0 +1,87 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEKEY_H_
+#define GEODE_CACHEABLEKEY_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "Cacheable.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/** Represents a cacheable key */
+class CPPCACHE_EXPORT CacheableKey : public Cacheable {
+ protected:
+ /** Constructor */
+ CacheableKey() : Cacheable() {}
+
+ /** Destructor */
+ virtual ~CacheableKey() {}
+
+ public:
+ /** return true if this key matches other. */
+ virtual bool operator==(const CacheableKey& other) const = 0;
+
+ /** return the hashcode for this key. */
+ virtual uint32_t hashcode() const = 0;
+
+ /** Copy the string form of a key into a char* buffer for logging purposes.
+ *
+ * Implementations should only generate a string as long as maxLength chars,
+ * and return the number of chars written. buffer is expected to be large
+ * enough to hold at least maxLength chars.
+ *
+ * The default implementation renders the classname and instance address.
+ */
+ virtual int32_t logString(char* buffer, int32_t maxLength) const;
+
+ /**
+ * Factory method that creates the key type that matches the type of value.
+ *
+ * For customer defined derivations of CacheableKey, the method
+ * apache::geode::client::createKey may be overloaded. For pointer types (e.g.
+ * char*)
+ * the method apache::geode::client::createKeyArr may be overloaded.
+ */
+ template <class PRIM>
+ inline static CacheableKeyPtr create(const PRIM value);
+
+ private:
+ // Never defined.
+ CacheableKey(const CacheableKey& other);
+ void operator=(const CacheableKey& other);
+};
+
+template <class TKEY>
+inline CacheableKeyPtr createKey(const SharedPtr<TKEY>& value);
+
+template <typename TKEY>
+inline CacheableKeyPtr createKey(const TKEY* value);
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEKEY_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableKey.inl
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableKey.inl b/src/cppcache/include/geode/CacheableKey.inl
new file mode 100644
index 0000000..180bffb
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableKey.inl
@@ -0,0 +1,55 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEKEY_INL_
+#define GEODE_CACHEABLEKEY_INL_
+
+/*
+ * 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 "CacheableKey.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+template< class PRIM >
+inline CacheableKeyPtr CacheableKey::create( const PRIM value )
+{
+ return createKey( value );
+}
+
+template <class TKEY>
+inline CacheableKeyPtr createKey( const SharedPtr< TKEY >& value )
+{
+ return CacheableKeyPtr( value );
+}
+
+template <typename TKEY>
+inline CacheableKeyPtr createKey( const TKEY* value )
+{
+ return createKeyArr( value );
+}
+
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEKEY_INL_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableKeys.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableKeys.hpp b/src/cppcache/include/geode/CacheableKeys.hpp
new file mode 100644
index 0000000..195ed32
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableKeys.hpp
@@ -0,0 +1,99 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEKEYS_H_
+#define GEODE_CACHEABLEKEYS_H_
+
+/*
+ * 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 "geode_globals.hpp"
+
+namespace apache {
+namespace geode {
+namespace client {
+namespace serializer {
+
+template <typename TObj>
+inline bool equals(const TObj& x, const TObj& y) {
+ return (x == y);
+}
+
+inline uint32_t hashcode(const bool value) {
+ if (value) {
+ return 1231;
+ } else {
+ return 1237;
+ }
+}
+
+inline uint32_t hashcode(const uint8_t value) {
+ return static_cast<uint32_t>(value);
+}
+
+inline uint32_t hashcode(const int8_t value) {
+ return static_cast<uint32_t>(value);
+}
+
+inline uint32_t hashcode(const uint16_t value) {
+ return static_cast<uint32_t>(value);
+}
+
+inline uint32_t hashcode(const int16_t value) {
+ return static_cast<uint32_t>(value);
+}
+
+inline uint32_t hashcode(const uint32_t value) { return value; }
+
+inline uint32_t hashcode(const int32_t value) {
+ return static_cast<uint32_t>(value);
+}
+
+inline uint32_t hashcode(const uint64_t value) {
+ uint32_t hash = static_cast<uint32_t>(value);
+ hash = hash ^ static_cast<uint32_t>(value >> 32);
+ return hash;
+}
+
+inline uint32_t hashcode(const int64_t value) {
+ uint32_t hash = static_cast<uint32_t>(value);
+ hash = hash ^ static_cast<uint32_t>(value >> 32);
+ return hash;
+}
+
+inline uint32_t hashcode(const float value) {
+ union float_uint32_t {
+ float f;
+ uint32_t u;
+ } v;
+ v.f = value;
+ return v.u;
+}
+
+inline uint32_t hashcode(const double value) {
+ union double_uint64_t {
+ double d;
+ uint64_t u;
+ } v;
+ v.d = value;
+ return hashcode(v.u);
+}
+} // namespace serializer
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEKEYS_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableObjectArray.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableObjectArray.hpp b/src/cppcache/include/geode/CacheableObjectArray.hpp
new file mode 100644
index 0000000..850fc61
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableObjectArray.hpp
@@ -0,0 +1,106 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEOBJECTARRAY_H_
+#define GEODE_CACHEABLEOBJECTARRAY_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "VectorT.hpp"
+
+/** @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * Implement an immutable Vector of <code>Cacheable</code> objects
+ * that can serve as a distributable object for caching.
+ */
+class CPPCACHE_EXPORT CacheableObjectArray : public Cacheable,
+ public _VectorOfCacheable {
+ public:
+ typedef _VectorOfCacheable::Iterator Iterator;
+
+ /**
+ *@brief serialize this object
+ **/
+ virtual void toData(DataOutput& output) const;
+
+ /**
+ *@brief deserialize this object
+ **/
+ virtual Serializable* fromData(DataInput& input);
+
+ /**
+ * @brief creation function for java Object[]
+ */
+ inline static Serializable* createDeserializable() {
+ return new CacheableObjectArray();
+ }
+
+ /**
+ *@brief Return the classId of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int32_t classId() const;
+
+ /**
+ *@brief return the typeId byte of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int8_t typeId() const;
+
+ /**
+ * Factory method for creating the default instance of CacheableObjectArray.
+ */
+ inline static CacheableObjectArrayPtr create() {
+ return CacheableObjectArrayPtr(new CacheableObjectArray());
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableObjectArray with
+ * given size.
+ */
+ inline static CacheableObjectArrayPtr create(int32_t n) {
+ return CacheableObjectArrayPtr(new CacheableObjectArray(n));
+ }
+
+ virtual uint32_t objectSize() const;
+
+ protected:
+ /** Constructor, used for deserialization. */
+ inline CacheableObjectArray() : _VectorOfCacheable() {}
+ /** Create a vector with n elements allocated. */
+ inline CacheableObjectArray(int32_t n) : _VectorOfCacheable(n) {}
+
+ private:
+ // never implemented.
+ CacheableObjectArray& operator=(const CacheableObjectArray& other);
+ CacheableObjectArray(const CacheableObjectArray& other);
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEOBJECTARRAY_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableString.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableString.hpp b/src/cppcache/include/geode/CacheableString.hpp
new file mode 100644
index 0000000..9c833f7
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableString.hpp
@@ -0,0 +1,310 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLESTRING_H_
+#define GEODE_CACHEABLESTRING_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "CacheableKey.hpp"
+#include "GeodeTypeIds.hpp"
+#include "ExceptionTypes.hpp"
+
+/** @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+#define GF_STRING (int8_t) GeodeTypeIds::CacheableASCIIString
+#define GF_STRING_HUGE (int8_t) GeodeTypeIds::CacheableASCIIStringHuge
+#define GF_WIDESTRING (int8_t) GeodeTypeIds::CacheableString
+#define GF_WIDESTRING_HUGE (int8_t) GeodeTypeIds::CacheableStringHuge
+
+/**
+ * Implement a immutable C string wrapper that can serve as a distributable
+ * key object for caching as well as being a string value.
+ */
+class CPPCACHE_EXPORT CacheableString : public CacheableKey {
+ protected:
+ void* m_str;
+ int8_t m_type;
+ uint32_t m_len;
+ mutable int m_hashcode;
+
+ public:
+ /**
+ *@brief serialize this object
+ **/
+ virtual void toData(DataOutput& output) const;
+
+ /**
+ *@brief deserialize this object
+ * Throw IllegalArgumentException if the packed CacheableString is not less
+ * than 64K bytes.
+ **/
+ virtual Serializable* fromData(DataInput& input);
+
+ /** creation function for strings */
+ static Serializable* createDeserializable();
+
+ /** creation function for strings > 64K length */
+ static Serializable* createDeserializableHuge();
+
+ /** creation function for wide strings */
+ static Serializable* createUTFDeserializable();
+
+ /** creation function for wide strings > 64K length in UTF8 encoding */
+ static Serializable* createUTFDeserializableHuge();
+
+ /**
+ *@brief Return the classId of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int32_t classId() const;
+
+ /**
+ * Return the typeId byte of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ *
+ * For a <code>CacheableString</code> this shall return
+ * <code>GeodeTypeIds::CacheableNullString</code> if the underlying
+ * string is null, <code>GeodeTypeIds::CacheableASCIIString</code>
+ * if the underlying string is a char*, and
+ * <code>GeodeTypeIds::CacheableString</code> if it is a wchar_t*.
+ * For strings larger than 64K it will return
+ * <code>GeodeTypeIds::CacheableASCIIStringHuge</code> and
+ * <code>GeodeTypeIds::CacheableStringHuge</code> for char* and wchar_t*
+ * respectively.
+ */
+ virtual int8_t typeId() const;
+
+ /** return true if this key matches other. */
+ virtual bool operator==(const CacheableKey& other) const;
+
+ /** return the hashcode for this key. */
+ virtual uint32_t hashcode() const;
+
+ /**
+ * Factory method for creating an instance of CacheableString from
+ * a null terminated C string optionally giving the length.
+ *
+ * This should be used only for ASCII strings.
+ */
+ static CacheableStringPtr create(const char* value, int32_t len = 0) {
+ CacheableStringPtr str = NULLPTR;
+ if (value != NULL) {
+ str = new CacheableString();
+ str->initString(value, len);
+ }
+ return str;
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableString from
+ * a C string of given length by taking ownership of the string without
+ * making a copy. The string should have been allocated using
+ * the standard C++ new operator.
+ *
+ * This should be used only for ASCII strings.
+ *
+ * CAUTION: use this only when you really know what you are doing.
+ */
+ static CacheableStringPtr createNoCopy(char* value, int32_t len = 0) {
+ CacheableStringPtr str = NULLPTR;
+ if (value != NULL) {
+ str = new CacheableString();
+ str->initStringNoCopy(value, len);
+ }
+ return str;
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableString from a
+ * wide-character null terminated C string optionally giving the length.
+ *
+ * This should be used for non-ASCII strings.
+ */
+ static CacheableStringPtr create(const wchar_t* value, int32_t len = 0) {
+ CacheableStringPtr str = NULLPTR;
+ if (value != NULL) {
+ str = new CacheableString();
+ str->initString(value, len);
+ }
+ return str;
+ }
+
+ /**
+ * Factory method for creating an instance of CacheableString from a
+ * wide-character C string of given length by taking ownership of the
+ * string without making a copy. The string should have been allocated
+ * using the standard C++ new operator.
+ *
+ * This should be used for non-ASCII strings.
+ *
+ * CAUTION: use this only when you really know what you are doing.
+ */
+ static CacheableStringPtr createNoCopy(wchar_t* value, int32_t len = 0) {
+ CacheableStringPtr str = NULLPTR;
+ if (value != NULL) {
+ str = new CacheableString();
+ str->initStringNoCopy(value, len);
+ }
+ return str;
+ }
+
+ /** Returns true if the underlying string is a normal C string. */
+ inline bool isCString() const {
+ return (m_type == GF_STRING || m_type == GF_STRING_HUGE);
+ }
+
+ /** Returns true if the underlying string is a wide-character string. */
+ inline bool isWideString() const {
+ return (m_type == GF_WIDESTRING || m_type == GF_WIDESTRING_HUGE);
+ }
+
+ /**
+ * Return the string that backs this CacheableString as a char *. This
+ * shall throw an exception if the underlying string is a wchar_t* --
+ * the caller should use <code>typeId</code> to determine the actual type,
+ * or <code>isWideString</code> to find whether this is a wide-character
+ * string.
+ *
+ * @throws IllegalStateException if the underlying string is a wchar_t *
+ */
+ const char* asChar() const {
+ if (isWideString()) {
+ throw IllegalStateException(
+ "CacheableString::asChar: the string is a "
+ "wide character string; use asWChar() to obtain it.");
+ }
+ return reinterpret_cast<const char*>(m_str);
+ }
+
+ /**
+ * Return the string that backs this CacheableString as a wchar_t *. This
+ * shall throw an exception if the underlying string is a char* --
+ * the caller should use <code>typeId</code> to determine the actual type,
+ * or <code>isWideString</code> to find whether this is indeed a
+ * wide-character string.
+ *
+ * @throws IllegalStateException if the underlying string is a char *
+ */
+ const wchar_t* asWChar() const {
+ if (isCString()) {
+ throw IllegalStateException(
+ "CacheableString::asWChar: the string is "
+ "not a wide character string; use asChar() to obtain it.");
+ }
+ return reinterpret_cast<const wchar_t*>(m_str);
+ }
+
+ /** Return the length of the contained string. */
+ inline uint32_t length() const { return m_len; }
+
+ /**
+ * Display this object as c string. In this case, it returns the same
+ * value as asChar() when underlying type is a char* and returns the same
+ * value as asWChar() cast to char* when the underlying type is a wchar_t*.
+ * To handle this correctly the user should find the actual type by calling
+ * typeId() or isWideString() and cast to the correct type accordingly.
+ * Note: this is a debugging API, not intended for getting the exact value
+ * of the CacheableString. In a future release this may return a more
+ * summary representation. This is historical. It is preferred that the
+ * user call logString or asChar/asWChar, depending on the need.
+ */
+ const char* toString() { return reinterpret_cast<const char*>(m_str); }
+
+ virtual CacheableStringPtr toString() const {
+ return CacheableStringPtr(this);
+ }
+
+ /** get the name of the class of this object for logging purpose */
+ virtual const char* className() const { return "CacheableString"; }
+
+ /** Destructor */
+ virtual ~CacheableString();
+
+ /** used to render as a string for logging. */
+ virtual int32_t logString(char* buffer, int32_t maxLength) const;
+
+ virtual uint32_t objectSize() const;
+
+ protected:
+ /** Private method to populate the <code>CacheableString</code>. */
+ void copyString(const char* value, int32_t len);
+ /** Private method to populate the <code>CacheableString</code>. */
+ void copyString(const wchar_t* value, int32_t len);
+ /** initialize the string, given a value and length. */
+ void initString(const char* value, int32_t len);
+ /**
+ * Initialize the string without making a copy, given a C string
+ * and length.
+ */
+ void initStringNoCopy(char* value, int32_t len);
+ /** initialize the string, given a wide-char string and length. */
+ void initString(const wchar_t* value, int32_t len);
+ /**
+ * Initialize the string without making a copy, given a wide-char string
+ * and length.
+ */
+ void initStringNoCopy(wchar_t* value, int32_t len);
+ /** Private method to get ASCII string for wide-string if possible. */
+ char* getASCIIString(const wchar_t* value, int32_t& len, int32_t& encodedLen);
+ /** Default constructor. */
+ inline CacheableString(int8_t type = GF_STRING)
+ : m_str(NULL), m_type(type), m_len(0), m_hashcode(0) {}
+
+ private:
+ // never implemented.
+ void operator=(const CacheableString& other);
+ CacheableString(const CacheableString& other);
+};
+
+/** overload of apache::geode::client::createKeyArr to pass char* */
+inline CacheableKeyPtr createKeyArr(const char* value) {
+ return (value != NULL ? CacheableKeyPtr(CacheableString::create(value).ptr())
+ : NULLPTR);
+}
+
+/** overload of apache::geode::client::createKeyArr to pass wchar_t* */
+inline CacheableKeyPtr createKeyArr(const wchar_t* value) {
+ return (value != NULL ? CacheableKeyPtr(CacheableString::create(value).ptr())
+ : NULLPTR);
+}
+
+/** overload of apache::geode::client::createValueArr to pass char* */
+inline CacheablePtr createValueArr(const char* value) {
+ return (value != NULL ? CacheablePtr(CacheableString::create(value).ptr())
+ : NULLPTR);
+}
+
+/** overload of apache::geode::client::createValueArr to pass wchar_t* */
+inline CacheablePtr createValueArr(const wchar_t* value) {
+ return (value != NULL ? CacheablePtr(CacheableString::create(value).ptr())
+ : NULLPTR);
+}
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLESTRING_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CacheableUndefined.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CacheableUndefined.hpp b/src/cppcache/include/geode/CacheableUndefined.hpp
new file mode 100644
index 0000000..a28a782
--- /dev/null
+++ b/src/cppcache/include/geode/CacheableUndefined.hpp
@@ -0,0 +1,98 @@
+#pragma once
+
+#ifndef GEODE_CACHEABLEUNDEFINED_H_
+#define GEODE_CACHEABLEUNDEFINED_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "Cacheable.hpp"
+
+/** @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * Encapsulate an undefined query result.
+ */
+class CPPCACHE_EXPORT CacheableUndefined : public Cacheable {
+ public:
+ /**
+ *@brief serialize this object
+ **/
+ virtual void toData(DataOutput& output) const;
+
+ /**
+ *@brief deserialize this object
+ **/
+ virtual Serializable* fromData(DataInput& input);
+
+ /**
+ * @brief creation function for undefined query result
+ */
+ inline static Serializable* createDeserializable() {
+ return new CacheableUndefined();
+ }
+
+ /**
+ *@brief Return the classId of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int32_t classId() const;
+
+ /**
+ *@brief return the typeId byte of the instance being serialized.
+ * This is used by deserialization to determine what instance
+ * type to create and deserialize into.
+ */
+ virtual int8_t typeId() const;
+
+ /**
+ * @brief Return the data serialization fixed ID size type for internal use.
+ * @since GFE 5.7
+ */
+ virtual int8_t DSFID() const;
+
+ /**
+ * Factory method for creating the default instance of CacheableUndefined.
+ */
+ inline static CacheableUndefinedPtr create() {
+ return CacheableUndefinedPtr(new CacheableUndefined());
+ }
+
+ virtual uint32_t objectSize() const;
+
+ protected:
+ /** Constructor, used for deserialization. */
+ inline CacheableUndefined() {}
+
+ private:
+ // never implemented.
+ CacheableUndefined& operator=(const CacheableUndefined& other);
+ CacheableUndefined(const CacheableUndefined& other);
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CACHEABLEUNDEFINED_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqAttributes.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqAttributes.hpp b/src/cppcache/include/geode/CqAttributes.hpp
new file mode 100644
index 0000000..cec8b1c
--- /dev/null
+++ b/src/cppcache/include/geode/CqAttributes.hpp
@@ -0,0 +1,64 @@
+#pragma once
+
+#ifndef GEODE_CQATTRIBUTES_H_
+#define GEODE_CQATTRIBUTES_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "VectorT.hpp"
+
+#include "CqListener.hpp"
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @cacheserver
+ * Querying is only supported for native clients.
+ * @endcacheserver
+ * @class CqAttributes CqAttributes.hpp
+ *
+ * This interface holds all attribute values for a CQ and provides methods for
+ * retrieving all attribute settings. This interface can be modified only by
+ * the CqAttributesFactory class (before CQ creation) and the
+ * CqAttributesMutator
+ * interface (after CQ creation).
+ *
+ * For compatibility rules and default values, see {@link CqAttributesFactory}.
+ */
+class CPPCACHE_EXPORT CqAttributes : virtual public SharedBase {
+ public:
+ /**
+ * Get the CqListeners set with the CQ.
+ * Returns all the Listeners associated with this CQ.
+ * @see CqListener
+ * @return VectorOfCqListener of CqListnerPtr
+ */
+ virtual void getCqListeners(VectorOfCqListener& vl) = 0;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQATTRIBUTES_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqAttributesFactory.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqAttributesFactory.hpp b/src/cppcache/include/geode/CqAttributesFactory.hpp
new file mode 100644
index 0000000..9f9b45a
--- /dev/null
+++ b/src/cppcache/include/geode/CqAttributesFactory.hpp
@@ -0,0 +1,106 @@
+#pragma once
+
+#ifndef GEODE_CQATTRIBUTESFACTORY_H_
+#define GEODE_CQATTRIBUTESFACTORY_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "CqAttributes.hpp"
+#include "CqListener.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqAttributesFactory CqAttributesFactory.hpp
+ *
+ * The factory class for the CqAttributes instance. This provides the CqListener
+ * setter methods. This class maintains state for and creates new instances of
+ * the
+ * CqAttributes interface for new CqQuery instances.
+ * If you create a factory with the default constructor, then the factory is set
+ * up to create attributes with all default settings. You can also create a
+ * factory
+ * by providing a <code>CqAttributes</code>, which will set up the new factory
+ * with
+ * the settings provided in that attributes instance.
+ *
+ * <p>Once a <code>CqAttributes</code> is created, it can only be modified
+ * after it has been used to create a <code>CqQuery</code>.
+ *
+ * @see CqAttributes
+ *
+ */
+class CPPCACHE_EXPORT CqAttributesFactory : public SharedBase {
+ public:
+ /**
+ * Creates a new instance of AttributesFactory ready to create a
+ * <code>CqAttributes</code> with default settings.
+ */
+ CqAttributesFactory();
+
+ /**
+ * Creates a new instance of CqAttributesFactory ready to create a
+ * <code>CqAttributes</code> with the same settings as those in the
+ * specified <code>CqAttributes</code>.
+ *
+ * @param cqAttributes
+ * the <code>CqAttributes</code> used to initialize this
+ * AttributesFactory
+ */
+ CqAttributesFactory(CqAttributesPtr& cqAttributes);
+
+ /**
+ * Adds a CQ listener to the end of the list of cq listeners on this factory.
+ * @param cqListener the CqListener to add to the factory.
+ * @throws IllegalArgumentException if <code>cqListener</code> is NULLPTR
+ */
+ void addCqListener(const CqListenerPtr& cqListener);
+
+ /**
+ * Removes all Cq listeners and then adds each listener in the specified
+ * array.
+ * @param cqListeners a possibly empty array of listeners to add to this
+ * factory.
+ * @throws IllegalArgumentException if the <code>cqListeners</code> array has
+ * a
+ * NULLPTR element
+ */
+ void initCqListeners(VectorOfCqListener& cqListeners);
+
+ /**
+ * Creates a <code>CqAttributes</code> with the current settings.
+ * @return the newly created <code>CqAttributes</code>
+ */
+ CqAttributesPtr create();
+
+ private:
+ CqAttributesPtr m_cqAttributes;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQATTRIBUTESFACTORY_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqAttributesMutator.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqAttributesMutator.hpp b/src/cppcache/include/geode/CqAttributesMutator.hpp
new file mode 100644
index 0000000..36a5368
--- /dev/null
+++ b/src/cppcache/include/geode/CqAttributesMutator.hpp
@@ -0,0 +1,77 @@
+#pragma once
+
+#ifndef GEODE_CQATTRIBUTESMUTATOR_H_
+#define GEODE_CQATTRIBUTESMUTATOR_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "VectorT.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqAttributesMutator CqAttributesMutator.hpp
+ *
+ * This interface is used to modify the listeners that are associated with a CQ.
+ * Each CqQuery has an CqAttributesMutator interface which supports modification
+ * of certain CQ attributes after the CQ has been created.
+ *
+ */
+class CPPCACHE_EXPORT CqAttributesMutator : virtual public SharedBase {
+ public:
+ /**
+ * Adds a CQ listener to the end of the list of CQ listeners on this CqQuery.
+ * @param aListener the user defined CQ listener to add to the CqQuery.
+ * @throws IllegalArgumentException if <code>aListener</code> is NULLPTR
+ */
+ virtual void addCqListener(const CqListenerPtr& aListener) = 0;
+
+ /**
+ * Removes given CQ listener from the list of CQ listeners on this CqQuery.
+ * Does nothing if the specified listener has not been added.
+ * If the specified listener has been added then will
+ * be called on it; otherwise does nothing.
+ * @param aListener the CQ listener to remove from the CqQuery.
+ * @throws IllegalArgumentException if <code>aListener</code> is NULLPTR
+ */
+ virtual void removeCqListener(const CqListenerPtr& aListener) = 0;
+
+ /**
+ * Adds the given set CqListner on this CQ. If the CQ already has CqListeners,
+ * this
+ * removes those old CQs and initializes with the newListeners.
+ * @param newListeners a possibly empty array of listeners to add
+ * to this CqQuery.
+ * @throws IllegalArgumentException if the <code>newListeners</code> array
+ * has a NULLPTR element
+ */
+ virtual void setCqListeners(VectorOfCqListener& newListeners) = 0;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQATTRIBUTESMUTATOR_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqEvent.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqEvent.hpp b/src/cppcache/include/geode/CqEvent.hpp
new file mode 100644
index 0000000..bc5b1a3
--- /dev/null
+++ b/src/cppcache/include/geode/CqEvent.hpp
@@ -0,0 +1,111 @@
+#pragma once
+
+#ifndef GEODE_CQEVENT_H_
+#define GEODE_CQEVENT_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "Exception.hpp"
+#include "CqOperation.hpp"
+#include "Cacheable.hpp"
+#include "CacheableKey.hpp"
+#include "CacheableBuiltins.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqEvent CqEvent.hpp
+ *
+ * This interface provides methods to get all the information sent from the
+ * server
+ * about the CQ event.
+ * The CqEvent is passed to the CQs CqListener methods. It can be used to
+ * retrieve
+ * such information as the region operation, CQ operation associated with the
+ * event,
+ * the new key and value from the event, and the CqQuery object associated with
+ * the
+ * event.
+ * The CqEvent is not an extension of CacheEvent.
+ */
+class CPPCACHE_EXPORT CqEvent {
+ public:
+ CqEvent() {}
+
+ virtual ~CqEvent() {}
+ /**
+ * Get the CqQuery object of this event.
+ * @see CqQuery
+ * @return CqQuery object.
+ */
+ virtual CqQueryPtr getCq() const = 0;
+
+ /**
+ * Get the operation on the base region that triggered this event.
+ * @return Operation operation on the base region (on which CQ is created).
+ */
+ virtual CqOperation::CqOperationType getBaseOperation() const = 0;
+
+ /**
+ * Get the operation on the query results. Supported operations
+ * include update, create, destroy, region clear and region invalidate.
+ * @return Operation operation with respect to CQ.
+ */
+ virtual CqOperation::CqOperationType getQueryOperation() const = 0;
+
+ /**
+ * Get the key relating to the event.
+ * In case of REGION_CLEAR and REGION_INVALIDATE operation, the key will be
+ * NULLPTR.
+ * @return Object key.
+ */
+ virtual CacheableKeyPtr getKey() const = 0;
+
+ /**
+ * Get the new value of the modification.
+ * If there is no new value returns NULLPTR, this will happen during delete
+ * operation.
+ * @return Object new/modified value.
+ */
+ virtual CacheablePtr getNewValue() const = 0;
+
+ /**
+ * Get the delta modification.
+ * If there is no delta, returns null. New value may still be available.
+ *
+ * @return CacheableBytes delta value.
+ */
+ virtual CacheableBytesPtr getDeltaValue() const = 0;
+
+ private:
+ CqEvent(const CqEvent&);
+ void operator=(const CqEvent&);
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQEVENT_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqListener.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqListener.hpp b/src/cppcache/include/geode/CqListener.hpp
new file mode 100644
index 0000000..3a87924
--- /dev/null
+++ b/src/cppcache/include/geode/CqListener.hpp
@@ -0,0 +1,99 @@
+#pragma once
+
+#ifndef GEODE_CQLISTENER_H_
+#define GEODE_CQLISTENER_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "CqEvent.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @cacheserver
+ * Querying is only supported for native clients.
+ * @endcacheserver
+ * @class CqListener CqListener.hpp
+ *
+ * Application plug-in interface for handling continuous query events after
+ * they occur. The listener has two methods, one that is called when there
+ * is an event satisfied by the CQ and the other called when there is an
+ * error during CQ processing.
+ */
+class CPPCACHE_EXPORT CqListener : public SharedBase {
+ public:
+ /**
+ * This method is invoked when an event is occurred on the region
+ * that satisfied the query condition of this CQ.
+ * This event does not contain an error.
+ */
+ virtual void onEvent(const CqEvent& aCqEvent);
+
+ /**
+ * This method is invoked when there is an error during CQ processing.
+ * The error can appear while applying query condition on the event.
+ * e.g if the event doesn't has attributes as specified in the CQ query.
+ * This event does contain an error. The newValue may or may not be
+ * available, and will be NULLPTR if not available.
+ */
+ virtual void onError(const CqEvent& aCqEvent);
+
+ /** Called when the region containing this callback is closed or destroyed,
+ * when
+ * the cache is closed, or when a callback is removed from a region
+ * using an <code>AttributesMutator</code>.
+ *
+ * <p>Implementations should cleanup any external
+ * resources such as database connections. Any runtime exceptions this method
+ * throws will be logged.
+ *
+ * <p>It is possible for this method to be called multiple times on a single
+ * callback instance, so implementations must be tolerant of this.
+ *
+ * @see Cache#close()
+ * @see Region#close
+ * @see Region#localDestroyRegion()
+ * @see Region#destroyRegion()
+ * @see AttributesMutator
+ */
+ virtual void close();
+
+ protected:
+ /**
+ * @brief constructors
+ */
+ CqListener();
+
+ private:
+ // never implemented.
+ CqListener(const CacheListener& other);
+ void operator=(const CqListener& other);
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQLISTENER_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqOperation.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqOperation.hpp b/src/cppcache/include/geode/CqOperation.hpp
new file mode 100644
index 0000000..b625ae6
--- /dev/null
+++ b/src/cppcache/include/geode/CqOperation.hpp
@@ -0,0 +1,55 @@
+#pragma once
+
+#ifndef GEODE_CQOPERATION_H_
+#define GEODE_CQOPERATION_H_
+
+/*
+ * 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 "geode_globals.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+/**
+ * @class Operation CqOperation.hpp
+ * Enumerated type for Operation actions.
+ */
+class CPPCACHE_EXPORT CqOperation {
+ // public static methods
+ public:
+ // types of operation CORESPONDING TO THE ONES in geode.cache.Operation
+
+ typedef enum {
+ OP_TYPE_INVALID = -1,
+ OP_TYPE_CREATE = 1,
+ OP_TYPE_UPDATE = 2,
+ OP_TYPE_INVALIDATE = 4,
+ OP_TYPE_REGION_CLEAR = 8,
+ OP_TYPE_DESTROY = 16,
+ OP_TYPE_MARKER = 32
+ } CqOperationType;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQOPERATION_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqQuery.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqQuery.hpp b/src/cppcache/include/geode/CqQuery.hpp
new file mode 100644
index 0000000..f8fb48d
--- /dev/null
+++ b/src/cppcache/include/geode/CqQuery.hpp
@@ -0,0 +1,184 @@
+#pragma once
+
+#ifndef GEODE_CQQUERY_H_
+#define GEODE_CQQUERY_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+
+#include "CqResults.hpp"
+#include "CqStatistics.hpp"
+#include "CqAttributes.hpp"
+#include "CqAttributesMutator.hpp"
+#include "CqState.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqQuery CqQuery.hpp
+ *
+ * A Query is obtained from a QueryService which in turn is obtained from the
+ * Cache.
+ * This can be executed to return SelectResults which can be either
+ * a ResultSet or a StructSet, or it can be just registered on the java server
+ * without returning results immediately rather only the incremental results.
+ *
+ * This class is intentionally not thread-safe. So multiple threads should not
+ * operate on the same <code>CqQuery</code> object concurrently rather should
+ * have their own <code>CqQuery</code> objects.
+ */
+class CPPCACHE_EXPORT CqQuery : public SharedBase {
+ public:
+ /**
+ * Get the query string provided when a new Query was created from a
+ * QueryService.
+ * @returns The query string.
+ */
+ virtual const char* getQueryString() const = 0;
+ /**
+ * Get teh query object generated for this CQs query.
+ * @return Query object fort he query string
+ */
+ virtual QueryPtr getQuery() const = 0;
+ /**
+ * Get the name of the CQ.
+ * @return the name of the CQ.
+ */
+ virtual const char* getName() const = 0;
+ /**
+ * Get the statistics information of this CQ.
+ * @return CqStatistics, the CqStatistics object.
+ */
+ virtual const CqStatisticsPtr getStatistics() const = 0;
+ /**
+ * Get the Attributes of this CQ.
+ * @return CqAttributes, the CqAttributes object.
+ */
+ virtual const CqAttributesPtr getCqAttributes() const = 0;
+ /**
+ * Get the AttributesMutator of this CQ.
+ * @return CqAttributesMutator, the CqAttributesMutator object.
+ */
+ virtual const CqAttributesMutatorPtr getCqAttributesMutator() const = 0;
+ /**
+ * Start executing the CQ or if this CQ is stopped earlier, resumes execution
+ * of the CQ.
+ * Get the resultset associated with CQ query.
+ * The CQ is executed on primary and redundant servers, if CQ execution fails
+ * on all the
+ * server then a CqException is thrown.
+ *
+ * @param timeout The time (in seconds) to wait for query response, optional.
+ * This should be less than or equal to 2^31/1000 i.e. 2147483.
+ *
+ * @throws IllegalArgumentException if timeout parameter is greater than
+ * 2^31/1000.
+ * @throws CqClosedException if this CqQuery is closed.
+ * @throws RegionNotFoundException if the specified region in the
+ * query string is not found.
+ * @throws IllegalStateException if the CqQuery is in the RUNNING state
+ * already.
+ * @throws CqException if failed to execute and get initial results.
+ * @return CqResults resultset obtained by executing the query.
+ */
+ virtual CqResultsPtr executeWithInitialResults(
+ uint32_t timeout = DEFAULT_QUERY_RESPONSE_TIMEOUT) = 0;
+
+ /**
+ * @notsupported_cacheserver
+ * @nativeclient
+ * Executes the OQL Query on the cache server and returns the results.
+ *
+ * @throws RegionNotFoundException if the specified region in the
+ * query string is not found.
+ * @throws CqClosedException if this CqQuery is closed.
+ * @throws CqException if some query error occurred at the server.
+ * @throws IllegalStateException if some error occurred.
+ * @throws NotConnectedException if no java cache server is available. For
+ * pools
+ * configured with locators, if no locators are available, the cause of
+ * NotConnectedException
+ * is set to NoAvailableLocatorsException.
+ * @endnativeclient
+ */
+ virtual void execute() = 0;
+ /**
+ * Stops this CqQuery without releasing resources. Puts the CqQuery into
+ * the STOPPED state. Can be resumed by calling execute or
+ * executeWithInitialResults.
+ * @throws IllegalStateException if the CqQuery is in the STOPPED state
+ * already.
+ * @throws CqClosedException if the CQ is CLOSED.
+ */
+ virtual void stop() = 0;
+
+ /**
+ * Get the state of the CQ in CqState object form.
+ * CqState supports methods like isClosed(), isRunning(), isStopped().
+ * @see CqState
+ * @return CqState state object of the CQ.
+ */
+ virtual CqState::StateType getState() = 0;
+
+ /**
+ * Close the CQ and stop execution.
+ * Releases the resources associated with this CqQuery.
+ * @throws CqClosedException Further calls on this CqQuery instance except
+ * for getState() or getName().
+ * @throws CqException - if failure during cleanup of CQ resources.
+ */
+ virtual void close() = 0;
+
+ /**
+ * This allows to check if the CQ is in running or active.
+ * @return boolean true if running, false otherwise
+ */
+ virtual bool isRunning() = 0;
+
+ /**
+ * This allows to check if the CQ is in stopped.
+ * @return boolean true if stopped, false otherwise
+ */
+ virtual bool isStopped() = 0;
+
+ /**
+ * This allows to check if the CQ is closed.
+ * @return boolean true if closed, false otherwise
+ */
+ virtual bool isClosed() = 0;
+
+ /**
+ * This allows to check if the CQ is durable.
+ * @return boolean true if durable, false otherwise
+ * @since 5.5
+ */
+ virtual bool isDurable() = 0;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQQUERY_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqResults.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqResults.hpp b/src/cppcache/include/geode/CqResults.hpp
new file mode 100644
index 0000000..ef574ac
--- /dev/null
+++ b/src/cppcache/include/geode/CqResults.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#ifndef GEODE_CQRESULTS_H_
+#define GEODE_CQRESULTS_H_
+
+/*
+ * 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.
+ */
+
+/**
+ * @file
+ */
+
+#include "geode_globals.hpp"
+#include "gf_types.hpp"
+#include "ExceptionTypes.hpp"
+#include "Serializable.hpp"
+#include "CacheableBuiltins.hpp"
+#include "SelectResults.hpp"
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqResults CqResults.hpp
+ *
+ * A CqResults is obtained by executing a Query on the server.
+ * This will be a StructSet.
+ */
+class CPPCACHE_EXPORT CqResults : public SelectResults {};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQRESULTS_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqServiceStatistics.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqServiceStatistics.hpp b/src/cppcache/include/geode/CqServiceStatistics.hpp
new file mode 100644
index 0000000..33cc6a7
--- /dev/null
+++ b/src/cppcache/include/geode/CqServiceStatistics.hpp
@@ -0,0 +1,79 @@
+#pragma once
+
+#ifndef GEODE_CQSERVICESTATISTICS_H_
+#define GEODE_CQSERVICESTATISTICS_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqServiceStatistics CqServiceStatistics.hpp
+ *
+ * This class provides methods to get aggregate statistical information
+ * about the CQs of a client.
+ */
+class CPPCACHE_EXPORT CqServiceStatistics : public SharedBase {
+ public:
+ /**
+ * Get the number of CQs currently active.
+ * Active CQs are those which are executing (in running state).
+ * @return number of CQs
+ */
+ virtual uint32_t numCqsActive() const = 0;
+
+ /**
+ * Get the total number of CQs created. This is a cumulative number.
+ * @return number of CQs created.
+ */
+ virtual uint32_t numCqsCreated() const = 0;
+
+ /**
+ * Get the total number of closed CQs. This is a cumulative number.
+ * @return number of CQs closed.
+ */
+ virtual uint32_t numCqsClosed() const = 0;
+
+ /**
+ * Get the number of stopped CQs currently.
+ * @return number of CQs stopped.
+ */
+ virtual uint32_t numCqsStopped() const = 0;
+
+ /**
+ * Get number of CQs that are currently active or stopped.
+ * The CQs included in this number are either running or stopped (suspended).
+ * Closed CQs are not included.
+ * @return number of CQs on client.
+ */
+ virtual uint32_t numCqsOnClient() const = 0;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQSERVICESTATISTICS_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqState.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqState.hpp b/src/cppcache/include/geode/CqState.hpp
new file mode 100644
index 0000000..1704d7f
--- /dev/null
+++ b/src/cppcache/include/geode/CqState.hpp
@@ -0,0 +1,84 @@
+#pragma once
+
+#ifndef GEODE_CQSTATE_H_
+#define GEODE_CQSTATE_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @class CqState CqState.hpp
+ *
+ * This interface gives information on the state of a CqQuery.
+ * It is provided by the getState method of the CqQuery instance.
+ */
+class CPPCACHE_EXPORT CqState {
+ public:
+ // corresponding to geode.cache.query.internal.CqStateImpl
+ typedef enum {
+ STOPPED = 0,
+ RUNNING = 1,
+ CLOSED = 2,
+ CLOSING = 3,
+ INVALID
+ } StateType;
+ /**
+ * Returns the state in string form.
+ */
+ const char* toString() const;
+
+ /**
+ * Returns true if the CQ is in Running state.
+ */
+ bool isRunning() const;
+
+ /**
+ * Returns true if the CQ is in Stopped state.
+ */
+ bool isStopped() const;
+
+ /**
+ * Returns true if the CQ is in Closed state.
+ */
+ bool isClosed() const;
+
+ /**
+ * Returns true if the CQ is in Closing state.
+ */
+ bool isClosing() const;
+ void setState(CqState::StateType state);
+ CqState::StateType getState();
+
+ private:
+ StateType m_state;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQSTATE_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqStatistics.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqStatistics.hpp b/src/cppcache/include/geode/CqStatistics.hpp
new file mode 100644
index 0000000..9aa486f
--- /dev/null
+++ b/src/cppcache/include/geode/CqStatistics.hpp
@@ -0,0 +1,75 @@
+#pragma once
+
+#ifndef GEODE_CQSTATISTICS_H_
+#define GEODE_CQSTATISTICS_H_
+
+/*
+ * 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 "geode_globals.hpp"
+#include "gf_types.hpp"
+
+/**
+ * @file
+ */
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+ * @cacheserver
+ * Querying is only supported for native clients.
+ * @endcacheserver
+ * @class CqStatistics CqStatistics.hpp
+ *
+ * This class provides methods to get statistical information about a registered
+ * Continuous Query (CQ)
+ * represented by the CqQuery object.
+ *
+ */
+class CPPCACHE_EXPORT CqStatistics : public SharedBase {
+ public:
+ /**
+ * Get number of Insert events qualified by this CQ.
+ * @return number of inserts.
+ */
+ virtual uint32_t numInserts() const = 0;
+
+ /**
+ * Get number of Delete events qualified by this CQ.
+ * @return number of deletes.
+ */
+ virtual uint32_t numDeletes() const = 0;
+
+ /**
+ * Get number of Update events qualified by this CQ.
+ * @return number of updates.
+ */
+ virtual uint32_t numUpdates() const = 0;
+
+ /**
+ * Get total of all the events qualified by this CQ.
+ * @return total number of events.
+ */
+ virtual uint32_t numEvents() const = 0;
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQSTATISTICS_H_
http://git-wip-us.apache.org/repos/asf/geode-native/blob/fd58b100/src/cppcache/include/geode/CqStatusListener.hpp
----------------------------------------------------------------------
diff --git a/src/cppcache/include/geode/CqStatusListener.hpp b/src/cppcache/include/geode/CqStatusListener.hpp
new file mode 100644
index 0000000..701413b
--- /dev/null
+++ b/src/cppcache/include/geode/CqStatusListener.hpp
@@ -0,0 +1,53 @@
+#pragma once
+
+#ifndef GEODE_CQSTATUSLISTENER_H_
+#define GEODE_CQSTATUSLISTENER_H_
+
+/*
+ * 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 "CqListener.hpp"
+
+namespace apache {
+namespace geode {
+namespace client {
+
+/**
+* Extension of CqListener. Adds two new methods to CqListener, one that
+* is called when the cq is connected and one that is called when
+* the cq is disconnected
+*
+* @since 7.0
+*/
+
+class CPPCACHE_EXPORT CqStatusListener : public CqListener {
+ public:
+ /**
+ * Called when the cq loses connection with all servers
+ */
+ virtual void onCqDisconnected();
+
+ /**
+ * Called when the cq establishes a connection with a server
+ */
+ virtual void onCqConnected();
+};
+} // namespace client
+} // namespace geode
+} // namespace apache
+
+#endif // GEODE_CQSTATUSLISTENER_H_