2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FIo_ChannelManager.h
19 * @brief This is the header file for the _ChannelManager class.
21 * This file contains the declarations of _ChannelManager.
24 #ifndef _FIO_INTERNAL_CHANNEL_MANAGER_H_
25 #define _FIO_INTERNAL_CHANNEL_MANAGER_H_
27 #include <FBaseResult.h>
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FBaseColHashMapT.h>
32 namespace Tizen { namespace Io
36 class _IChannelService;
41 * @class _ChannelManager
42 * @brief This class provides methods for managing _Channels
49 static _ChannelManager* GetInstance(void);
51 _Channel* GetChannel(const Tizen::Base::String& channelId);
53 ClientChannel* GetClientChannel(const Tizen::Base::String& channelName);
55 ServerChannel* GetServerChannel(const Tizen::Base::String& channelName);
57 void AddClientChannel(const Tizen::Base::String& channelName, ClientChannel* pChannel);
59 void AddServerChannel(const Tizen::Base::String& channelName, ServerChannel* pChannel);
62 _ChannelManager(void);
64 ~_ChannelManager(void);
66 result Construct(void);
68 _ChannelManager(const _ChannelManager& value);
70 _ChannelManager& operator =(const _ChannelManager& value);
72 class _StringHashProvider
73 : public Tizen::Base::Collection::IHashCodeProviderT<Tizen::Base::String>
76 virtual int GetHashCode(const Tizen::Base::String& value) const
78 return value.GetHashCode();
83 : public Tizen::Base::Collection::IComparerT<Tizen::Base::String>
86 virtual result Compare(const Tizen::Base::String& string1, const Tizen::Base::String& string2, int& cmp) const
88 cmp = string1.CompareTo(string2);
93 static void InitSingleton(void);
95 static void DestroySingleton(void);
98 Tizen::Base::Collection::HashMapT <Tizen::Base::String, _Channel*> __channels;
99 Tizen::Base::Collection::HashMapT <Tizen::Base::String, ClientChannel*> __clientChannels;
100 Tizen::Base::Collection::HashMapT <Tizen::Base::String, ServerChannel*> __serverChannels;
101 _IChannelService* __pIChannelService;
102 static _ChannelManager* __pChannelManagerInst;
103 }; // _ChannelManager
107 #endif // _FIO_INTERNAL_CHANNEL_MANAGER_H_