epoc32/include/comms-infras/ss_fact_internal.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     1 // Copyright (c) 2008-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  @internalTechnology
       
    19 */
       
    20 
       
    21 #if !defined(__SS_FACT_INTERNAL_H__)
       
    22 #define __SS_FACT_INTERNAL_H__
       
    23 
       
    24 #include <elements/factory.h>
       
    25 #include <elements/sd_objectbroker.h>
       
    26 
       
    27 namespace ESock
       
    28 {
       
    29 
       
    30 class CCommsFactoryBase;
       
    31 class ACommsFactoryNodeId;
       
    32 
       
    33 // We need to redeclare this for the CMetaConnectionProviderBase x86gcc cast operators to work.
       
    34 #ifndef __CCOMMSFACTORYCONTAINER_DECLARED
       
    35 #define __CCOMMSFACTORYCONTAINER_DECLARED
       
    36 NONSHARABLE_CLASS(CCommsFactoryContainer) : public Factories::CFactoryContainerNode
       
    37 /** Comms Factory Factory Container class is used to store comms factorys of a
       
    38     specific type. e.g. sub-connection provider factories. It provides basic
       
    39 	functionality to find, add and remove factories. It has basic functionality to
       
    40 	create a factory object. If a container wants to do more than just creating a 
       
    41 	factory object it should specialise the CCommsFactoryContainer
       
    42 
       
    43 @internalTechnology
       
    44 @released Since 9.0 */
       
    45 	{
       
    46 	friend class CPitBoss;	// CPitBoss enumerates factories without needing (or wanting) derived types
       
    47 
       
    48 #ifdef __X86GCC__
       
    49  	// gcc-mingw does not support declaring friends from different namespaces so we define proxy
       
    50  	// functions to do the cast.
       
    51     friend  CCommsFactoryContainer* __x86gcc_comms_factory_container_cast(Messages::ANode* aNode);
       
    52     friend  CCommsFactoryContainer& __x86gcc_comms_factory_container_cast(Messages::ANode& aNode);
       
    53 #elif !defined(__GCCXML__)
       
    54 	friend CCommsFactoryContainer* Messages::mnode_cast<CCommsFactoryContainer>(Messages::ANode* aNode);
       
    55 #endif
       
    56 	
       
    57 public:
       
    58 	IMPORT_C Factories::CFactoryBase* FindOrCreateFactoryL(TUid aUid);	
       
    59 	IMPORT_C ACommsFactoryNodeId* Find (Factories::MFactoryQuery& aQuery);
       
    60 protected:
       
    61 	Factories::CFactoryBase* CreateFactoryL(TUid aUid);	
       
    62 	ACommsFactoryNodeId* CreateFactoryObjectNodeL(Messages::TSignatureBase& aMessage);
       
    63     virtual void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage);
       
    64 	
       
    65 protected:
       
    66     //Type information for the planes.
       
    67     enum TContaineeType
       
    68         {
       
    69         EUnknown = 0,
       
    70 	    ETierManagerFactoryContainer,
       
    71 	    EMetaConnectionFactoryContainer,
       
    72 	    EConnectionFactoryContainer,
       
    73 	    ESubConnectionFactoryContainer,
       
    74 	    ESubConnectionFlowFactoryContainer,
       
    75 		EProtocolIntfFactoryContainer,
       
    76 		EProtocolFamilyFactoryContainer,
       
    77         };
       
    78 	CCommsFactoryContainer(TContaineeType aId = EUnknown);
       
    79 public:
       
    80      const TContaineeType iId;
       
    81 
       
    82 public:
       
    83 	static CCommsFactoryContainer* NewL (TContaineeType aId);
       
    84 	};
       
    85 #endif // __CCOMMSFACTORYCONTAINER_DECLARED
       
    86 
       
    87 
       
    88 class CCFFactoryContainerBroker : public Den::CCommonObjectBroker
       
    89 /**
       
    90 This object broker is intended to be a per technology singleton that forwards
       
    91 factory requests to a specified factory container.
       
    92 
       
    93 Factory containers are added to its client list during the handshaking at worker thread
       
    94 initialisation.
       
    95 
       
    96 @internalTechnology
       
    97 */
       
    98 	{
       
    99 public:
       
   100 	static CCFFactoryContainerBroker* NewL();
       
   101 
       
   102 protected:
       
   103 	void ReceivedL(const Messages::TRuntimeCtxId& aSender, const Messages::TNodeId& aRecipient, Messages::TSignatureBase& aMessage);
       
   104 	CCFFactoryContainerBroker();
       
   105 	};
       
   106 
       
   107 #ifdef __X86GCC__
       
   108  	// gcc-mingw does not support declaring friends from different namespaces so we define proxy
       
   109  	// functions to do the cast...
       
   110  	
       
   111 	inline CCommsFactoryContainer* __x86gcc_comms_factory_container_cast(Messages::ANode* aNode)
       
   112     	{
       
   113     	return static_cast<CCommsFactoryContainer*>(aNode);
       
   114     	}
       
   115 
       
   116 	inline CCommsFactoryContainer& __x86gcc_comms_factory_container_cast(Messages::ANode& aNode)
       
   117     	{
       
   118     	return static_cast<CCommsFactoryContainer&>(aNode);
       
   119     	}
       
   120 #endif
       
   121 }
       
   122 
       
   123 
       
   124 #ifdef __X86GCC__
       
   125 	namespace Messages
       
   126 	{
       
   127  	// gcc-mingw does not support declaring friends from different namespaces so we define proxy
       
   128  	// functions to do the cast...
       
   129  	
       
   130 	template <>
       
   131 	inline ESock::CCommsFactoryContainer* mnode_cast<ESock::CCommsFactoryContainer>(Messages::ANode* aNode)
       
   132 		{
       
   133 		return ESock::__x86gcc_comms_factory_container_cast(aNode);
       
   134 		}
       
   135 
       
   136 	template <>
       
   137 	inline ESock::CCommsFactoryContainer& mnode_cast<ESock::CCommsFactoryContainer>(Messages::ANode& aNode)
       
   138 		{
       
   139 		return ESock::__x86gcc_comms_factory_container_cast(aNode);
       
   140 		}
       
   141 	}
       
   142 #endif
       
   143 
       
   144 #endif
       
   145 // __SS_FACT_INTERNAL_H__