VMware GemFire Native Client Cache Reference  9.0.6
FunctionService.hpp
Go to the documentation of this file.
1 #ifndef __GEMFIRE_FUNCTION_SERVICE_H__
2 #define __GEMFIRE_FUNCTION_SERVICE_H__
3 
4 /*=========================================================================
5  * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
6  * This product is protected by U.S. and international copyright
7  * and intellectual property laws. Pivotal products are covered by
8  * more patents listed at http://www.pivotal.io/patents.
9  *
10  * The specification of function behaviors is found in the corresponding
11  * .cpp file.
12  *
13  *========================================================================
14  */
15 
16 #include "gfcpp_globals.hpp"
17 #include "gf_types.hpp"
18 #include "Execution.hpp"
19 
24 // macros to resolve ambiguity between PoolPtr and RegionServicePtr
25 #define GF_TYPE_IS_POOL(T) \
26  gemfire::TypeHelper::SuperSubclass<gemfire::Pool, T>::result
27 #define GF_TYPE_IS_POOL_TYPE(T) \
28  gemfire::TypeHelper::YesNoType<GF_TYPE_IS_POOL(T)>::value
29 
30 namespace gemfire {
38 {
39  public:
58  static ExecutionPtr onRegion(RegionPtr region);
59 
73  inline static ExecutionPtr onServer(const PoolPtr& pool)
74  {
75  return onServerWithPool(pool);
76  }
77 
92  inline static ExecutionPtr onServer(const RegionServicePtr& cache)
93  {
94  return onServerWithCache(cache);
95  }
96 
97  template <typename T>
98  static ExecutionPtr onServer(const SharedPtr<T>& poolOrCache)
99  {
100  return onServer(poolOrCache, GF_TYPE_IS_POOL_TYPE(T));
101  }
102 
116  inline static ExecutionPtr onServers(const PoolPtr& pool)
117  {
118  return onServersWithPool(pool);
119  }
120 
135  inline static ExecutionPtr onServers(const RegionServicePtr& cache)
136  {
137  return onServersWithCache(cache);
138  }
139 
140  template <typename T>
141  static ExecutionPtr onServers(const SharedPtr<T>& poolOrCache)
142  {
143  return onServers(poolOrCache, GF_TYPE_IS_POOL_TYPE(T));
144  }
145 
146  virtual ~FunctionService()
147  {
148  }
149 
150 private:
151 
152  static ExecutionPtr onServerWithPool(const PoolPtr& pool);
153 
154  static ExecutionPtr onServerWithCache(const RegionServicePtr& cache);
155 
156  static ExecutionPtr onServersWithPool(const PoolPtr& pool);
157 
158  static ExecutionPtr onServersWithCache(const RegionServicePtr& cache);
159 
160  template <typename T>
161  static ExecutionPtr onServer(const SharedPtr<T>& pool,
162  TypeHelper::yes_type isPool)
163  {
164  return onServerWithPool(pool);
165  }
166 
167  template <typename T>
168  static ExecutionPtr onServer(const SharedPtr<T>& cache,
169  TypeHelper::no_type isPool)
170  {
171  return onServerWithCache(cache);
172  }
173 
174  template <typename T>
175  static ExecutionPtr onServers(const SharedPtr<T>& pool,
176  TypeHelper::yes_type isPool)
177  {
178  return onServersWithPool(pool);
179  }
180 
181  template <typename T>
182  static ExecutionPtr onServers(const SharedPtr<T>& cache,
183  TypeHelper::no_type isPool)
184  {
185  return onServersWithCache(cache);
186  }
187 };
188 
189 } //namespace gemfire
190 
191 #endif //__GEMFIRE_FUNCTION_SERVICE_H__
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:73
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:135
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:116
This namespace contains all the GemFire C++ API classes, enumerations and globals.
Definition: Assert.hpp:19
entry point for function execution
Definition: FunctionService.hpp:37
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:92
#define CPPCACHE_EXPORT
Defines a GemFire CPPCACHE export.
Definition: gf_base.hpp:51
This abstract base class is the base class of all user objects that have the shared capability of ref...
Definition: SharedBase.hpp:31
Defines a reference counted shared pointer.
Definition: SharedPtr.hpp:35

GemFire C++ Cache API Documentation