epoc32/include/metadatabase.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 2004-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Meta-database declarations for use in storing comms data
    15 // 
    16 //
    17 
    18 
    19 
    20 /**
    21  @file
    22  @publishedPartner
    23  @released
    24 */
    25 
    26 
    27 #if (!defined METADATABASE_H)
    28 #define       METADATABASE_H
    29 
    30 
    31 
    32 // NetMeta headers
    33 #include <comms-infras/metadata.h>
    34 #include <comms-infras/metatype.h>
    35 
    36 // CommsDat headers
    37 #include <commsdat.h>
    38 
    39 
    40 
    41 /**@plaintext
    42 
    43 This file contains :
    44 
    45 1/  Class for expressing a session with the storage server
    46 
    47 			CMDBSession
    48 
    49 		This class contains functions to create and close a session, to set the dataset version
    50 		and to request database actions such as locking for a transaction.
    51 
    52 2/  Generic database functionality interface
    53 
    54 			MMetaDatabase
    55 
    56 		This class uses a CMDBSession object
    57 
    58 
    59 3/  General base class that inherits from MMetaDatabase to express any database element
    60 
    61 			CMDBElement
    62 
    63 		This class contains the ElementId for each MetaDatabase object
    64 		An element id locates stored data in the comms database.
    65 
    66 
    67 4/  Data classes that each inherit from CMDBElement
    68 
    69 	a) Fields
    70 
    71 			CMDBField<T>
    72 
    73 		where T is a basic type value of the field (TInt, TDes, TBool etc)
    74 		
    75 		This class derives from
    76 
    77 			CMDBElement
    78 
    79 		to implement the thin template idiom
    80 
    81 
    82 			CMDBRecordLink<T>
    83 
    84 		where T is a record of a particular type.  This class expresses a soft-link
    85 		from a field in one record to a record of a different type (i.e. in another table).
    86 		The TMDBElementId value stored in this field in the repository is the id of an instance 
    87 		of the record of type T
    88 
    89 		This class derives from
    90 
    91 			CMDBRecordLinkBase
    92 
    93 		to implement the thin template idiom
    94 
    95 
    96 	b) Field Containers
    97 
    98 
    99 			CCDRecord
   100 
   101 		base class for record containing specific list of fields - see CommsDatTypesv1_1.h
   102 
   103 
   104 			CMDBRecordSet<T>
   105 
   106 		an array of records where T is the record type.  This can represent a Table in a database.
   107 
   108 
   109 
   110 
   111 5/  Other support classes and type definitions
   112 
   113 			TMDBElementId
   114 
   115 		The TMDBElementId locates a data object or set of data objects in the database.
   116 
   117 		A TMDBElementId expresses
   118 
   119 		<TableId><ColumnId><RecordId><Attributes>
   120 
   121 		A TMDBElementId has a different format depending on the data type it expresses
   122 
   123 			Table       <TableId><0><0>
   124 			Column      <TableId><ColumnId><0>
   125 
   126 			Record      <TableId><0><RecordId>
   127 			Field       <TAbleId><ColumnId><RecordId>
   128 
   129 
   130 			TMDBAttributeFlags
   131 
   132 		Attribute settings for any storable element.
   133 		Attributes express access control for data in the database
   134 
   135 */
   136 
   137 
   138 
   139 namespace CommsDat
   140 {
   141 
   142 using namespace Meta;
   143 
   144 
   145 // Private to implementation
   146 //@internalTechnology
   147 //@released
   148 class CMDBSessionImpl;
   149 
   150 // Forward declarations
   151 class MMetaDatabase;
   152 class CMDBElement;
   153 
   154 /**
   155 Attribute flags for an element in the Meta Database
   156 Attributes describe access rights to the data in the database
   157 @publishedAll
   158 @released
   159 */
   160 typedef TUint32         TMDBAttributeFlags;	
   161 
   162 
   163 /**
   164 The identifier for any entry in the MetaDatabase.
   165 It can specify
   166 	<TableId><ColumnId><RecordId>
   167 This identifies 
   168     The data location in the database
   169     The meaning of the data within in the data schema
   170     The type of the data
   171 
   172 @publishedAll
   173 @released
   174 */
   175 typedef TUint32         TMDBElementId;
   176 
   177 class CMDBSession : public CBase
   178 /*
   179 A session with the underlying storage server
   180 @publishedAll
   181 @released
   182 */
   183 {
   184 public:
   185 
   186 	/**
   187 	Open a session with the storage server and establish data format version in use
   188 	CommsDat always attempts to support the required version of the client-facing data set.
   189     The client must carefully choose the dataset version as it affects binary compatibility
   190 
   191     @params aRequiredVersion  
   192             If the requested version is deprecated but still supported, mapping will be performed 
   193             within CommsDat to maintain Data and Binary compatibility for the client
   194             If the requested version is the latest version, no mapping will be performed
   195             and deprecated fields will be ignored 
   196             A client that needs to maintain BC must use a specific version
   197             A client that always wants to use the latest dataset can start the session with KCDLatestVersion
   198             
   199     @leave  KErrUnsupported If an old unsupported version is requested
   200     @leave  System-wide error codes if there is an unexpected error
   201     
   202     @pre    None
   203     @post   on success a session has been created and initialised
   204 
   205     @publishedAll
   206 	*/
   207 	IMPORT_C static CMDBSession* NewL(TVersion aRequiredVersion);
   208 
   209 	/**
   210 	As NewL and adds Session to the CleanupStack
   211 
   212 	@publishedAll
   213 	*/
   214 	IMPORT_C static CMDBSession* NewLC(TVersion aRequiredVersion);
   215 
   216 	/**
   217 	Virtual Destructor
   218 
   219 	@publishedAll
   220 	*/
   221 	IMPORT_C ~CMDBSession();
   222 
   223 
   224 	/**
   225 	Close session with storage server.
   226 
   227 	@publishedAll
   228 	@deprecated v9.1 Destructor is all that is required
   229 	*/
   230 	IMPORT_C void Close();
   231 
   232 
   233 	/**
   234 	Lookup latest data format version
   235 
   236 	@pre   None
   237     @post  None
   238 	@publishedAll
   239 	*/
   240 	IMPORT_C static TVersion LatestVersion();
   241 
   242 
   243 	/**
   244 	Lookup data format version currently in use by client
   245 
   246 	@publishedAll
   247 	*/
   248 	IMPORT_C TVersion VersionInUse();
   249 
   250 
   251 	/**
   252 	Open Transaction with storage server and obtain write lock - if not already set
   253 
   254     @capability WriteDeviceData
   255 
   256     @leave	Will leave with KErrNotAvailable if Database write locked by another process
   257 	@leave  Will report KErrAlreadyInTransaction if transaction this session is already in a transaction
   258     @leave  Will leave with a system-wide error code if an error occurs during commit
   259 
   260 	@pre    None
   261     @post   on success the session has exclusive write access to the database
   262 
   263 	@publishedAll
   264 	*/
   265 	IMPORT_C void OpenTransactionL();
   266 
   267 
   268 	/**
   269 	Commit Transaction in database.
   270 
   271     @leave	Will leave with KErrNotFound if not in transaction
   272     @leave  Will leave with a system-wide error code if an error occurs during commit
   273 
   274 	@pre    None
   275 
   276 	@post   On success the database is updated with data added, modified or deleted during the transaction
   277     @post   On failure, any open data containers may not be in sync with the database and should be discarded or reloaded
   278 	@publishedAll
   279 	*/
   280 	IMPORT_C void CommitTransactionL();
   281 
   282 
   283 	/**
   284 	Cancel Transaction with database and rollback all associated changes
   285         Will not make any changes to the client's containers
   286 
   287     @leave	Will fail with KErrNotFound if not in transaction
   288 
   289     @pre    None - though for correct usage, ensure a transaction is already open
   290 	@post   Any open data containers may not be in sync with the database and should be discarded or reloaded
   291 	@publishedAll
   292 	*/
   293 	IMPORT_C void RollbackTransactionL();
   294 
   295    /**
   296 	Query if this session is in a transaction with the database
   297 	Return code will indicate
   298 		Not in transaction,
   299 		Already in transaction for this session,
   300 		Write-lock not available.  Another session has it.
   301 
   302     @pre None
   303 	@publishedAll
   304 	*/
   305 	IMPORT_C TInt IsInTransaction();
   306 
   307 	
   308     /**
   309 	Set attributes to ignore for all database operations during this session 
   310 
   311     @params aAttributeFlags indicates the requested access level to stored data.
   312             Attributes set by this call will be ignored as restrictions in all database interactions,
   313 	        providing the client has enough platform security capabilities to back up the request
   314 	
   315     @pre None
   316 	@publishedAll
   317 	*/
   318 	IMPORT_C void SetAttributeMask(TMDBAttributeFlags aAttributeFlags);
   319 
   320 	
   321 	/**
   322 	Check flags in attribute mask
   323     @params aAttributeFlags indicates the requested access level to stored data
   324             Attribute flags that have been set will be ignored as restrictions in all database interactions, 
   325             providing the client has enough platform security capabilities to back up the request
   326 
   327     @return ETrue if the flag is set in the session mask 
   328             This means that the attribute is ignored in database interactions for this session
   329 
   330     @return EFalse if the flag is not set in the session mask 
   331             This means that the attribute is obeyed in all database interactions for this session
   332 
   333     @pre None
   334 	@publishedAll
   335 	*/
   336 	IMPORT_C TBool IsSetAttributeMask(TMDBAttributeFlags aAttributeFlags);
   337 
   338     
   339     /**
   340 	Clear attribute mask settings, indicating required access level to stored data
   341 	Clear flags in the attribute mask for this session
   342     
   343         Flags indicate the requested access level to stored data
   344 	    
   345         Attribute flags that have been set in this function will be cleared from the session's 
   346         attribute mask and will be obeyed as restrictions in all database interactions, 
   347         providing the client has enough platform security capabilities to back up the request
   348         
   349     @pre None
   350 	
   351 	@publishedAll
   352 	*/
   353 	IMPORT_C void ClearAttributeMask(TMDBAttributeFlags aAttributeFlags);
   354 
   355 
   356 
   357 	/**
   358 	Cancel all notification requests that are outstanding from calls to 
   359         MMetaDatabase::RequestNotification
   360     Individual requests can be cancelled via MMetaDatabase::CancelNotify.
   361 
   362     @return KErrNone on success or a system-wide error code
   363     
   364     @pre  None
   365 
   366 	@publishedAll
   367 	*/
   368 	IMPORT_C TInt CancelAllNotifications();
   369 
   370 
   371     /**
   372 	Attempt to create publish/subscribe properties if not already defined.
   373     
   374         This function is normally called as a setup activity by System components
   375 
   376     @capability WriteDeviceData - since these properties are created in KUidSystemCategory category.  
   377 
   378     @return KErrNone on success.  Otherwise a system-wide error code
   379     	
   380     @pre None
   381 
   382     @internalComponent
   383 	*/	
   384 	IMPORT_C TInt PublishProperties();
   385 
   386 private:
   387 
   388     TInt ConstructL( TVersion aRequiredVersion );
   389 
   390 	CMDBSession();
   391 
   392 private:
   393 
   394 	CMDBSessionImpl* iMDBSessionImpl;
   395 	
   396 	friend class MMetaDatabase;
   397 };
   398 
   399 
   400 
   401 
   402 
   403 class MMetaDatabase : public Meta::MMetaData
   404 /*
   405 Interface for interaction with a database server
   406 Inherited by each data set type that can be stored
   407 @publishedAll
   408 */
   409 {
   410 public:
   411 
   412 	IMPORT_C virtual ~MMetaDatabase();
   413 
   414 
   415 	/**
   416 	LoadL - Load this container with data from the database
   417 		
   418         Any data in the container will be discarded 
   419 
   420         Individual fields may legitimately be NULL in the database, but if no data at all
   421         is found for an entire table or record, LoadL will leave with 
   422             KErrNotFound
   423 
   424         The client can request to ignore access control flags by setting the attribute mask
   425             CMDBSession::SetAttributeMask()
   426 		However, only fields that the client has capabilities to write will be stored in the database
   427 		A request to read data from an unauthorised area of the database will cause the function to leave.with 
   428             KErrPermissionDenied
   429         
   430         In a record, fields in an unauthorised column may be silently ignored and returned as NULL
   431         
   432         May also leave with KErrNoMemory or other general error codes
   433 	
   434         On failure, the container should be discarded or reloaded before it is used again
   435 
   436     @pre
   437 
   438         Ensure the ElementId for this container fully identifies the target data in the database
   439             <Table><Column><Record>
   440         Ensure that the session object has been initialised with the correct dataset version
   441         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   442 
   443 	@publishedAll
   444 	*/
   445 	IMPORT_C void LoadL(CMDBSession& aSession);
   446 
   447 
   448 	/**
   449 	FindL - Find and Load the data set(s) that match all the data values entered by the 
   450     client in this container
   451 	     
   452         Client can request to ignore access control flags by setting the attribute mask,
   453             CMDBSession::SetAttributeMask()
   454 		However will not load data that the client is not authorised to see (by platsec)
   455         even if the client has sets the appropriate attribute mask
   456 
   457 		Will return
   458 			ETrue on success
   459 			EFalse if no data found that the client is authorised to view
   460             
   461         May also leave with KErrGeneral or other general error codes.
   462 
   463         On failure, the container should be discarded or repopulated before it is used again
   464 
   465     @pre
   466 
   467         Populate this container where necessary with valid data to match during the find operation
   468         Ensure the ElementId for this container correcty identifies the target table in the database
   469             <Table><Column>
   470         Ensure that the session object has been initialised with the correct dataset version
   471         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   472 	@publishedAll
   473 	 */
   474 	IMPORT_C TBool FindL(CMDBSession& aSession);
   475 
   476 
   477 	/**
   478 	Refresh all fields in the container that have not been changed by the client
   479 
   480 		The client can request to ignore access control flags by setting the attribute mask,
   481             CMDBSession::SetAttributeMask()
   482 		However, only data that the client has capabilities to view will be loaded
   483 		Unauthorised data elements will be silently ignored and will remain NULL
   484 
   485 		If no data at all is found the functon will leave with 
   486 			KErrNotFound
   487 
   488 		If fields are not accessible for reading the function may leave with 
   489             KErrPermissionDenied
   490 	    
   491         May also leave with other general error codes if there are unexpected 
   492         problems (e.g. KErrNoMemory when out of memory)
   493 
   494         On failure, the container should be discarded or reloaded before it is used again
   495 
   496 	@pre
   497 
   498         Ensure the ElementId for this container fully identifies the target data in the database
   499             <Table><Column><Record>
   500         Ensure that the session object has been initialised with the correct dataset version
   501         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   502 	@publishedAll
   503 	*/
   504 	IMPORT_C void RefreshL(CMDBSession& aSession);
   505 
   506 
   507 	/**
   508 	StoreL - Store all fields in the database that have been changed in this container and 
   509     create new records where necessary.
   510 
   511         StoreL is atomic for this container.  An internal transaction is used even if 
   512         no overall transaction is set by client.
   513             All changed fields in the element are stored in the database on success.  
   514             No fields or records are stored in the database if the function leaves
   515 
   516         If a client has an open transaction in the session, the stored data will be available to this session as 
   517         soon as StoreL completes but will not be visible to other sessions until the transaction completes successfully
   518 
   519 		The client can request to ignore access control flags by setting the attribute mask
   520             CMDBSession::SetAttributeMask()
   521 		However, only fields that the client has capabilities to write will be stored in the database
   522 		A request to modify data in an unauthorised area of the database will cause the function to leave.with 
   523             KErrPermissionDenied
   524         
   525     	If a field already exists, StoreL will leave with
   526 	        KErrAlreadyExists
   527 
   528         May also leave with other general error codes if there are unexpected 
   529         problems (e.g. KErrNoMemory when out of memory)
   530 
   531 
   532         If StoreL fails or the later commit is not successful, The data in the container will not
   533         match the data in the database.  
   534 
   535         On failure, the container should be discarded or repopulated before it is used again
   536 
   537 	@pre
   538 
   539         Populate this container with valid data for storage
   540         Ensure the ElementId for this container fully identifies the target location in the database
   541             <Table><Column><Record>
   542         Ensure that the session object has been initialised with the correct dataset version
   543         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   544         
   545 	@publishedAll
   546 	*/
   547 	IMPORT_C void StoreL(CMDBSession& aSession);
   548 
   549 
   550 	/**
   551 	Modify all fields in the database that have been changed in this container by the caller
   552         
   553         Only modifies existing data in the database, won't create new fields  VCT - is this true?? don't think so
   554 	
   555         Modification is atomic for this container.  It uses an internal transaction even if 
   556         no overall transaction set by client.
   557             All changed fields in the element are modified in database on success.  
   558             No fields are altered in the database if the function leaves
   559 
   560         Client can request to ignore access control flags by setting the attribute mask
   561             CMDBSession::SetAttributeMask()
   562 		However, only fields that the client has capabilities to alter will be modified.in the database
   563 		A request to modify data in an unauthorised area will cause the function to leave.with 
   564             KErrPermissionDenied
   565 
   566         If field does not exist, the function will leave with 
   567             KErrNotFound [VCT - surely not]
   568 
   569 		May also leave with other general error codes if there are unexpected 
   570         problems (e.g. KErrNoMemory when out of memory)
   571 
   572         On failure, the container should be discarded or repopulated before it is used again
   573 
   574     @pre
   575 
   576         Populate this container with valid data for storage
   577         Ensure the ElementId for this container fully identifies the target data in the database
   578             <Table><Column><Record>
   579         Ensure that the session object has been initialised with the correct dataset version
   580         Ensure that the session object has appropriate access control attributes to manage the target data in the database
   581 	@publishedAll
   582 	*/
   583 	IMPORT_C void ModifyL(CMDBSession& aSession);
   584 
   585 
   586 	/**
   587 	Delete fields from the database.
   588 
   589 		Client can request to ignore access control flags by setting the attribute mask,
   590 		but only fields that the client has capabilities to delete will be removed.
   591 
   592 		A request to delete data in unauthorised area will cause the function to leave
   593 
   594 	@leave	If client not authorised to read or write the data, will leave with 
   595 	        	KErrPermissionDenied 
   596             May also leave with other general error codes if there are unexpected 
   597             problems (e.g. KErrNoMemory when out of memory)
   598 
   599     @pre    Ensure the ElementId for this container fully identifies the target data in the database
   600                 <Table><Column><Record>
   601             Ensure that the session object has appropriate access control attributes to manage the target data in the database
   602             Ensure the ElementId for this container correcty identifies the target data in the database
   603 
   604 	@publishedAll
   605 	*/
   606 	IMPORT_C void DeleteL(CMDBSession& aSession);
   607 
   608 
   609 	/**
   610 	RequestNotification - Register for notification of events from all clients of the database
   611 
   612         aRequestStatus will be completed when the following events occur
   613             TransactionComplete
   614             TransactionRollback
   615             SessionClose
   616         
   617         this aRequestStatus can be cancelled by a call to 
   618             
   619             MMetaDatabase::CancelNotification
   620 
   621         all outstanding aRequestStatus can be cancelled by a call to
   622             
   623             CMDBSession::CancelAllNotifications
   624 
   625     @capability WriteDeviceData
   626     
   627     @return KErrNone on success.  A system wide error on failure
   628 
   629     @params aSession        a valid session object
   630     @params aRequestStatus  the requestStatus object that will be completed on notification
   631     
   632     @pre    None
   633     @post   A notification request will be outstanding
   634 
   635 	@publishedAll
   636 	*/
   637 	IMPORT_C TInt RequestNotification(CMDBSession&          aSession,
   638 									  TRequestStatus&        aRequestStatus);
   639 
   640 	/**
   641 	CancelNotification - cancel an outstanding notification request
   642         
   643         note that all outstanding notification requests can be cancelled by a call to
   644             
   645             CMDBSession::CancelAllNotifications
   646 
   647     @pres
   648          
   649         There is an outstanding notification request
   650 
   651 	@publishedAll
   652 	*/
   653 	IMPORT_C TInt CancelNotification(CMDBSession&       aSession,
   654 									 TRequestStatus&     aRequestStatus);
   655 
   656 
   657 protected:
   658 
   659 
   660 	explicit MMetaDatabase();
   661 
   662 private:
   663 
   664     /*
   665     @internalComponent
   666     */
   667     void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes);
   668 
   669     /*
   670     @internalComponent
   671     */
   672     void DoLoadL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, TMDBElementId aRecordId, TMDBElementId aAttributes, RArray<TUint32>& aMatches);
   673 
   674     /*
   675     @internalComponent
   676     */
   677     void DoFindL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt& aErr, RArray<TUint32>& candidates, RArray<TUint32>& matches);
   678 
   679     /*
   680     @internalComponent
   681     */
   682     void DoRefreshL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt &aErr);
   683 
   684     /*
   685     @internalComponent
   686     */
   687     void DoStoreL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt &aErr);
   688 
   689     /*
   690     @internalComponent
   691     */
   692     void DoModifyL(CMDBSessionImpl* aSession, CMDBElement* aElement, CMDBElement* aMapper, TInt &aErr);
   693 
   694 };
   695 
   696 
   697 
   698 
   699 
   700 class CMDBElement : public CBase, public MMetaDatabase
   701 /*
   702 Every item stored in the database is represented as a CMDBElement
   703 This class contains the id and attributes of every item in the database
   704 and for individual fields it also contains the value.
   705 
   706 @publishedAll
   707 @released
   708 */
   709 {
   710 public:
   711 
   712 
   713 	/**
   714 	Default Constructor
   715 
   716 	@publishedAll
   717 	*/
   718 	IMPORT_C CMDBElement();
   719 
   720 
   721 	/**
   722 	Constructor
   723 
   724 	@publishedAll
   725 	*/
   726 	IMPORT_C CMDBElement(TMDBElementId aElementId);
   727 	
   728 	
   729 	/**
   730 	Destructor
   731 
   732 	@publishedAll
   733 	*/
   734 	IMPORT_C ~CMDBElement();
   735 
   736 
   737 	// Accessors
   738 
   739 	/**
   740 	Returns the ElementId of an object of this type.
   741 
   742 	The TypeId is
   743 
   744 	<TableId><ColumnId><RecordId>
   745 
   746 	This identifies the meaning of the field in the database schema
   747 	It also identifies the type of the data stored in this element
   748 	and the instance of the type
   749 
   750 	@publishedAll
   751 	*/
   752 	IMPORT_C TMDBElementId ElementId() const;
   753 
   754 
   755 	/**
   756 	Returns the TypeId of an object of this type.
   757 
   758 	The TypeId is
   759 
   760 	<TableId><ColumnId><x>
   761 
   762 	This identifies the meaning of the data in this element in the database schema
   763 	It also identifies the type of the data contained in this element
   764 
   765     For an element that is a Table or a Record, the ColumnId field will be set to 
   766 
   767     KCDMaxColumnId
   768 	@publishedAll
   769 	*/
   770 	IMPORT_C TMDBElementId  TypeId() const;
   771 
   772 
   773 	/**
   774 	Returns the TableId of an object of this type.
   775 
   776 	The TableId is part of the ElementId
   777 
   778 	<TableId><x><x>
   779 
   780 	It identifies the table in the database that holds the data contained in this element
   781 
   782 	@publishedAll
   783 	*/
   784 	IMPORT_C TMDBElementId  TableId() const;
   785 
   786     
   787     /**
   788 	Returns the RecordId of an object of this type.
   789 
   790 	The RecordId is part of the ElementId <x><x><RecordId>
   791 
   792 	It identifies a particular instance of this type of Element in the database
   793 
   794 	@publishedAll
   795 	*/
   796 	IMPORT_C TInt RecordId() const;
   797 
   798 
   799 	/**
   800 	Returns the Attributes of an object of this type.
   801 
   802 	Attributes express database access rights for the data of this element
   803 
   804 	@publishedAll
   805 	*/
   806 	IMPORT_C TMDBAttributeFlags Attributes() const;
   807 
   808     // SETTER FUNCTIONS
   809 
   810 	/**
   811 	Sets the ElementId
   812 
   813 	@publishedAll
   814 	*/
   815 	IMPORT_C void SetElementId(TMDBElementId aElementId);
   816 
   817 
   818 	/**
   819 	Sets the TypeId
   820 
   821 	@publishedAll
   822 	*/
   823 	IMPORT_C void SetTypeId(TMDBElementId aElementId);
   824 
   825 
   826 	/**
   827 	Sets the RecordId
   828 
   829 	@publishedAll
   830 	*/
   831 	IMPORT_C void SetRecordId(TInt aRecordId);
   832 
   833 
   834 	/**
   835 	Sets one or more attributes
   836 
   837 	@publishedAll
   838 	*/
   839 	IMPORT_C void SetAttributes(TMDBAttributeFlags aAttributes);
   840 
   841 
   842 	/**
   843 	Clears one or more attributes
   844 
   845 	@publishedAll
   846 	*/
   847 	IMPORT_C void ClearAttributes(TMDBAttributeFlags aAttributes);
   848 
   849 
   850 	/**
   851 	Queries the attributes
   852 
   853 	Returns ETrue if all queried attributes are set
   854 	Returns EFalse if any queried attribute is not set.
   855 
   856 	@publishedAll
   857 	*/
   858 	IMPORT_C TBool IsSetAttribute(TMDBAttributeFlags aAttributes) const;
   859 
   860 
   861 	/**
   862 	Queries the state of the field value
   863 
   864 	Returns ETrue if the value of the element is not set
   865 	Returns EFalse if the element contains a value
   866 
   867 	@publishedAll
   868 	*/
   869 	IMPORT_C TBool IsNull() const;	
   870 	
   871 	
   872 	
   873     EXP_DATA_VTABLE
   874 	
   875     /**
   876 	Queries the type of the field value
   877 
   878 	Returns the enumeration TCDFieldValueTypes that represents the value that can be stored in this element
   879 
   880 	@publishedAll
   881 	*/
   882 
   883 	virtual TCDFieldValueTypes Type()=0;
   884 
   885 	/**
   886 	@internalComponent
   887 	*/
   888     TMDBElementId* Data(){return &iElementId;}
   889     
   890 	/**
   891 	@internalComponent
   892 	*/
   893     const TMDBElementId* CData(){return &iElementId;}
   894     
   895 
   896 	
   897 protected:
   898 
   899 	TMDBElementId     iElementId;
   900 	
   901     TAny*             iValue;
   902     
   903     };
   904 
   905 
   906 
   907 
   908 ///////////////////////////////////////////////////////////////////////////////////////
   909 //  COMMSDAT CONTAINERS
   910 //
   911 
   912 /**
   913 Commsdat Container classes qualifying numeric values
   914 @internalComponent 
   915 */
   916 class CMDBNumFieldBase : public CMDBElement
   917 {
   918 public:
   919 	/**
   920 	Default Constructor
   921 	*/
   922     IMPORT_C CMDBNumFieldBase();
   923 
   924 
   925    	/**
   926 	Constructor setting Field's ElementId
   927 	*/
   928 	IMPORT_C CMDBNumFieldBase(TMDBElementId aFieldId);
   929 		
   930 
   931     /**
   932 	Assignment operator for field value
   933 	*/
   934 	IMPORT_C CMDBNumFieldBase& operator=(const TInt aValue);
   935 	
   936     IMPORT_C void SetMaxLengthL(TInt aLength);
   937     TMDBElementId GetL();
   938 	     
   939     EXP_DATA_VTABLE
   940 
   941 	virtual TCDFieldValueTypes Type()
   942 		{
   943 		return EInt;
   944 		}    
   945     
   946 };
   947 
   948 template<class TYPE>
   949 class CMDBField : public CMDBNumFieldBase
   950 /**
   951 A thin template that guards typed data access in a single CMDBElement
   952 This class describes a single numeric field in the database
   953 
   954 @publishedAll
   955 */
   956 {
   957 public:
   958 
   959 	/**
   960 	Default Constructor
   961 
   962 	@publishedAll
   963 	*/
   964 	inline CMDBField()
   965 		{
   966 		}
   967 
   968 	/**
   969 	Constructor setting Field's ElementId
   970 
   971 	@publishedAll
   972 	*/
   973 	inline CMDBField(TMDBElementId aFieldId)
   974 		: CMDBNumFieldBase(aFieldId)
   975 		{
   976 		}
   977 
   978 
   979 	/**
   980 	Assignment operator for field value
   981 
   982 	@publishedAll
   983 	*/
   984 	inline CMDBField<TYPE>& operator=(const TYPE& aValue)
   985 	{
   986     	return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=((TInt&)aValue);
   987 	}
   988 
   989 
   990     inline CMDBField<TYPE>& operator=(const CMDBField<TYPE>& aValue)
   991 	{
   992 	    return (CMDBField<TYPE>&)CMDBNumFieldBase::operator=(aValue);
   993 	}
   994 	
   995 	/**
   996 	Conversion operator for field value
   997 
   998 	@publishedAll
   999 	*/
  1000 	inline operator TYPE&()
  1001 	{
  1002 		return (TYPE&)iValue;
  1003 	}
  1004 	
  1005 	/**
  1006 	Conversion operator for field value
  1007 
  1008 	@publishedAll
  1009 	*/
  1010 	inline CMDBField<TYPE>& GetL()
  1011 	{
  1012 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1013 			{
  1014 			User::Leave(KErrNotFound); //todo commsdat specific error code
  1015 			}
  1016 
  1017 		return (TYPE&)iValue;
  1018 	}
  1019 	
  1020 	/**
  1021 	Function for setting a value
  1022 
  1023 	@publishedAll
  1024 	*/
  1025 	inline void SetL(const TYPE& aValue)
  1026 	{
  1027 	CMDBNumFieldBase::operator=(aValue);
  1028 	}
  1029 	
  1030 };
  1031 
  1032 
  1033 
  1034 //////////////////
  1035 /**
  1036 Base Container class qualifying a text field
  1037 @internalComponent
  1038 */
  1039 class CMDBTextFieldBase : public CMDBElement
  1040 {
  1041 public:
  1042 	/**
  1043 	Default Constructor
  1044 	*/
  1045 	IMPORT_C CMDBTextFieldBase();
  1046 
  1047 	/**
  1048 	Constructor setting Field's ElementId
  1049 	*/
  1050 	IMPORT_C CMDBTextFieldBase(TMDBElementId aFieldId);    
  1051 	
  1052 	
  1053 	/**
  1054 	Destructor that deletes the field value
  1055 	*/
  1056 	IMPORT_C ~CMDBTextFieldBase();    
  1057 	
  1058 	
  1059 	/**
  1060 	Assignment Operator setting Field's value
  1061 	*/
  1062 	IMPORT_C CMDBTextFieldBase& operator=(const TDesC& aValue);
  1063 	
  1064 	    	
  1065     IMPORT_C void SetMaxLengthL(TInt aLength);
  1066 
  1067     EXP_DATA_VTABLE
  1068     
  1069 	virtual TCDFieldValueTypes Type()
  1070 		{
  1071 		return EText;
  1072 		}    
  1073 
  1074 };
  1075 
  1076 
  1077 
  1078 
  1079 
  1080 
  1081 
  1082 template<>
  1083 class CMDBField<TDesC> : public CMDBTextFieldBase
  1084 /**
  1085 A thin template that guards typed data access in a single CMDBElement
  1086 This class describes a single field in the database
  1087 
  1088 @publishedAll
  1089 */
  1090 {
  1091 public:
  1092 
  1093 	/**
  1094 	Default Constructor
  1095 
  1096 	@publishedAll
  1097 	*/
  1098 	inline CMDBField()
  1099 		{
  1100 		}
  1101 
  1102 	/**
  1103 	Constructor setting Field's ElementId
  1104 
  1105 	@publishedAll
  1106 	*/
  1107 	inline CMDBField(TMDBElementId aFieldId)
  1108 		: CMDBTextFieldBase(aFieldId)
  1109 		{
  1110 		}
  1111 
  1112 
  1113     inline void SetMaxLengthL(TInt aLength)
  1114 	// create a new buffer if necessary.
  1115 	{
  1116 	    CMDBTextFieldBase::SetMaxLengthL(aLength);
  1117 	}
  1118 	
  1119     inline CMDBField<TDesC>& operator=(const TDesC& aValue)
  1120 	{
  1121         CMDBTextFieldBase::operator=(aValue);	   
  1122         return *this; 
  1123 	}
  1124 
  1125     inline CMDBField<TDesC>& operator=(CMDBField<TDesC>& aValue)
  1126 	{
  1127         CMDBTextFieldBase::operator=((const TDesC&)aValue);	
  1128         return *this;   
  1129 	}
  1130 
  1131 	/**
  1132 	Conversion operator for field value
  1133 
  1134 	@publishedAll
  1135 	*/
  1136 	inline operator const TDesC&()
  1137 	{
  1138         if (! iValue)
  1139             return KNullDesC;
  1140 
  1141 		return *(HBufC*)iValue;
  1142 	}
  1143 	
  1144 	/**
  1145 	Conversion operator for field value
  1146 
  1147 	@publishedAll
  1148 	*/
  1149 	inline TDesC& GetL()
  1150 	{
  1151 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1152 			{
  1153 			User::Leave(KErrNotFound); //todo commsdat specific error code
  1154 			}
  1155 
  1156 		return *(HBufC*)iValue;
  1157 	}
  1158 	
  1159 	/**
  1160 	Function for setting a value
  1161 
  1162 	@publishedAll
  1163 	*/
  1164 	inline void SetL(const TDesC& aValue)
  1165 	{
  1166 	SetMaxLengthL(aValue.Length());
  1167 	CMDBTextFieldBase::operator=(aValue);
  1168 	}
  1169 	
  1170 	
  1171 };
  1172 
  1173 
  1174 //////////////////
  1175 /**
  1176 Container class for qualifying binary values
  1177 @internalComponent 
  1178 */
  1179 class CMDBBinFieldBase : public CMDBElement
  1180 {
  1181 public:
  1182 	/**
  1183 	Default Constructor
  1184 	*/
  1185 	IMPORT_C CMDBBinFieldBase();
  1186 
  1187 	
  1188 	/**
  1189 	Constructor setting Field's ElementId
  1190 	*/
  1191 	IMPORT_C CMDBBinFieldBase(TMDBElementId aFieldId);    
  1192 	
  1193 	
  1194 	/**
  1195 	Destructor that deletes the field value
  1196 	*/
  1197 	IMPORT_C ~CMDBBinFieldBase();    
  1198 	
  1199 	
  1200 	/**
  1201 	Assignment Operator setting Field's value
  1202 	*/
  1203 	IMPORT_C CMDBBinFieldBase& operator=(const TDesC8& aValue);
  1204 	    	
  1205     /**
  1206 	To allocate space for field data.
  1207 	*/
  1208 	IMPORT_C void SetMaxLengthL(TInt aLength);
  1209 
  1210     EXP_DATA_VTABLE
  1211     
  1212 	virtual TCDFieldValueTypes Type()
  1213 		{
  1214 		return EDesC8;
  1215 		}    
  1216 };
  1217 
  1218 
  1219 template<>
  1220 class CMDBField<TDesC8> : public CMDBBinFieldBase
  1221 /**
  1222 A thin template that guards typed data access in a single CMDBElement
  1223 This class describes a single field in the database
  1224 
  1225 @publishedAll
  1226 */
  1227 {
  1228 public:
  1229 
  1230 	/**
  1231 	Default Constructor
  1232 
  1233 	@publishedAll
  1234 	*/
  1235 	inline CMDBField()
  1236 		{
  1237 		}
  1238 
  1239 	/**
  1240 	Constructor setting Field's ElementId
  1241 
  1242 	@publishedAll
  1243 	*/
  1244 	inline CMDBField(TMDBElementId aFieldId)
  1245 		: CMDBBinFieldBase(aFieldId)
  1246 		{
  1247 		}
  1248 
  1249     inline void SetMaxLengthL(TInt aLength)
  1250 	// create a new buffer if necessary.
  1251     	{
  1252     	    CMDBBinFieldBase::SetMaxLengthL(aLength);
  1253     	}
  1254 	
  1255 	
  1256     inline CMDBField<TDesC8>& operator=(const TDesC8& aValue)
  1257     	{
  1258             return (CMDBField<TDesC8>&)CMDBBinFieldBase::operator=(aValue);	    
  1259     	}
  1260 	
  1261 	
  1262     inline CMDBField<TDesC8>& operator=(CMDBField<TDesC8>& aValue)
  1263 	// Copy assignment
  1264         {
  1265             return (CMDBField<TDesC8>&)CMDBBinFieldBase::operator=((const TDesC8&)aValue);	    
  1266     	}
  1267 
  1268 
  1269 	/**
  1270 	Conversion operator for field value
  1271 
  1272 	@publishedAll
  1273 	*/
  1274 	inline operator const TDesC8&()
  1275     	{
  1276 		    if (! iValue)
  1277                 return KNullDesC8;
  1278 
  1279     		return *(HBufC8*)iValue;
  1280     	}
  1281     	
  1282     /**
  1283 	Conversion operator for field value
  1284 
  1285 	@publishedAll
  1286 	*/
  1287 	inline TDesC8& GetL()
  1288 	{
  1289 		if(IsNull() && !(ElementId() & KCDChangedFlag))
  1290 			{
  1291 			User::Leave(KErrNotFound); //todo commsdat specific error code
  1292 			}
  1293 
  1294     	return *(HBufC8*)iValue;
  1295 	}
  1296 	
  1297 	/**
  1298 	Function for setting a value
  1299 
  1300 	@publishedAll
  1301 	*/
  1302 	inline void SetL(const TDesC8& aValue)
  1303 	{
  1304 	SetMaxLengthL(aValue.Length());
  1305 	CMDBBinFieldBase::operator=(aValue);
  1306 	}
  1307 	
  1308 };
  1309 
  1310 
  1311 
  1312 ///////////////////////////////////////////////////////////////////////////////////////////////
  1313 
  1314 /**
  1315 Base class for CMDBRecordLink
  1316 @internalComponent 
  1317 */
  1318 class CMDBRecordLinkBase : public CMDBNumFieldBase
  1319 {
  1320 public :	
  1321 
  1322 	IMPORT_C CMDBRecordLinkBase();
  1323 
  1324 	IMPORT_C CMDBRecordLinkBase(TMDBElementId aLinkingFieldId);
  1325 
  1326 	IMPORT_C CMDBRecordLinkBase(TMDBElementId aLinkingFieldId, CMDBElement* aLinkedRecord);
  1327 
  1328 
  1329 	IMPORT_C ~CMDBRecordLinkBase();
  1330 
  1331 	/**
  1332 	Assignment operator for field value
  1333 	which sets the id of the element list
  1334 	*/
  1335 	IMPORT_C CMDBRecordLinkBase& operator=(const TMDBElementId aValue);
  1336 
  1337 
  1338 	/**
  1339 	Conversion operator for field value
  1340 	which gets the id of the element list
  1341 	*/
  1342 	IMPORT_C operator TMDBElementId();
  1343 
  1344     TCDFieldValueTypes Type()
  1345 		{
  1346 		return ELink;
  1347 		}    
  1348 
  1349 protected:
  1350 
  1351 	EXP_DATA_VTABLE
  1352 
  1353 public:
  1354     
  1355 	// the record referenced by the link id stored in the value of this field.
  1356 	CMDBElement*     iLinkedRecord;
  1357 
  1358 };
  1359 
  1360 
  1361 template<class RECORD_TYPE>
  1362 class CMDBRecordLink : public CMDBRecordLinkBase
  1363 /**
  1364  This container expresses a 'soft-link' to a record in another table.
  1365 
  1366  The value of a CMDBRecordLink field as stored in the database is the 
  1367  ElementId (<Table><Record>) of the linked record.
  1368 
  1369  The linked record itself can be viewed via the iLinkedRecord member and its accessors
  1370  
  1371  iLinkedRecord must be created explicitly by the client - either on construction, 
  1372  or by use of the CreateLinkL or SetLinkL functions. Often the linked record is not 
  1373  required by a caller.  So creating it automatically would just waste memory
  1374  
  1375  When instantiating iLinkedRecord directly take care to match the object's type to the Type 
  1376  ID that will be found at the linking element.  It is better to use the CreateLinkL or 
  1377  SetLinkL functions to ensure type safety
  1378  
  1379  Calling MMetaDatabase functions on a CMDRecordLink field directly will perform the operation
  1380  on the field and also the linked record if it is present 
  1381 @publishedAll
  1382 @released
  1383 */
  1384 {
  1385 public :
  1386 	/**
  1387 	Constructor/Destructor
  1388 
  1389 	@publishedAll
  1390 	*/
  1391 
  1392 	inline CMDBRecordLink()
  1393 		: CMDBRecordLinkBase() {}
  1394 
  1395 	/**
  1396 	Constructor
  1397 
  1398 	@publishedAll
  1399 	*/
  1400 	inline CMDBRecordLink(TMDBElementId aLinkingFieldId)
  1401 		: CMDBRecordLinkBase(aLinkingFieldId) {}
  1402 
  1403 	/**
  1404 	Constructor
  1405 
  1406 	@publishedAll
  1407 	*/
  1408 	inline CMDBRecordLink(TMDBElementId aLinkingFieldId, RECORD_TYPE* aLinkedRecord)
  1409 		: CMDBRecordLinkBase(aLinkingFieldId, (CMDBElement*)aLinkedRecord) {}
  1410 
  1411 	/**
  1412 	@publishedAll
  1413 	*/
  1414 	inline CMDBRecordLink& operator=(const TMDBElementId aValue)
  1415 	{
  1416 		return (CMDBRecordLink&)CMDBRecordLinkBase::operator=(aValue);
  1417 	}
  1418 	
  1419 
  1420     // SETTERS
  1421 
  1422 	/**
  1423 	Set the field value (this will be validated on StoreL)
  1424 
  1425 	@publishedAll
  1426 	*/
  1427 	inline void SetL(const TMDBElementId aValue)
  1428 		{
  1429 		CMDBRecordLinkBase::operator=(aValue);
  1430 		}
  1431 		
  1432 
  1433     // OPERATORS
  1434 
  1435 	/**
  1436 	conversion operator for linked record of this type
  1437 
  1438 	@publishedAll
  1439 	*/
  1440 	inline operator RECORD_TYPE*()
  1441 	{
  1442 		return static_cast<RECORD_TYPE*>(iLinkedRecord);
  1443 	}	
  1444 
  1445 };
  1446 
  1447 enum TFieldTypeAttributes
  1448 /**
  1449 To express type information for all MetaDatabase fields
  1450 @publishedAll
  1451 @released
  1452 */
  1453 	{
  1454 	ENoAttrs,	///< No attributes associated with this field.
  1455 	ENotNull, 	///< Ensures the field contains a value and must not be null.	
  1456 	};
  1457 
  1458 typedef struct
  1459 /**
  1460 To express type information for all MetaDatabase fields
  1461 @publishedAll
  1462 @released
  1463 */
  1464 	{
  1465 		const TMDBElementId	        iTypeId;		///< Identifier for the field.	
  1466 		const TInt                  iValType;		///< The field type value e.g.EText, EMedText.
  1467 	    const TFieldTypeAttributes	iTypeAttr;		///< The field attribute, either ENoAttrs or ENotNull.
  1468         const TText * const         iTypeName;		///< Name of the field type.
  1469 	    
  1470 	} SRecordTypeInfo;
  1471 
  1472 
  1473 #define MDB_GENERIC_TYPE_INFO(a, b, c, d) SGenericRecordTypeInfo(a, b, c, d)
  1474 
  1475 typedef TBuf<64> TGenericTypeName;
  1476 
  1477 typedef struct SGenericRecordTypeInfoTag
  1478 /**
  1479 To express type information for all MetaDatabase fields
  1480 @publishedAll
  1481 @released
  1482 */
  1483 	{
  1484 	     SGenericRecordTypeInfoTag()
  1485     	     : iTypeId(0), iValType(0), iTypeAttr(ENoAttrs) {}
  1486 
  1487 	     SGenericRecordTypeInfoTag(TMDBElementId        aId,
  1488 	                               TInt                 aVal,
  1489 	                               TFieldTypeAttributes aAttrType)
  1490    	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType)
  1491     	        {
  1492     	        }
  1493 
  1494 	     SGenericRecordTypeInfoTag(TMDBElementId        aId,
  1495 	                               TInt                 aVal,
  1496 	                               TFieldTypeAttributes aAttrType,
  1497 	                               TText * const        aTypeName)
  1498     	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType), iTypeName(aTypeName)
  1499     	        {
  1500     	        
  1501     	        }
  1502 
  1503 
  1504 	     SGenericRecordTypeInfoTag(      TMDBElementId        aId,
  1505 	                                     TInt                 aVal,
  1506 	                                     TFieldTypeAttributes aAttrType,
  1507 	                               const TGenericTypeName&    aTypeName)
  1508     	     : iTypeId(aId), iValType(aVal), iTypeAttr(aAttrType), iTypeName(aTypeName) {}
  1509 
  1510 
  1511 		 TMDBElementId	       iTypeId;			///< Identifier for the field type.	
  1512 		 TInt                  iValType;		///< The field type value e.g.EText, EMedText.
  1513 	     TFieldTypeAttributes  iTypeAttr;		///< The type's attribute, either ENoAttrs or ENotNull
  1514          TGenericTypeName	   iTypeName;		///< Name of the field type.
  1515 	} SGenericRecordTypeInfo;
  1516 	
  1517 	
  1518 
  1519 class CMDBRecordBase : public CMDBNumFieldBase
  1520 /**
  1521 Base class for all MetaDatabase records
  1522 @publishedAll
  1523 @released
  1524 */
  1525 	{
  1526 	public:
  1527 
  1528 		inline CMDBRecordBase(){}
  1529 		inline CMDBRecordBase(TMDBElementId aElementId)
  1530 			: CMDBNumFieldBase(aElementId | KCDMaskShowFieldType){}
  1531 			
  1532 		IMPORT_C virtual CMDBElement* GetFieldByNameL(const TPtrC& aFieldName, TInt& aValType );
  1533 
  1534 		IMPORT_C virtual CMDBElement* GetFieldByIdL(TMDBElementId aId);
  1535 		
  1536 		IMPORT_C virtual const SRecordTypeInfo* GetRecordInfo();
  1537 		
  1538 	};
  1539 
  1540 
  1541 
  1542 class CMDBGenericRecord : public CMDBRecordBase
  1543 /**
  1544 Container for data and type information in a MetaDatabase record
  1545 For use to contain user-defined records as an alternative to declaring a 
  1546 specific record class of type CCDRecordBase
  1547 
  1548 @publishedAll
  1549 @released
  1550 */
  1551     {
  1552 friend class TMDBGenericRecordVisitor;  
  1553 friend class CMDBSessionImpl;  
  1554 	public:
  1555 
  1556 
  1557 		EXP_DATA_VTABLE
  1558 		    
  1559 		explicit inline CMDBGenericRecord(TMDBElementId aElementId)
  1560 			: CMDBRecordBase(aElementId) {}
  1561 
  1562         IMPORT_C ~CMDBGenericRecord();
  1563 
  1564 		IMPORT_C virtual CMDBElement* GetFieldByNameL(const TPtrC& aFieldName, TInt& aValType );
  1565 
  1566 		IMPORT_C CMDBElement* GetFieldByIdL(TMDBElementId aId);
  1567 		
  1568 		
  1569 		IMPORT_C void InitializeL(const TDesC& aTableName, const SGenericRecordTypeInfo*  aNewTableInfo);
  1570 		
  1571 
  1572 	private:
  1573 
  1574         /*
  1575         The name of this record type
  1576         */
  1577 	    TBuf<KCDMaxFieldNameLength>   	iRecordType; 
  1578         
  1579         /*
  1580         array of type information about fields in this record
  1581         order of field info should match order of fields
  1582         */
  1583         RArray<SGenericRecordTypeInfo>  iRecordInfo;
  1584         /*
  1585         array of fields in this record
  1586         order of fields should match order of field info
  1587         */
  1588 		RPointerArray<CMDBElement>      iFields;
  1589 	};
  1590 
  1591 
  1592 
  1593 class CMDBRecordSetBase : public CMDBTextFieldBase
  1594 /**
  1595 Use this class to express a list of records MetaDatabase Element type
  1596 Records can be ordered using the standard RPointerArray functions
  1597 
  1598 @publishedAll
  1599 @released
  1600 */
  1601     {
  1602     public:
  1603 		/**
  1604 		@internalComponent
  1605 		*/
  1606     	IMPORT_C CMDBRecordSetBase();
  1607 
  1608 		/**
  1609 		@internalComponent
  1610 		*/
  1611     	IMPORT_C CMDBRecordSetBase(TMDBElementId aElementId);
  1612 
  1613 		/**
  1614 		@internalComponent
  1615 		*/
  1616     	IMPORT_C ~CMDBRecordSetBase();
  1617 
  1618         inline CMDBRecordSetBase& operator=(const TPtrC& aValue)
  1619         {
  1620         return (CMDBRecordSetBase&)CMDBTextFieldBase::operator=(aValue);
  1621         }
  1622 	
  1623 	protected:
  1624 
  1625     	EXP_DATA_VTABLE
  1626 
  1627     public:
  1628        
  1629     	RPointerArray<CMDBRecordBase> iRecords;
  1630 
  1631     };
  1632 
  1633 
  1634 
  1635 template <class TYPE>
  1636 class CMDBRecordSet : public CMDBRecordSetBase
  1637 /**
  1638 Use this class to express a list of records of a particular MetaDatabase Element type
  1639 Records can be ordered using the standard RPointerArray functions
  1640 
  1641 @publishedAll
  1642 */
  1643 {
  1644 public:
  1645 
  1646 	inline CMDBRecordSet(){}
  1647 
  1648 	inline CMDBRecordSet(TMDBElementId aElementId)
  1649 		: CMDBRecordSetBase(aElementId) {}
  1650 		
  1651 	inline CMDBRecordSet<TYPE>& operator=(const TPtrC& aValue)
  1652 	{
  1653 		return (CMDBRecordSet<TYPE>&)CMDBRecordSetBase::operator=(aValue);
  1654 	}
  1655     		
  1656 	inline TYPE* operator [](const TInt i)
  1657 	{
  1658 		return (TYPE*)iRecords[i];
  1659 	}
  1660 
  1661 private:
  1662 
  1663 };
  1664 
  1665 
  1666 
  1667 
  1668 } //end namespace CommsDat
  1669 
  1670 #endif  // METADATABASE_H