FIDAL - Financial Data Access Library |
| How-to add a data source driver
1.0 IntroductionThis document explain how someone can contribute the support of a new data source driver. This document is intended for developers working on enhancing FIDAL, not for user of FIDAL. User should instead consult the List Of Data Source or the API documents. FIDAL design attempts to make the data source driver to be loosely coupled. This allow to add/remove data source without large impact on the code shared by the whole library. The drivers are found in the fd_source directory. The data source driver is implemented by providing approximately 10 well defined functions. These are explained in fd_source.h and it is strongly suggested to read this file first.
2.0 DesignResponsibilities of the data source driver are:
Responsibility of FIDAL (the caller of the data source driver) are:
3.0 Multithread ConsiderationFIDAL can be build with or without multi-thread support. This must be considered also in the data source driver. Code to handle Multithread (like semaphore get/release) should not be in the single thread version. To make that possible, you can use the FD_SINGLE_THREAD definition as follow: #if !defined( FD_SINGLE_THREAD )/* ... add code here for handling multithread... */#endifThe following functions are called from only one thread:
All the other functions in the data source driver can be called by multiple thread. The initializeSourceDriver function is guaranteed to be called only once by only one thread. It might get called again only following a corresponding shutdownSourceDriver. The driver can assume that shutdownSourceDriver is called while no other thread will be in any of the other driver functions. The following functions can be called by multiple threads:
The usage of the "FD_DataSourceHandle *handle" is a very convenient way to isolate data between the thread. When the user does a FD_AddDataSource, the "openSource" gets called once. All subsequent call for this data source will refer to this "handle". For a given "FD_DataSourceHandle *handle" the following will be called as if from the same thread:
The following functions can be called by multiple-thread, even for the same "FD_DataSourceHandle *handle":
The driver can assume that upon a "closeSource" call, no other thread will be in the other driver function for the same "FD_DataSourceHandle *handle". 4.0 Future PlanPlan on long term for possible drivers capability are:
Plan on long term for the common features are:
|
|