VMware GemFire Native C++ Reference  9.1
FunctionService.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef GEODE_FUNCTIONSERVICE_H_
4 #define GEODE_FUNCTIONSERVICE_H_
5 
6 /*
7  * Licensed to the Apache Software Foundation (ASF) under one or more
8  * contributor license agreements. See the NOTICE file distributed with
9  * this work for additional information regarding copyright ownership.
10  * The ASF licenses this file to You under the Apache License, Version 2.0
11  * (the "License"); you may not use this file except in compliance with
12  * the License. You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 /*
24  * The specification of function behaviors is found in the corresponding
25  * .cpp file.
26  */
27 
28 #include "geode_globals.hpp"
29 #include "geode_types.hpp"
30 #include "Execution.hpp"
31 
36 // macros to resolve ambiguity between PoolPtr and RegionServicePtr
37 #define GF_TYPE_IS_POOL(T) \
38  apache::geode::client::TypeHelper::SuperSubclass< \
39  apache::geode::client::Pool, T>::result
40 #define GF_TYPE_IS_POOL_TYPE(T) \
41  apache::geode::client::TypeHelper::YesNoType<GF_TYPE_IS_POOL(T)>::value
42 
43 namespace apache {
44 namespace geode {
45 namespace client {
53  public:
72  static ExecutionPtr onRegion(RegionPtr region);
73 
87  inline static ExecutionPtr onServer(const PoolPtr& pool) {
88  return onServerWithPool(pool);
89  }
90 
105  inline static ExecutionPtr onServer(const RegionServicePtr& cache) {
106  return onServerWithCache(cache);
107  }
108 
109  template <typename T>
110  static ExecutionPtr onServer(const SharedPtr<T>& poolOrCache) {
111  return onServer(poolOrCache, GF_TYPE_IS_POOL_TYPE(T));
112  }
113 
127  inline static ExecutionPtr onServers(const PoolPtr& pool) {
128  return onServersWithPool(pool);
129  }
130 
145  inline static ExecutionPtr onServers(const RegionServicePtr& cache) {
146  return onServersWithCache(cache);
147  }
148 
149  template <typename T>
150  static ExecutionPtr onServers(const SharedPtr<T>& poolOrCache) {
151  return onServers(poolOrCache, GF_TYPE_IS_POOL_TYPE(T));
152  }
153 
154  virtual ~FunctionService() {}
155 
156  private:
157  static ExecutionPtr onServerWithPool(const PoolPtr& pool);
158 
159  static ExecutionPtr onServerWithCache(const RegionServicePtr& cache);
160 
161  static ExecutionPtr onServersWithPool(const PoolPtr& pool);
162 
163  static ExecutionPtr onServersWithCache(const RegionServicePtr& cache);
164 
165  template <typename T>
166  static ExecutionPtr onServer(const SharedPtr<T>& pool,
167  TypeHelper::yes_type isPool) {
168  return onServerWithPool(pool);
169  }
170 
171  template <typename T>
172  static ExecutionPtr onServer(const SharedPtr<T>& cache,
173  TypeHelper::no_type isPool) {
174  return onServerWithCache(cache);
175  }
176 
177  template <typename T>
178  static ExecutionPtr onServers(const SharedPtr<T>& pool,
179  TypeHelper::yes_type isPool) {
180  return onServersWithPool(pool);
181  }
182 
183  template <typename T>
184  static ExecutionPtr onServers(const SharedPtr<T>& cache,
185  TypeHelper::no_type isPool) {
186  return onServersWithCache(cache);
187  }
188 };
189 } // namespace client
190 } // namespace geode
191 } // namespace apache
192 
193 #endif // GEODE_FUNCTIONSERVICE_H_
Each enum represents a predefined RegionAttributes in a Cache.
Definition: Assert.hpp:31
static ExecutionPtr onServer(const PoolPtr &pool)
Returns a Execution object that can be used to execute a data independent function on a server in the...
Definition: FunctionService.hpp:87
#define CPPCACHE_EXPORT
Defines a Geode CPPCACHE export.
Definition: geode_base.hpp:58
entry point for function execution
Definition: FunctionService.hpp:52
static ExecutionPtr onServer(const RegionServicePtr &cache)
Returns a Execution object that can be used to execute a data independent function on a server where ...
Definition: FunctionService.hpp:105
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:52
static ExecutionPtr onServers(const RegionServicePtr &cache)
Returns a Execution object that can be used to execute a data independent function on all the servers...
Definition: FunctionService.hpp:145
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:40
static ExecutionPtr onServers(const PoolPtr &pool)
Returns a Execution object that can be used to execute a data independent function on all the servers...
Definition: FunctionService.hpp:127
This namespace contains all the Geode C++ API classes, enumerations and globals.

Pivotal GemFire C++ Cache API Documentation