|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Container for sharable endpoints. Sharable endpoints can be |
|
15 found using name (wstring) |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef COMMSCONTEXT_H |
|
20 #define COMMSCONTEXT_H |
|
21 #include <map> |
|
22 #include <string> |
|
23 |
|
24 #include "javaosheaders.h" |
|
25 #include "scopedlocks.h" |
|
26 |
|
27 using std::wstring; |
|
28 |
|
29 namespace java |
|
30 { |
|
31 namespace comms |
|
32 { |
|
33 class CommsClientEndpoint; |
|
34 class CommsServerEndpoint; |
|
35 |
|
36 OS_NONSHARABLE_CLASS(CommsContext) |
|
37 { |
|
38 public: |
|
39 CommsContext(); |
|
40 virtual ~CommsContext(); |
|
41 static CommsContext& getContext(); |
|
42 |
|
43 void add(CommsClientEndpoint* endpoint, const wstring& name); |
|
44 void remove(CommsClientEndpoint* endpoint); |
|
45 CommsClientEndpoint* find(const wstring& name); |
|
46 |
|
47 void add(CommsServerEndpoint* endpoint, const wstring& name); |
|
48 void remove(CommsServerEndpoint* endpoint); |
|
49 CommsServerEndpoint* findServer(const wstring& name); |
|
50 |
|
51 private: |
|
52 typedef std::map<CommsClientEndpoint*, wstring*> endpoints_t; |
|
53 endpoints_t mEndpoints; |
|
54 |
|
55 typedef std::map<CommsServerEndpoint*, wstring*> serverEndpoints_t; |
|
56 serverEndpoints_t mServerEndpoints; |
|
57 |
|
58 java::util::ScopedMutex mEndpointsMutex; |
|
59 }; |
|
60 |
|
61 } // namespace comms |
|
62 } // namespace java |
|
63 |
|
64 #endif // COMMSCONTEXT_H |