|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedPartner |
|
19 @released |
|
20 */ |
|
21 |
|
22 #if !defined(__SS_FACT_H__) |
|
23 #define __SS_FACT_H__ |
|
24 |
|
25 #include <elements/factory.h> |
|
26 #include <comms-infras/ss_nodemessages.h> |
|
27 #include <elements/sd_objectbroker.h> |
|
28 |
|
29 namespace NetMessages |
|
30 { |
|
31 class CMessage; |
|
32 } |
|
33 |
|
34 namespace ESock |
|
35 { |
|
36 class ACommsFactoryNodeId; |
|
37 class CCommsFactoryContainer; |
|
38 |
|
39 NONSHARABLE_CLASS(CCommsFactoryBase) : public Factories::CFactoryBase |
|
40 /** Comms Factory Base class (Specialised by sub-connection provider factories |
|
41 and other provider factories in future. It provides basic object managment |
|
42 functionlity and the ability for a factory to be load from another Dynamic |
|
43 Linked Library via the ECOM framework. |
|
44 |
|
45 It also provides asynchronous destruction for it's managed objects (if |
|
46 required) but also copes with synchronous destruction, should a managed |
|
47 object get deleted by another entity. |
|
48 |
|
49 @publishedPartner |
|
50 @released Since 9.0 */ |
|
51 { |
|
52 public: |
|
53 /* |
|
54 @internalTechnology |
|
55 */ |
|
56 IMPORT_C ACommsFactoryNodeId* FindOrCreateObjectL(TFactoryQueryBase& aQuery); |
|
57 IMPORT_C ACommsFactoryNodeId* CreateObjectL(TFactoryQueryBase& aQuery); |
|
58 IMPORT_C ACommsFactoryNodeId* Find(Factories::MFactoryQuery& aQuery); |
|
59 IMPORT_C TInt SendMessage(NetMessages::CMessage& aNetMessage); |
|
60 IMPORT_C virtual ~CCommsFactoryBase(); |
|
61 protected: |
|
62 /* |
|
63 @internalTechnology |
|
64 */ |
|
65 IMPORT_C CCommsFactoryBase(TUid aFactoryUid, CCommsFactoryContainer& aParentContainer); |
|
66 IMPORT_C virtual TInt DoReceiveMessage(NetMessages::CMessage& aNetMessage); |
|
67 IMPORT_C virtual ACommsFactoryNodeId* DoFindOrCreateObjectL(TFactoryQueryBase& aQuery); |
|
68 IMPORT_C virtual void DoPostCreationL(ACommsFactoryNodeId* aObject,TFactoryQueryBase& aQuery); |
|
69 virtual ACommsFactoryNodeId* DoCreateObjectL(TFactoryQueryBase& aQuery) =0; |
|
70 }; |
|
71 |
|
72 class ACommsFactoryNodeId : public Factories::AFactoryObject, |
|
73 public Messages::ASimpleNodeIdBase |
|
74 /** Base class for the comms factory object. A concrete factory object that wants |
|
75 to be a node should be derived from this. |
|
76 |
|
77 @publishedPartner |
|
78 @released Since 9.5 */ |
|
79 { |
|
80 public: |
|
81 IMPORT_C ~ACommsFactoryNodeId (); |
|
82 protected: |
|
83 IMPORT_C ACommsFactoryNodeId (CCommsFactoryBase& aFactory); |
|
84 }; |
|
85 |
|
86 // We do not want to include ss_fact_internal.h in this header and we cannot export |
|
87 // non-inline versions of __x86gcc_meta_connection_provider_base_cast which rely on |
|
88 // internals from CCommsFactoryContainer from the ss_metaconnprov.cpp file without |
|
89 // changing the ARM .def file (the x86gcc .def files are built on the fly from ARM) |
|
90 // so we redeclare this class here and #ifdef out the one in ss_fact_internal.h |
|
91 // depending on which is included first. |
|
92 #ifndef __CCOMMSFACTORYCONTAINER_DECLARED |
|
93 #define __CCOMMSFACTORYCONTAINER_DECLARED |
|
94 NONSHARABLE_CLASS(CCommsFactoryContainer) : public Factories::CFactoryContainerNode |
|
95 /** Comms Factory Factory Container class is used to store comms factorys of a |
|
96 specific type. e.g. sub-connection provider factories. It provides basic |
|
97 functionality to find, add and remove factories. It has basic functionality to |
|
98 create a factory object. If a container wants to do more than just creating a |
|
99 factory object it should specialise the CCommsFactoryContainer |
|
100 |
|
101 @internalTechnology |
|
102 @released Since 9.0 */ |
|
103 { |
|
104 friend class CPitBoss; // CPitBoss enumerates factories without needing (or wanting) derived types |
|
105 |
|
106 #ifdef __X86GCC__ |
|
107 // gcc-mingw does not support declaring friends from different namespaces so we define proxy |
|
108 // functions to do the cast. |
|
109 friend CCommsFactoryContainer* __x86gcc_comms_factory_container_cast(Messages::ANode* aNode); |
|
110 friend CCommsFactoryContainer& __x86gcc_comms_factory_container_cast(Messages::ANode& aNode); |
|
111 #elif !defined(__GCCXML__) |
|
112 friend CCommsFactoryContainer* Messages::mnode_cast<CCommsFactoryContainer>(Messages::ANode* aNode); |
|
113 #endif |
|
114 |
|
115 public: |
|
116 IMPORT_C Factories::CFactoryBase* FindOrCreateFactoryL(TUid aUid); |
|
117 IMPORT_C ACommsFactoryNodeId* Find (Factories::MFactoryQuery& aQuery); |
|
118 protected: |
|
119 Factories::CFactoryBase* CreateFactoryL(TUid aUid); |
|
120 ACommsFactoryNodeId* CreateFactoryObjectNodeL(Messages::TSignatureBase& aMessage); |
|
121 virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage); |
|
122 |
|
123 protected: |
|
124 //Type information for the planes. |
|
125 enum TContaineeType |
|
126 { |
|
127 EUnknown = 0, |
|
128 ETierManagerFactoryContainer, |
|
129 EMetaConnectionFactoryContainer, |
|
130 EConnectionFactoryContainer, |
|
131 ESubConnectionFactoryContainer, |
|
132 ESubConnectionFlowFactoryContainer, |
|
133 EProtocolIntfFactoryContainer, |
|
134 EProtocolFamilyFactoryContainer, |
|
135 }; |
|
136 CCommsFactoryContainer(TContaineeType aId = EUnknown); |
|
137 public: |
|
138 const TContaineeType iId; |
|
139 |
|
140 public: |
|
141 static CCommsFactoryContainer* NewL (TContaineeType aId); |
|
142 }; |
|
143 #endif // __CCOMMSFACTORYCONTAINER_DECLARED |
|
144 } // namespace ESock |
|
145 |
|
146 #endif // __SS_FACT_H__ |
|
147 |