ServantProxyFactory.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * Tencent is pleased to support the open source community by making Tars available.
  3. *
  4. * Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
  5. *
  6. * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
  7. * in compliance with the License. You may obtain a copy of the License at
  8. *
  9. * https://opensource.org/licenses/BSD-3-Clause
  10. *
  11. * Unless required by applicable law or agreed to in writing, software distributed
  12. * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  13. * CONDITIONS OF ANY KIND, either express or implied. See the License for the
  14. * specific language governing permissions and limitations under the License.
  15. */
  16. #ifndef __TARS_SERVANT_PROXY_FACTORY_H_
  17. #define __TARS_SERVANT_PROXY_FACTORY_H_
  18. #include "servant/Global.h"
  19. #include "servant/Communicator.h"
  20. #include "servant/ServantProxy.h"
  21. namespace tars
  22. {
  23. /////////////////////////////////////////////////////////////////////////////////////////
  24. /**
  25. * 创建ServantProxy对象,每个object在进程空间只有一个ServantProxy实例
  26. */
  27. class ServantProxyFactory : public TC_ThreadRecMutex
  28. {
  29. public:
  30. /**
  31. * 构造函数
  32. * @param comm
  33. */
  34. ServantProxyFactory(Communicator* comm);
  35. /**
  36. * 析构
  37. */
  38. ~ServantProxyFactory();
  39. /**
  40. * 获取ServantProxy对象
  41. * @param name
  42. * @param setName 指定set调用的setid
  43. * @return ServantPrx
  44. */
  45. ServantPrx::element_type* getServantProxy(const string& name,const string& setName, bool rootServant);
  46. private:
  47. /**
  48. * 通信器
  49. */
  50. Communicator* _comm;
  51. /**
  52. * 已创建的对象
  53. */
  54. map<string, ServantPrx> _servantProxy;
  55. };
  56. //////////////////////////////////////////////////////
  57. }
  58. #endif