1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef _WRAPPER_FACTORY_H_
22 #define _WRAPPER_FACTORY_H_
26 #include "IClientWrapper.h"
27 #include "IServerWrapper.h"
28 #include <OutOfProcClientWrapper.h>
29 #include <InProcClientWrapper.h>
30 #include <OutOfProcServerWrapper.h>
31 #include <InProcServerWrapper.h>
35 // Interface to permit easier mocking/unit testing later
39 typedef std::shared_ptr<IWrapperFactory> Ptr;
41 virtual IClientWrapper::Ptr CreateClientWrapper(std::weak_ptr<std::mutex> csdkLock, PlatformConfig cfg) =0;
42 virtual IServerWrapper::Ptr CreateServerWrapper(std::weak_ptr<std::mutex> csdkLock, PlatformConfig cfg) =0;
43 virtual ~IWrapperFactory(){}
46 // Class to create the client/server object!
47 class WrapperFactory : public IWrapperFactory
52 virtual IClientWrapper::Ptr CreateClientWrapper(std::weak_ptr<std::mutex> csdkLock, PlatformConfig cfg)
54 switch(cfg.serviceType)
56 case ServiceType::InProc:
57 return std::make_shared<InProcClientWrapper>(csdkLock, cfg);
59 case ServiceType::OutOfProc:
60 return std::make_shared<OutOfProcClientWrapper>(csdkLock, cfg);
66 virtual IServerWrapper::Ptr CreateServerWrapper(std::weak_ptr<std::mutex> csdkLock, PlatformConfig cfg)
68 switch(cfg.serviceType)
70 case ServiceType::InProc:
71 return std::make_shared<InProcServerWrapper>(csdkLock, cfg);
73 case ServiceType::OutOfProc:
74 // return std::make_shared<OutOfProcServerWrapper>(csdkLock, cfg);
80 virtual ~WrapperFactory(){}