| Apache Ignite C++

query_text.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
23 #ifndef _IGNITE_CACHE_QUERY_QUERY_TEXT
24 #define _IGNITE_CACHE_QUERY_QUERY_TEXT
25
26 #include <stdint.h>
27 #include <string>
28
29 #include "ignite/binary/binary_raw_writer.h"
30
31 namespace ignite
32 {
33 namespace cache
34 {
35 namespace query
36 {
40 class TextQuery
41 {
42 public:
49 TextQuery(const std::string& type, const std::string& text) :
50 type(type), text(text), pageSize(1024), loc(false)
51 {
52 // No-op.
53 }
54
60 const std::string& GetType() const
61 {
62 return type;
63 }
64
70 void SetType(const std::string& type)
71 {
72 this->type = type;
73 }
74
80 const std::string& GetText() const
81 {
82 return text;
83 }
84
90 void SetText(const std::string& text)
91 {
92 this->text = text;
93 }
94
100 int32_t GetPageSize() const
101 {
102 return pageSize;
103 }
104
110 void SetPageSize(int32_t pageSize)
111 {
112 this->pageSize = pageSize;
113 }
114
120 bool IsLocal() const
121 {
122 return loc;
123 }
124
132 void SetLocal(bool loc)
133 {
134 this->loc = loc;
135 }
136
142 void Write(binary::BinaryRawWriter& writer) const
143 {
144 writer.WriteBool(loc);
145 writer.WriteString(text);
146 writer.WriteString(type);
147 writer.WriteInt32(pageSize);
148 }
149
150 private:
152 std::string type;
153
155 std::string text;
156
158 int32_t pageSize;
159
161 bool loc;
162 };
163 }
164 }
165 }
166
167 #endif //_IGNITE_CACHE_QUERY_QUERY_TEXT
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::binary::BinaryRawWriter::WriteInt32
void WriteInt32(int32_t val)
Write 32-byte signed integer.
Definition: binary_raw_writer.cpp:72
ignite::cache::query::TextQuery::SetPageSize
void SetPageSize(int32_t pageSize)
Set page size.
Definition: query_text.h:110
ignite::cache::query::TextQuery::SetText
void SetText(const std::string &text)
Set text string.
Definition: query_text.h:90
ignite::binary::BinaryRawWriter
Binary raw writer.
Definition: binary_raw_writer.h:62
ignite::cache::query::TextQuery::GetText
const std::string & GetText() const
Get text string.
Definition: query_text.h:80
ignite::cache::query::TextQuery
Text query.
Definition: query_text.h:40
ignite::binary::BinaryRawWriter::WriteString
void WriteString(const char *val)
Write string.
Definition: binary_raw_writer.cpp:152
ignite::binary::BinaryRawWriter::WriteBool
void WriteBool(bool val)
Write bool.
Definition: binary_raw_writer.cpp:42
ignite::cache::query::TextQuery::GetType
const std::string & GetType() const
Get type name.
Definition: query_text.h:60
ignite::cache::query::TextQuery::IsLocal
bool IsLocal() const
Get local flag.
Definition: query_text.h:120
binary_raw_writer.h
ignite::cache::query::TextQuery::SetType
void SetType(const std::string &type)
Set type name.
Definition: query_text.h:70
ignite::cache::query::TextQuery::GetPageSize
int32_t GetPageSize() const
Get page size.
Definition: query_text.h:100
ignite::cache::query::TextQuery::Write
void Write(binary::BinaryRawWriter &writer) const
Write query info to the stream.
Definition: query_text.h:142
ignite::cache::query::TextQuery::TextQuery
TextQuery(const std::string &type, const std::string &text)
Constructor.
Definition: query_text.h:49
ignite::cache::query::TextQuery::SetLocal
void SetLocal(bool loc)
Set local flag.
Definition: query_text.h:132