Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / doc / MEDMEM / HOWTO_Create_A_New_Driver.txt
1 Within MEDMEM_GenDriver.hxx :
2  /* Modify the following line to add a new driver type (step 1) */
3   typedef enum { MED_DRIVER = 0, GIBI_DRIVER = 1, VTK_DRIVER = 254, NO_DRIVER = 255 } driverTypes;
4
5 Note : MED Drivers with no Mesh or Field drivers must have a number of 255-i !
6
7 Within MEDMEM_Object.hxx
8   // Add your personnal driver header & line (step 2)
9   // At least one line must exist
10   // You have to respect the syntax.
11   #include "MEDMEM_TypeObjectDriver.hxx"
12
13   friend class MED_OBJECT_RDONLY_DRIVER; 
14   friend class MED_OBJECT_WRONLY_DRIVER; 
15   friend class MED_OBJECT_RDWR_DRIVER;  
16
17   // Add a similar line for your personnal driver (step 3) 
18   static INSTANCE_DE<MED_OBJECT_RDWR_DRIVER> inst_med ;
19
20 Within MEDMEM_Object.cxx
21   // Add a similar line for your personnal driver (step 3) 
22   static INSTANCE_DE<MED_OBJECT_RDWR_DRIVER> inst_med ;
23
24   // Add your own driver in the driver list       (step 4) 
25   // Note the list must be coherent with the driver type list defined in MEDMEM_DRIVER.hxx. 
26    const OBJECT::INSTANCE * const OBJECT::instances[] =   {  &OBJECT::inst_med } ;
27
28 Within MEDMEM_TypeObjectDriver.hxx (ypu can use MEDMEM_TypeObjectDriver.hxx as a pattern for your driver !)
29
30   // Faux : you have to create at least create a TYPE_OBJECT_RDWR_DRIVER even if it only throw an exception
31   // Faux : because RDONLY or WRONLY doesn't exists.
32
33   Whatever is your driver : RDONLY,WRONLY,RDWR, you must inplement the write & read methods ( even if it only throw an exception)
34
35 TODO :
36
37 Gerer l'appartenance d'un driver type 3 Within l'objet
38
39 Within les méthodes addDriver :
40   driver = instances[driverType]->run(fileName, this) ; --> Il faut vérifier que le numéro auquel on accède existe !