18#include "hazelcast/client/serialization/serialization.h"
20#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
22#pragma warning(disable : 4251)
32 static const char*
const KEY_ATTRIBUTE_NAME;
33 static const char*
const THIS_ATTRIBUTE_NAME;
44struct HAZELCAST_API base_predicate :
public predicate
51class HAZELCAST_API named_predicate :
public base_predicate
55 const std::string& attribute_name);
58class multi_predicate :
public base_predicate
61 template<
typename... Args>
63 : base_predicate(client)
65 out_stream.write<int32_t>(
static_cast<int32_t
>(
sizeof...(values)));
66 out_stream.write_objects(values...);
69 template<
typename... Args>
70 multi_predicate(
const std::string attribute_name,
72 const Args&... values)
73 : base_predicate(client)
75 out_stream.write(attribute_name);
76 out_stream.write<int32_t>(
static_cast<int32_t
>(
sizeof...(values)));
77 out_stream.write_objects(values...);
81 multi_predicate(
const std::string attribute_name,
83 const std::vector<T>& values)
84 : base_predicate(client)
86 out_stream.write(attribute_name);
87 out_stream.write<int32_t>(
static_cast<int32_t
>(values.size()));
88 for (
const T& value : values) {
89 out_stream.write_object(value);
94enum struct predicate_data_serializer_hook
102 BETWEEN_PREDICATE = 2,
106 GREATERLESS_PREDICATE = 4,
114 INSTANCEOF_PREDICATE = 8,
116 NOTEQUAL_PREDICATE = 9,
122 REGEX_PREDICATE = 12,
124 FALSE_PREDICATE = 13,
128 PAGING_PREDICATE = 15
140 const std::string& attribute_name,
142 : named_predicate(client, attribute_name)
144 out_stream.write_object(value);
157 const std::string& attribute_name,
159 : named_predicate(client, attribute_name)
161 out_stream.write_object(value);
177 const std::string& attribute_name,
181 : named_predicate(client, attribute_name)
183 out_stream.write_object(value);
184 out_stream.write(is_equal);
185 out_stream.write(is_less);
197 template<
typename FROM_TYPE,
typename TO_TYPE>
199 const std::string& attribute_name,
200 const FROM_TYPE& from,
202 : named_predicate(client, attribute_name)
204 out_stream.write_object(to);
205 out_stream.write_object(from);
209class HAZELCAST_API false_predicate :
public base_predicate
215class HAZELCAST_API true_predicate :
public base_predicate
229 const std::string& java_class_name);
252 const std::string& attribute,
253 const std::string& expression);
265 const std::string& attribute,
266 const std::string& expression);
278 const std::string& attribute,
279 const std::string& expression);
290 template<
typename... Args>
292 const std::string& attribute_name,
293 const Args&... values)
294 : multi_predicate(attribute_name, client, values...)
304 const std::string& attribute_name,
305 const std::vector<T>& values)
306 : multi_predicate(attribute_name, client, values)
310class and_predicate :
public multi_predicate
313 template<
typename... Args>
315 : multi_predicate(client, values...)
319class or_predicate :
public multi_predicate
322 template<
typename... PredicateTypes>
324 : multi_predicate(client, values...)
328class not_predicate :
public base_predicate
333 : base_predicate(client)
340namespace serialization {
349 return static_cast<int32_t
>(
350 query::predicate_data_serializer_hook::F_ID);
359 out.append_bytes(
object.out_stream.to_byte_array());
368 BOOST_THROW_EXCEPTION(exception::hazelcast_serialization(
369 "readData",
"Client should not need to use readdata method!!!"));
382 return static_cast<int32_t
>(
383 query::predicate_data_serializer_hook::BETWEEN_PREDICATE);
396 return static_cast<int32_t
>(
397 query::predicate_data_serializer_hook::EQUAL_PREDICATE);
410 return static_cast<int32_t
>(
411 query::predicate_data_serializer_hook::NOTEQUAL_PREDICATE);
424 return static_cast<int32_t
>(
425 query::predicate_data_serializer_hook::GREATERLESS_PREDICATE);
438 return static_cast<int32_t
>(
439 query::predicate_data_serializer_hook::FALSE_PREDICATE);
452 return static_cast<int32_t
>(
453 query::predicate_data_serializer_hook::TRUE_PREDICATE);
466 return static_cast<int32_t
>(
467 query::predicate_data_serializer_hook::LIKE_PREDICATE);
480 return static_cast<int32_t
>(
481 query::predicate_data_serializer_hook::INSTANCEOF_PREDICATE);
494 return static_cast<int32_t
>(
495 query::predicate_data_serializer_hook::SQL_PREDICATE);
508 return static_cast<int32_t
>(
509 query::predicate_data_serializer_hook::ILIKE_PREDICATE);
522 return static_cast<int32_t
>(
523 query::predicate_data_serializer_hook::REGEX_PREDICATE);
536 return static_cast<int32_t
>(
537 query::predicate_data_serializer_hook::IN_PREDICATE);
550 return static_cast<int32_t
>(
551 query::predicate_data_serializer_hook::AND_PREDICATE);
564 return static_cast<int32_t
>(
565 query::predicate_data_serializer_hook::OR_PREDICATE);
578 return static_cast<int32_t
>(
579 query::predicate_data_serializer_hook::NOT_PREDICATE);
586#if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
between_predicate(hazelcast_client &client, const std::string &attribute_name, const FROM_TYPE &from, const TO_TYPE &to)
equal_predicate(hazelcast_client &client, const std::string &attribute_name, const T &value)
greater_less_predicate(hazelcast_client &client, const std::string &attribute_name, const T &value, bool is_equal, bool is_less)
ilike_predicate(hazelcast_client &client, const std::string &attribute, const std::string &expression)
in_predicate(hazelcast_client &client, const std::string &attribute_name, const std::vector< T > &values)
The type of Args should be able to be serialized.
in_predicate(hazelcast_client &client, const std::string &attribute_name, const Args &... values)
The type of Args should be able to be serialized.
instance_of_predicate(hazelcast_client &client, const std::string &java_class_name)
like_predicate(hazelcast_client &client, const std::string &attribute, const std::string &expression)
not_equal_predicate(hazelcast_client &client, const std::string &attribute_name, const T &value)
This is a marker class for Predicate classes.
regex_predicate(hazelcast_client &client, const std::string &attribute, const std::string &expression)
sql_predicate(hazelcast_client &client, const std::string &sql)
static constexpr int32_t get_factory_id() noexcept
static void write_data(const T &object, object_data_output &out)
Defines how this class will be written.
static T read_data(object_data_input &in)
Should not be called at the client side!
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
static constexpr int32_t get_class_id() noexcept
Classes derived from this class should implement the following static methods: static int32_t get_cla...