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_ARGUMENT
25 #define _IGNITE_CACHE_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 
59  virtual void Write(ignite::binary::BinaryRawWriter& writer) = 0;
60  };
61 
65  template<typename T>
67  {
68  public:
74  QueryArgument(const T& val) : val(val)
75  {
76  // No-op.
77  }
78 
85  {
86  val = other.val;
87  }
88 
95  {
96  if (this != &other)
97  {
98  QueryArgument tmp(other);
99 
100  T val0 = val;
101  val = tmp.val;
102  tmp.val = val0;
103  }
104 
105  return *this;
106  }
107 
108  virtual ~QueryArgument()
109  {
110  // No-op.
111  }
112 
113  virtual QueryArgumentBase* Copy() const
114  {
115  return new QueryArgument(val);
116  }
117 
119  {
120  writer.WriteObject<T>(val);
121  }
122 
123  private:
125  T val;
126  };
127  }
128  }
129 }
130 
131 #endif
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:74
virtual void Write(ignite::binary::BinaryRawWriter &writer)
Write argument.
Definition: query_argument.h:118
virtual QueryArgumentBase * Copy() const
Copy argument.
Definition: query_argument.h:113
QueryArgument & operator=(const QueryArgument &other)
Assignment operator.
Definition: query_argument.h:94
Binary raw writer.
Definition: binary_raw_writer.h:42
QueryArgument(const QueryArgument &other)
Copy constructor.
Definition: query_argument.h:84
void WriteObject(T val)
Write object.
Definition: binary_raw_writer.h:320
virtual void Write(ignite::binary::BinaryRawWriter &writer)=0
Write argument.
virtual ~QueryArgumentBase()
Destructor.
Definition: query_argument.h:44
Apache Ignite API.
Definition: binary_consts.h:28
virtual QueryArgumentBase * Copy() const =0
Copy argument.
Query argument.
Definition: query_argument.h:66