VMware Tanzu GemFire Native C++ Reference  10.1.5
DefaultResultCollector.hpp
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 
18 #pragma once
19 
20 #ifndef GEODE_DEFAULTRESULTCOLLECTOR_H_
21 #define GEODE_DEFAULTRESULTCOLLECTOR_H_
22 
23 #include <chrono>
24 #include <condition_variable>
25 #include <memory>
26 #include <mutex>
27 
28 #include "CacheableBuiltins.hpp"
29 #include "ResultCollector.hpp"
30 #include "internal/geode_globals.hpp"
31 
36 namespace apache {
37 namespace geode {
38 namespace client {
39 
40 class APACHE_GEODE_EXPORT DefaultResultCollector : public ResultCollector {
41  public:
42  DefaultResultCollector();
43  ~DefaultResultCollector() noexcept override;
44 
45  std::shared_ptr<CacheableVector> getResult(
46  std::chrono::milliseconds timeout =
47  DEFAULT_QUERY_RESPONSE_TIMEOUT) override;
48 
49  void addResult(
50  const std::shared_ptr<Cacheable>& resultOfSingleExecution) override;
51 
52  void endResults() override;
53 
54  void clearResults() override;
55 
56  private:
57  std::shared_ptr<CacheableVector> resultList;
58  bool ready;
59  std::condition_variable readyCondition;
60  std::mutex readyMutex;
61 };
62 
63 } // namespace client
64 } // namespace geode
65 } // namespace apache
66 
67 #endif // GEODE_DEFAULTRESULTCOLLECTOR_H_
CacheableBuiltins.hpp
Contains generic template definitions for Cacheable types and instantiations for built-in types.
ResultCollector.hpp

Apache Geode C++ Cache API Documentation