examples/ForumNokia/EComCalculator/interface/EComInterfaceDefinition.inl

00001 /*
00002  * ============================================================================
00003  *  Name     : CCalculationInterfaceDefinition from EComInterfaceDefinition.inl
00004  *  Part of  : EComCalculator
00005  *  Created  : 17/11/2003 by Forum Nokia
00006  *  Version  : 1.0
00007  *  Copyright: Nokia Corporation
00008  * ============================================================================
00009  */
00010 
00011 // Interface's (abstract base class's) destructor
00012 inline CCalculationInterfaceDefinition::~CCalculationInterfaceDefinition()
00013     {
00014     // If in the NewL some memory is reserved for member data, it must be
00015     // released here. This interface does not have any instance variables so
00016     // no need to delete anything.
00017 
00018     // Inform the ECOM framework that this specific instance of the
00019     // interface has been destroyed.
00020     REComSession::DestroyedImplementation(iDtor_ID_Key);
00021     }
00022 
00023 // Interface's (abstract base class's) static factory method implementation.
00024 // Asks ECOM plugin framework to instantiate appropriate concret plugin
00025 // implementation.
00026 inline CCalculationInterfaceDefinition*
00027     CCalculationInterfaceDefinition::NewL(const TDesC8& aOperationName)
00028     {
00029     // In this example the aOperationName name can be either "sum" or
00030     // "multiply". Implementations define recognition data in their
00031     // "default_data" section of the resource, so that resolver can decide,
00032     // which implementation to choose. For an example resource definition, see
00033     //     ..\plugin\101F5465.rss
00034     // This NewL uses default resolver, which just compares given
00035     // aOperationName and default_data string in the implementation
00036     // resource file.
00037 
00038     // Define options, how the default resolver will find appropriate
00039     // implementation.
00040     TEComResolverParams resolverParams;
00041     resolverParams.SetDataType(aOperationName);
00042     resolverParams.SetWildcardMatch(ETrue);     // Allow wildcard matching
00043 
00044     // Find implementation for our interface.
00045     // - KCalculateInterfaceDefinitionUid is the UID of our custom ECOM
00046     //   interface. It is defined in EComInterfaceDefinition.h
00047     // - This call will leave, if the plugin architecture cannot find
00048     //   implementation.
00049     // - The returned pointer points to one of our interface implementation
00050     //   instances.
00051     TAny* ptr = REComSession::CreateImplementationL(
00052         KCalculateInterfaceDefinitionUid,
00053         _FOFF(CCalculationInterfaceDefinition,iDtor_ID_Key),
00054                 // _FOFF specifies offset of iDtor_ID_Key so that
00055                 // ECOM framework can update its value.
00056         resolverParams);
00057 
00058     // The type of TAny* ptr should be CCalculationInterfaceDefinition.
00059     return REINTERPRET_CAST(CCalculationInterfaceDefinition*, ptr);
00060     }

Generated by  doxygen 1.6.2