Merge "Remove build warning and add temporary getter of privacy name" into tizen_2.1
[platform/framework/native/appfw.git] / src / io / inc / FIo_MessagePortManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file                FIo_MessagePortManagerImpl.h
19  * @brief               This is the header file for the %_MessagePortManagerImpl class.
20  *
21  * This header file contains the declarations of the %_MessagePortManagerImpl class.
22  */
23 #ifndef _FIO_INTERNAL_MESSAGE_PORT_MANAGER_H_
24 #define _FIO_INTERNAL_MESSAGE_PORT_MANAGER_H_
25
26 #include <FBaseResult.h>
27 #include <FBaseObject.h>
28 #include <FBaseDataType.h>
29 #include <FBaseColHashMapT.h>
30 #include <FAppTypes.h>
31
32 namespace Tizen { namespace Io
33 {
34
35 class LocalMessagePort;
36 class RemoteMessagePort;
37
38 class _OSP_EXPORT_ _MessagePortManagerImpl
39 {
40 public:
41         virtual ~_MessagePortManagerImpl(void);
42
43         static _MessagePortManagerImpl* GetInstance(void);
44
45         LocalMessagePort* RequestLocalMessagePort(const Tizen::Base::String& localPort);
46         RemoteMessagePort* RequestRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remotePort);
47
48         LocalMessagePort* RequestTrustedLocalMessagePort(const Tizen::Base::String& localPort);
49         RemoteMessagePort* RequestTrustedRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remotePort);
50
51         RemoteMessagePort* GetRemoteMessagePort(const Tizen::App::AppId& remoteAppId, const Tizen::Base::String& remotePort, bool isTrusted);
52
53 private:
54         _MessagePortManagerImpl(void);
55         _MessagePortManagerImpl(const _MessagePortManagerImpl& channelManagerImpl);
56         _MessagePortManagerImpl& operator =(const _MessagePortManagerImpl& channelManagerImpl);
57
58         result Construct(void);
59
60         static void InitSingleton(void);
61
62         static void DestroySingleton(void);
63
64 private:
65         class _StringHashProvider
66                 : public Tizen::Base::Collection::IHashCodeProviderT<Tizen::Base::String>
67         {
68         public:
69                 virtual int GetHashCode(const Tizen::Base::String& value) const
70                 {
71                         return value.GetHashCode();
72                 }
73         };
74
75         class _StringComparer
76                 : public Tizen::Base::Collection::IComparerT<Tizen::Base::String>
77         {
78         public:
79                 virtual result Compare(const Tizen::Base::String& string1, const Tizen::Base::String& string2, int& cmp) const
80                 {
81                         cmp = string1.CompareTo(string2);
82                         return E_SUCCESS;
83                 }
84         };
85
86 private:
87         Tizen::Base::Collection::HashMapT<Tizen::Base::String, LocalMessagePort*> __localPorts;
88         Tizen::Base::Collection::HashMapT<Tizen::Base::String, LocalMessagePort*> __trustLocalPorts;
89         Tizen::Base::Collection::HashMapT<Tizen::Base::String, RemoteMessagePort*> __remotePorts;
90         Tizen::Base::Collection::HashMapT<Tizen::Base::String, RemoteMessagePort*> __trustRemotePorts;
91         static _MessagePortManagerImpl* __pMessagePortMgrImplInst;
92
93 }; // _MessagePortManagerImpl
94
95 } } // Tizen::Io
96
97 #endif //_FIO_INTERNAL_MESSAGE_PORT_MANAGER_H_