2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FIo_ChannelManager.h
20 * @brief This is the header file for the _ChannelManager class.
22 * This file contains the declarations of _ChannelManager.
25 #ifndef _FIO_INTERNAL_CHANNEL_MANAGER_H_
26 #define _FIO_INTERNAL_CHANNEL_MANAGER_H_
28 #include <FBaseResult.h>
29 #include <FBaseObject.h>
30 #include <FBaseString.h>
31 #include <FBaseColHashMapT.h>
33 namespace Tizen { namespace Io
37 class _IChannelService;
42 * @class _ChannelManager
43 * @brief This class provides methods for managing _Channels
50 static _ChannelManager* GetInstance(void);
52 _Channel* GetChannel(const Tizen::Base::String& channelId);
54 ClientChannel* GetClientChannel(const Tizen::Base::String& channelName);
56 ServerChannel* GetServerChannel(const Tizen::Base::String& channelName);
58 void AddClientChannel(const Tizen::Base::String& channelName, ClientChannel* pChannel);
60 void AddServerChannel(const Tizen::Base::String& channelName, ServerChannel* pChannel);
63 _ChannelManager(void);
65 ~_ChannelManager(void);
67 result Construct(void);
69 _ChannelManager(const _ChannelManager& value);
71 _ChannelManager& operator =(const _ChannelManager& value);
73 class _StringHashProvider
74 : public Tizen::Base::Collection::IHashCodeProviderT<Tizen::Base::String>
77 virtual int GetHashCode(const Tizen::Base::String& value) const
79 return value.GetHashCode();
84 : public Tizen::Base::Collection::IComparerT<Tizen::Base::String>
87 virtual result Compare(const Tizen::Base::String& string1, const Tizen::Base::String& string2, int& cmp) const
89 cmp = string1.CompareTo(string2);
94 static void InitSingleton(void);
96 static void DestroySingleton(void);
99 Tizen::Base::Collection::HashMapT <Tizen::Base::String, _Channel*> __channels;
100 Tizen::Base::Collection::HashMapT <Tizen::Base::String, ClientChannel*> __clientChannels;
101 Tizen::Base::Collection::HashMapT <Tizen::Base::String, ServerChannel*> __serverChannels;
102 _IChannelService* __pIChannelService;
103 static _ChannelManager* __pChannelManagerInst;
104 }; // _ChannelManager
108 #endif // _FIO_INTERNAL_CHANNEL_MANAGER_H_