Apache Ignite C++
query_argument.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 
24 #ifndef _IGNITE_CACHE_QUERY_QUERY_ARGUMENT
25 #define _IGNITE_CACHE_QUERY_QUERY_ARGUMENT
26 
28 
29 namespace ignite
30 {
31  namespace cache
32  {
33  namespace query
34  {
39  {
40  public:
45  {
46  // No-op.
47  }
48 
54  virtual QueryArgumentBase* Copy() const = 0;
55 
61  virtual void Write(ignite::binary::BinaryRawWriter& writer) = 0;
62  };
63 
71  template<typename T>
73  {
74  public:
80  QueryArgument(const T& val) :
81  val(val)
82  {
83  // No-op.
84  }
85 
91  QueryArgument(const QueryArgument& other) :
92  val(other.val)
93  {
94  // No-op.
95  }
96 
104  {
105  if (this != &other)
106  val = other.val;
107 
108  return *this;
109  }
110 
111  virtual ~QueryArgument()
112  {
113  // No-op.
114  }
115 
116  virtual QueryArgumentBase* Copy() const
117  {
118  return new QueryArgument(val);
119  }
120 
122  {
123  writer.WriteObject<T>(val);
124  }
125 
126  private:
128  T val;
129  };
130  }
131  }
132 }
133 
134 #endif //_IGNITE_CACHE_QUERY_QUERY_ARGUMENT
Declares ignite::binary::BinaryRawWriter class.
Base class for all query arguments.
Definition: query_argument.h:38
QueryArgument(const T &val)
Constructor.
Definition: query_argument.h:80
virtual void Write(ignite::binary::BinaryRawWriter &writer)
Write argument using provided writer.
Definition: query_argument.h:121
virtual QueryArgumentBase * Copy() const
Copy argument.
Definition: query_argument.h:116
QueryArgument & operator=(const QueryArgument &other)
Assignment operator.
Definition: query_argument.h:103
Binary raw writer.
Definition: binary_raw_writer.h:55
QueryArgument(const QueryArgument &other)
Copy constructor.
Definition: query_argument.h:91
void WriteObject(T val)
Write object.
Definition: binary_raw_writer.h:365
virtual void Write(ignite::binary::BinaryRawWriter &writer)=0
Write argument using provided writer.
virtual ~QueryArgumentBase()
Destructor.
Definition: query_argument.h:44
Apache Ignite API.
Definition: cache.h:43
virtual QueryArgumentBase * Copy() const =0
Copy argument.
Query argument class template.
Definition: query_argument.h:72