0032751: Coding - get rid of unused headers [AppStd to BndLib]
[occt.git] / src / BinTObjDrivers / BinTObjDrivers.cxx
1 // Created on: 2004-11-24
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2004-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 // The original implementation Copyright: (C) RINA S.p.A
17
18 #include <BinLDrivers.hxx>
19 #include <BinTObjDrivers.hxx>
20 #include <BinTObjDrivers_DocumentStorageDriver.hxx>
21 #include <BinTObjDrivers_DocumentRetrievalDriver.hxx>
22 #include <BinTObjDrivers_IntSparseArrayDriver.hxx>
23 #include <BinTObjDrivers_ModelDriver.hxx>
24 #include <BinTObjDrivers_ObjectDriver.hxx>
25 #include <BinTObjDrivers_ReferenceDriver.hxx>
26 #include <BinTObjDrivers_XYZDriver.hxx>
27 #include <Plugin_Macro.hxx>
28 #include <TDocStd_Application.hxx>
29
30 static Standard_GUID BinStorageDriver  ("f78ff4a2-a779-11d5-aab4-0050044b1af1");
31 static Standard_GUID BinRetrievalDriver("f78ff4a3-a779-11d5-aab4-0050044b1af1");
32
33 const Handle(Standard_Transient)& BinTObjDrivers::Factory(const Standard_GUID& aGUID)
34 {
35   if(aGUID == BinStorageDriver)
36   {
37 #ifdef OCCT_DEBUG
38     std::cout << "BinTObjDrivers : Storage Plugin" << std::endl;
39 #endif
40     static Handle(Standard_Transient) model_sd
41       = new BinTObjDrivers_DocumentStorageDriver;
42     return model_sd;
43   }
44
45   if(aGUID == BinRetrievalDriver)
46   {  
47 #ifdef OCCT_DEBUG
48     std::cout << "BinTObjDrivers : Retrieval Plugin" << std::endl;
49 #endif
50     static Handle (Standard_Transient) model_rd
51       = new BinTObjDrivers_DocumentRetrievalDriver;
52     return model_rd;
53   }
54
55   return BinLDrivers::Factory (aGUID);
56 }
57
58 //=======================================================================
59 //function : DefineFormat
60 //purpose  : 
61 //=======================================================================
62 void BinTObjDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
63 {
64   theApp->DefineFormat ("TObjBin", "Binary TObj OCAF Document", "cbf",
65                         new BinTObjDrivers_DocumentRetrievalDriver, 
66                         new BinTObjDrivers_DocumentStorageDriver);
67 }
68
69 //=======================================================================
70 //function : AddDrivers
71 //purpose  : 
72 //=======================================================================
73 void BinTObjDrivers::AddDrivers (const Handle(BinMDF_ADriverTable)& aDriverTable,
74                                  const Handle(Message_Messenger)&   aMsgDrv)
75 {
76   aDriverTable -> AddDriver (new BinTObjDrivers_ModelDriver      (aMsgDrv));
77   aDriverTable -> AddDriver (new BinTObjDrivers_ObjectDriver     (aMsgDrv));
78   aDriverTable -> AddDriver (new BinTObjDrivers_ReferenceDriver  (aMsgDrv));
79   aDriverTable -> AddDriver (new BinTObjDrivers_XYZDriver        (aMsgDrv));
80   aDriverTable -> AddDriver (new BinTObjDrivers_IntSparseArrayDriver (aMsgDrv));
81 }
82
83 PLUGIN(BinTObjDrivers)