[Classes] [Prev] [Next] [Methods]

CTdiTableFactory

Methods Index

Heritage
Description
Usage
Override
Public Methods

CTdiTableFactory


Heritage

Superclass: None

Subclasses: None


Description

CTdiTableFactory parameterizes TDI table connections for specific connections such as from a database qeury to a table view.


Usage

See CTdiTableConnection for general usage.

CTdiTableConnection connection relies on a factory object, derived from CTdiTableFactory, for the actual instantiation of the CTdiValue prototypes capable of making the necessary filtering and translation for TDI table connections. You need to ensure that the connection classes are using an appropriate factory object which can create the correct prototypes for the type of data sent by the provider.

There are two ways of parametrizing the connection classes with a connection factory object. One is to pass a pointer to such factory in the construction of the connection. The second is to register a default factory object with the Power++ global CFactoryMgr under this ID: CTdiTableFactoryID. This default factory is then used whenever the constructor of the connection classes is not provided a specific factory.

The following example comes from the samples/arch/tditable sample application.

CTableDoc::CTableDoc(CApplication* theApplication, 
PWRID theDocumentId) : CDocument(theApplication,
theDocumentId), itsState(NULL)

{
// Create the TDI Array connection factory. This is what
// causes the front end TDI connections (created by the
// window classes) to specialize for CTdiArray
// connectivity. If we wanted to change the data
// connection to a different source, all we would change
// is the code below.
G->GetFactoryMgr()->AddFactory(
CTdiTableFactoryID, new CTdiArrayTableFactory()
);
}

Override

You may need to create a derived version of the CTdiTableFactory that will provide prototypes for different types of providers. For an example dealing with connection to database tables, see the derived version of CTdiTableFactory, CTdiDBTableFactory, in the XVT-ODBC++ Reference.


Public Methods

virtual CTdiValue* NewRowPrototype(
int theRow,
long theContext) = 0;
virtual CTdiValue* NewColumnPrototype(
int theColumn,
long theContext) = 0;
virtual CTdiValue* NewColumnPrototype(
CStringRW theColumn,
long theContext) = 0;
virtual CTdiValue* NewFieldPrototype(
int theRow,
int theColumn,
long theContext) = 0;
virtual CTdiValue* NewFieldPrototype(
int theRow,
CStringRW theColumnName,
long theContext) = 0;
virtual CTdiValue* NewIndexPrototype(
long theContext) = 0;



[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.