srsf/nssvasapi/nssvasdb/inc/nssvascvasdbbuilder.h
branchRCL_3
changeset 23 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
22:cad71a31b7fc 23:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2005 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:  CNssVasDbBuilder is owned by CNssVASDBMgr. It is responsible for creating
       
    15 *               the context manaher, tag manager, vas db event notifier, and tag select 
       
    16 *               notifier. This class is a singleton, and is created using the InstanceL(),
       
    17 *               and deleted using the RemoveInstance() methods. 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #ifndef CNSSVASDBBUILDER_H
       
    23 #define CNSSVASDBBUILDER_H
       
    24 
       
    25 #include "nssvascvasdatabase.h"
       
    26 #include "nssvasccontextmgr.h"
       
    27 #include "nssvasctagmgr.h"
       
    28 #include "nssvascvasdbeventnotifier.h"
       
    29 #include "nssvascdbtagselectnotifier.h"
       
    30 #include "nssvascvasdbsrvdef.h" 
       
    31 
       
    32 
       
    33 //FORWARD DECLARATIONS
       
    34 
       
    35 // CLASS DECLARATIONS
       
    36 /**
       
    37 *  Singleton builder class for creating the VAS DB objects.
       
    38 *  @lib NssVASApi.lib
       
    39 *  @since 2.8
       
    40 */
       
    41 class CNssVASDBBuilder : public CBase
       
    42 {
       
    43 public:
       
    44    /**
       
    45    * This function returns an instance of CNssVASDBBuilder.
       
    46    * Must be called one to one with RemoveInstance(). 
       
    47    * @since 2.0
       
    48    * @param
       
    49    * @return pointer to CNssVASDBBuilder
       
    50    */
       
    51 	static CNssVASDBBuilder* InstanceL();
       
    52 
       
    53 	/**
       
    54    * This method removes one instance of this class by decrementing
       
    55    * the number of instances. When the number of instances hit 0,
       
    56    * the object is deleted. Must be called one to one with InstanceL().
       
    57    * @since 2.0
       
    58    * @param
       
    59    * @return
       
    60    */
       
    61 	static void RemoveInstance();
       
    62    
       
    63 	/**
       
    64    * Destructor.
       
    65    * @param
       
    66    * @return
       
    67    */	
       
    68 	~CNssVASDBBuilder();
       
    69    
       
    70    /**
       
    71    * Initializes VAS DB 
       
    72    * Only one initialization per object lifetime is doing a real job
       
    73    * All the subsequent calls to InitializeL are ignored
       
    74    * @since 2.0
       
    75    * @param 
       
    76    * @return none 
       
    77    */
       
    78    void InitializeL();
       
    79 
       
    80    /**
       
    81    * Gets the ContextMgr.
       
    82    * @since 2.0
       
    83    * @param 
       
    84    * @return pointer to CNssContextMgr
       
    85    */	
       
    86    CNssContextMgr* GetContextMgr();
       
    87    
       
    88    /**
       
    89    * Gets the TagMgr.
       
    90    * @since 2.0
       
    91    * @param 
       
    92    * @return pointer to CNssTagMgr
       
    93    */	
       
    94    CNssTagMgr* GetTagMgr();
       
    95    
       
    96    /**
       
    97    * Gets the Vas Db event notifier.
       
    98    * @since 2.0
       
    99    * @param 
       
   100    * @return pointer to CNssVASDBEventNotifier
       
   101    */    
       
   102    CNssVASDBEventNotifier* GetVASDBEventNotifier();
       
   103 
       
   104 
       
   105    /**
       
   106    * Gets the Vas Db event notifier.
       
   107    * @since 2.0
       
   108    * @param 
       
   109    * @return pointer to CNssVASDBEventNotifier
       
   110    */    
       
   111    CNssDBTagSelectNotifier* GetTagSelectNotifier();
       
   112 
       
   113 
       
   114 private:
       
   115 	/**
       
   116    * C++ constructor
       
   117    * @param 
       
   118    * @return 
       
   119    */    
       
   120    CNssVASDBBuilder();
       
   121 
       
   122 	/**
       
   123    * 2 phase construction
       
   124    * @param
       
   125    * @return
       
   126    */
       
   127 	static CNssVASDBBuilder* NewL ();
       
   128 
       
   129 	/**
       
   130    * 2 phase construction
       
   131    * @param
       
   132    * @return
       
   133    */
       
   134 	static CNssVASDBBuilder* NewLC ();
       
   135 
       
   136    /**
       
   137    * EPOC constructor
       
   138    * @param 
       
   139    * @return 
       
   140    */    
       
   141    void ConstructL ();
       
   142 
       
   143 	/**
       
   144    * closes the VAS database
       
   145    * @since 2.0
       
   146    * @param -
       
   147    * @return 
       
   148    */    
       
   149    void Close();
       
   150 
       
   151    // owns the VAS Database
       
   152    CNssVASDatabase*			iVasDatabase;
       
   153    
       
   154    // owns the context manager
       
   155    CNssContextMgr*				iContextMgr;
       
   156 
       
   157    // owns the tag manager
       
   158    CNssTagMgr*					iTagMgr;
       
   159 
       
   160    // owns the tag select notifier
       
   161    CNssDBTagSelectNotifier*	iDBTagSelectNotifier;
       
   162 
       
   163    // owns the event notifier
       
   164    CNssVASDBEventNotifier*		iVASDBEventNotifier;
       
   165    
       
   166    // Only one initialization per lifetime is permitted
       
   167    // All the subsequent calls to InitializeL are ignored
       
   168    TBool					iInitialized;
       
   169    
       
   170 };
       
   171 
       
   172 // structure for singleton implementation
       
   173 // 
       
   174 struct TThreadLocalStorage 
       
   175 {
       
   176 	CNssVASDBBuilder* iInstance;
       
   177     TInt16 iInstanceCount;
       
   178 };
       
   179 
       
   180 #endif // __CVASDBBUILDER_H