build-artifacts/win/product/include/gfcpp/FunctionService.hpp

Go to the documentation of this file.
00001 #ifndef __GEMFIRE_FUNCTION_SERVICE_H__
00002 #define __GEMFIRE_FUNCTION_SERVICE_H__
00003 
00004 /*=========================================================================
00005   * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved.
00006  * This product is protected by U.S. and international copyright
00007  * and intellectual property laws. Pivotal products are covered by
00008  * more patents listed at http://www.pivotal.io/patents.
00009   *
00010   * The specification of function behaviors is found in the corresponding
00011   * .cpp file.
00012   *
00013   *========================================================================
00014   */
00015 
00016 #include "gfcpp_globals.hpp"
00017 #include "gf_types.hpp"
00018 #include "Execution.hpp"
00019 
00024 // macros to resolve ambiguity between PoolPtr and RegionServicePtr
00025 #define GF_TYPE_IS_POOL(T) \
00026   gemfire::TypeHelper::SuperSubclass<gemfire::Pool, T>::result
00027 #define GF_TYPE_IS_POOL_TYPE(T) \
00028   gemfire::TypeHelper::YesNoType<GF_TYPE_IS_POOL(T)>::value
00029 
00030 namespace gemfire {
00037   class CPPCACHE_EXPORT FunctionService : public SharedBase
00038 {
00039   public:
00058   static ExecutionPtr onRegion(RegionPtr region);
00059 
00073   inline static ExecutionPtr onServer(const PoolPtr& pool)
00074   {
00075     return onServerWithPool(pool);
00076   }
00077 
00092   inline static ExecutionPtr onServer(const RegionServicePtr& cache)
00093   {
00094     return onServerWithCache(cache);
00095   }
00096 
00097   template <typename T>
00098   static ExecutionPtr onServer(const SharedPtr<T>& poolOrCache)
00099   {
00100     return onServer(poolOrCache, GF_TYPE_IS_POOL_TYPE(T));
00101   }
00102   
00116   inline static ExecutionPtr onServers(const PoolPtr& pool)
00117   {
00118     return onServersWithPool(pool);
00119   }
00120 
00135   inline static ExecutionPtr onServers(const RegionServicePtr& cache)
00136   {
00137     return onServersWithCache(cache);
00138   }
00139 
00140   template <typename T>
00141   static ExecutionPtr onServers(const SharedPtr<T>& poolOrCache)
00142   {
00143     return onServers(poolOrCache, GF_TYPE_IS_POOL_TYPE(T));
00144   }
00145 
00146   virtual ~FunctionService()
00147   {
00148   }
00149 
00150 private:
00151 
00152   static ExecutionPtr onServerWithPool(const PoolPtr& pool);
00153 
00154   static ExecutionPtr onServerWithCache(const RegionServicePtr& cache);
00155 
00156   static ExecutionPtr onServersWithPool(const PoolPtr& pool);
00157 
00158   static ExecutionPtr onServersWithCache(const RegionServicePtr& cache);
00159 
00160   template <typename T>
00161   static ExecutionPtr onServer(const SharedPtr<T>& pool,
00162       TypeHelper::yes_type isPool)
00163   {
00164     return onServerWithPool(pool);
00165   }
00166 
00167   template <typename T>
00168   static ExecutionPtr onServer(const SharedPtr<T>& cache,
00169       TypeHelper::no_type isPool)
00170   {
00171     return onServerWithCache(cache);
00172   }
00173 
00174   template <typename T>
00175   static ExecutionPtr onServers(const SharedPtr<T>& pool,
00176       TypeHelper::yes_type isPool)
00177   {
00178     return onServersWithPool(pool);
00179   }
00180 
00181   template <typename T>
00182   static ExecutionPtr onServers(const SharedPtr<T>& cache,
00183       TypeHelper::no_type isPool)
00184   {
00185     return onServersWithCache(cache);
00186   }
00187 };
00188 
00189 } //namespace gemfire
00190 
00191 #endif //__GEMFIRE_FUNCTION_SERVICE_H__

GemFire C++ Cache API Documentation