CBaseServerMtm
CBaseServerMtm
implementations should define a factory function that is called by the Message Server to create a new instance of the Server-side MTM.
The definition varies between ER5 and later versions.
<concrete-type>* <concrete-type>::<function-name>(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry);
A concrete Server-side MTM must implement an exported factory function conforming to this signature. This function is not declared in the base class. It is typically named NewL()
, to conform to the general pattern for EPOC two-phase construction functions. It is called by the Server-side MTM registry when a client requests this Server-side MTM.
The function should create a new instance of the CBaseServerMtm
-derived class that provides the implementation, and perform any dynamic allocation required. The arguments received should be passed to the constructor.
The function is called by ordinal. The ordinal of the function must match that recorded in the MTM’s registry information. See CMtmDllInfo
for details.
For pre-Unicode variants see the previous factory function definition.
|
For example, a Server-side MTM whose concrete class was CEgMtmServ
could define a suitable factory function as:
EXPORT_C CEgMtmServ* CEgMtmServ::NewL(CRegisteredMtmDll& aRegisteredMtmDll,CMsvServerEntry* aInitialEntry)
{
CleanupStack::PushL(aInitialEntry);
CEgMtmServ* egSvrMtm=new(ELeave) CEgMtmServ
(aRegisteredMtmDll, aInitialEntry);
CleanupStack::Pop();
CleanupStack::PushL(egSvrMtm);
egSvrMtm->ConstructL();
CleanupStack::Pop();
return egSvrMtm;
}
A concrete Server-side MTM must implement an exported factory function conforming to this signature. This function is not declared in the base class. It is typically named NewL()
, to conform to the general pattern for EPOC two-phase construction functions. It is called by the Server-side MTM registry when a client requests this Server-side MTM.
The function should create a new instance of the CBaseServerMtm
-derived class that provides the implementation, and perform any dynamic allocation required. The argument received should be passed to the constructor.
The function is called by ordinal. The ordinal of the function must match that recorded in the MTM’s registry information. See CMtmDllInfo
for details.
For example, a Server-side MTM whose concrete class was CEgMtmServ
could define a suitable factory function as:
EXPORT_C CEgMtmServ* CEgMtmServ::NewL(CRegisteredMtmDll& aRegisteredMtmDll)
{
CEgMtmServ* egSvrMtm=new(ELeave) CEgMtmServ(aRegisteredMtmDll);
CleanupStack::PushL(egSvrMtm);
egSvrMtm->ConstructL();
CleanupStack::Pop();
return egSvrMtm;
}