PECengine/AttributeLibrary2/Src/PEngAttrLibFactory.cpp
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2004 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:  PEngAttrLibFactory - object factory
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include    "PEngAttrLibFactory.h"
       
    20 #include    "CPEngAttrLibObjectHolder.h"
       
    21 #include    "CPEngSessionSlotId.h"
       
    22 
       
    23 #include    "MPEngPresenceAttrManager.h"
       
    24 #include    "MPEngPresenceAttrTransactionEnv.h"
       
    25 #include    "MPEngTransactionFactory.h"
       
    26 
       
    27 #include    <E32Std.h>
       
    28 
       
    29 
       
    30 // ============================ MEMBER FUNCTIONS ===============================
       
    31 
       
    32 // -----------------------------------------------------------------------------
       
    33 // PEngAttrLibFactory::AttributeManagerInstanceL()
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 EXPORT_C MPEngPresenceAttrManager* PEngAttrLibFactory::AttributeManagerInstanceL(
       
    37     const CPEngSessionSlotId& aSlotId )
       
    38     {
       
    39     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::InstanceLC();
       
    40     MPEngPresenceAttrManager* instance = holder->AttributeManagerInstanceL( aSlotId );
       
    41     CleanupStack::PopAndDestroy(); // holder
       
    42 
       
    43     return instance;
       
    44     }
       
    45 
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // PEngAttrLibFactory::AttributeManagerInstanceLC()
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 EXPORT_C MPEngPresenceAttrManager* PEngAttrLibFactory::AttributeManagerInstanceLC(
       
    52     const CPEngSessionSlotId& aSlotId )
       
    53     {
       
    54     MPEngPresenceAttrManager* instance = AttributeManagerInstanceL( aSlotId );
       
    55     CleanupClosePushL( *instance );
       
    56 
       
    57     return instance;
       
    58     }
       
    59 
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // PEngAttrLibFactory::AttributeTransEnvInstanceL()
       
    63 // -----------------------------------------------------------------------------
       
    64 //
       
    65 EXPORT_C MPEngPresenceAttrTransactionEnv* PEngAttrLibFactory::AttributeTransEnvInstanceL(
       
    66     const CPEngSessionSlotId& aSlotId )
       
    67     {
       
    68     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::InstanceLC();
       
    69     MPEngPresenceAttrTransactionEnv* instance = holder->AttributeTransEnvInstanceL( aSlotId );
       
    70     CleanupStack::PopAndDestroy(); // holder
       
    71 
       
    72     return instance;
       
    73     }
       
    74 
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // PEngAttrLibFactory::AttributeTransEnvInstanceLC()
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 EXPORT_C MPEngPresenceAttrTransactionEnv* PEngAttrLibFactory::AttributeTransEnvInstanceLC(
       
    81     const CPEngSessionSlotId& aSlotId )
       
    82     {
       
    83     MPEngPresenceAttrTransactionEnv* instance = AttributeTransEnvInstanceL( aSlotId );
       
    84     CleanupClosePushL( *instance );
       
    85 
       
    86     return instance;
       
    87     }
       
    88 
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // PEngAttrLibFactory::AttributeTransFactoryInstanceL()
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 EXPORT_C MPEngTransactionFactory* PEngAttrLibFactory::AttributeTransFactoryInstanceL(
       
    95     const CPEngSessionSlotId& aSlotId )
       
    96 
       
    97     {
       
    98     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::InstanceLC();
       
    99     MPEngTransactionFactory* instance = holder->AttributeTransFactInstanceL( aSlotId );
       
   100     CleanupStack::PopAndDestroy(); // holder
       
   101 
       
   102     return instance;
       
   103     }
       
   104 
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // PEngAttrLibFactory::AttributeTransFactoryInstanceLC()
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 EXPORT_C MPEngTransactionFactory* PEngAttrLibFactory::AttributeTransFactoryInstanceLC(
       
   111     const CPEngSessionSlotId& aSlotId )
       
   112     {
       
   113     MPEngTransactionFactory* instance = AttributeTransFactoryInstanceL( aSlotId );
       
   114     CleanupClosePushL( *instance );
       
   115 
       
   116     return instance;
       
   117 
       
   118     }
       
   119 
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // PEngAttrLibFactory::__DbgObjectCounts()
       
   123 // Debug helper
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 EXPORT_C void PEngAttrLibFactory::__DbgObjectCounts( TInt& aHolder,
       
   127                                                      TInt& aAttrMan,
       
   128                                                      TInt& aTransEnv,
       
   129                                                      TInt& aTransFact )
       
   130     {
       
   131 #ifdef _DEBUG
       
   132 
       
   133     aHolder = KErrNotFound;
       
   134     aAttrMan = KErrNotFound;
       
   135     aTransEnv = KErrNotFound;
       
   136     aTransFact = KErrNotFound;
       
   137 
       
   138     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::__DbgInstanceOrNull();
       
   139     if ( holder )
       
   140         {
       
   141         holder->__DbgObjectCounts( aHolder, aAttrMan, aTransEnv, aTransFact );
       
   142         }
       
   143 
       
   144 #else
       
   145 
       
   146     // suppress the unreferenced variable warnings
       
   147     ( void ) aHolder;
       
   148     ( void ) aAttrMan;
       
   149     ( void ) aTransEnv;
       
   150     ( void ) aTransFact;
       
   151 
       
   152 #endif //_DEBUG
       
   153     }
       
   154 
       
   155 
       
   156 // -----------------------------------------------------------------------------
       
   157 // PEngAttrLibFactory::__DbgAttrManRefCount()
       
   158 // Debug helper
       
   159 // -----------------------------------------------------------------------------
       
   160 //
       
   161 EXPORT_C void PEngAttrLibFactory::__DbgAttrManRefCount( const CPEngSessionSlotId& aSlotId,
       
   162                                                         TInt& aRefCount )
       
   163     {
       
   164 #ifdef _DEBUG
       
   165 
       
   166     aRefCount = KErrNotFound;
       
   167     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::__DbgInstanceOrNull();
       
   168     if ( holder )
       
   169         {
       
   170         holder->__DbgAttrManRefCount( aSlotId, aRefCount );
       
   171         }
       
   172 
       
   173 #else
       
   174 
       
   175     // suppress the unreferenced variable warnings
       
   176     ( void ) aSlotId;
       
   177     ( void ) aRefCount;
       
   178 
       
   179 #endif //_DEBUG
       
   180     }
       
   181 
       
   182 
       
   183 
       
   184 // -----------------------------------------------------------------------------
       
   185 // PEngAttrLibFactory::__DbgTransEnvRefCount()
       
   186 // Debug helper
       
   187 // -----------------------------------------------------------------------------
       
   188 //
       
   189 EXPORT_C void PEngAttrLibFactory::__DbgTransEnvRefCount( const CPEngSessionSlotId& aSlotId,
       
   190                                                          TInt& aRefCount )
       
   191     {
       
   192 #ifdef _DEBUG
       
   193 
       
   194     aRefCount = KErrNotFound;
       
   195 
       
   196     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::__DbgInstanceOrNull();
       
   197     if ( holder )
       
   198         {
       
   199         holder->__DbgTransEnvRefCount( aSlotId, aRefCount );
       
   200         }
       
   201 
       
   202 #else
       
   203 
       
   204     // suppress the unreferenced variable warnings
       
   205     ( void ) aSlotId;
       
   206     ( void ) aRefCount;
       
   207 
       
   208 #endif //_DEBUG
       
   209     }
       
   210 
       
   211 // -----------------------------------------------------------------------------
       
   212 // PEngAttrLibFactory::__DbgTransFactRefCount()
       
   213 // Debug helper
       
   214 // -----------------------------------------------------------------------------
       
   215 //
       
   216 EXPORT_C void PEngAttrLibFactory::__DbgTransFactRefCount( const CPEngSessionSlotId& aSlotId,
       
   217                                                           TInt& aRefCount )
       
   218     {
       
   219 #ifdef _DEBUG
       
   220     aRefCount = KErrNotFound;
       
   221 
       
   222     CPEngAttrLibObjectHolder* holder = CPEngAttrLibObjectHolder::__DbgInstanceOrNull();
       
   223     if ( holder )
       
   224         {
       
   225         holder->__DbgTransFactRefCount( aSlotId, aRefCount );
       
   226         }
       
   227 
       
   228 #else
       
   229 
       
   230     // suppress the unreferenced variable warnings
       
   231     ( void ) aSlotId;
       
   232     ( void ) aRefCount;
       
   233 
       
   234 #endif //_DEBUG
       
   235     }
       
   236 
       
   237 
       
   238 
       
   239 //  End of File
       
   240