0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BinXCAFDrivers / BinXCAFDrivers.cxx
CommitLineData
b311480e 1// Created on: 2005-04-18
2// Created by: Eugeny NAPALKOV
973c2be1 3// Copyright (c) 2005-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
7fd59977 16
7fd59977 17#include <BinDrivers.hxx>
42cf5bc1 18#include <BinMDF_ADriverTable.hxx>
19#include <BinMXCAFDoc.hxx>
20#include <BinXCAFDrivers.hxx>
21#include <BinXCAFDrivers_DocumentRetrievalDriver.hxx>
22#include <BinXCAFDrivers_DocumentStorageDriver.hxx>
23#include <CDM_MessageDriver.hxx>
7fd59977 24#include <Plugin_Macro.hxx>
42cf5bc1 25#include <Standard_Failure.hxx>
26#include <Standard_GUID.hxx>
27#include <Standard_Transient.hxx>
7fd59977 28
7fd59977 29static Standard_GUID BinXCAFStorageDriver ("a78ff496-a779-11d5-aab4-0050044b1af1");
30static Standard_GUID BinXCAFRetrievalDriver("a78ff497-a779-11d5-aab4-0050044b1af1");
31
7fd59977 32//=======================================================================
33//function :
34//purpose :
35//=======================================================================
ce8b059a 36const Handle(Standard_Transient)& BinXCAFDrivers::Factory(const Standard_GUID& theGUID) {
7fd59977 37
38 if (theGUID == BinXCAFStorageDriver)
39 {
0797d9d3 40#ifdef OCCT_DEBUG
7fd59977 41 cout << "BinXCAFDrivers : Storage Plugin" << endl;
63c629aa 42#endif
7fd59977 43 static Handle(BinXCAFDrivers_DocumentStorageDriver) model_sd =
44 new BinXCAFDrivers_DocumentStorageDriver;
45 return model_sd;
46 }
47
48 if (theGUID == BinXCAFRetrievalDriver)
49 {
0797d9d3 50#ifdef OCCT_DEBUG
7fd59977 51 cout << "BinXCAFDrivers : Retrieval Plugin" << endl;
63c629aa 52#endif
7fd59977 53 static Handle(BinXCAFDrivers_DocumentRetrievalDriver) model_rd =
54 new BinXCAFDrivers_DocumentRetrievalDriver;
55 return model_rd;
56 }
57
58
59 Standard_Failure::Raise ("XCAFBinDrivers : unknown GUID");
ce8b059a 60 static Handle(Standard_Transient) aNullHandle;
61 return aNullHandle;
7fd59977 62}
63
64//=======================================================================
65//function :
66//purpose :
67//=======================================================================
68Handle(BinMDF_ADriverTable) BinXCAFDrivers::AttributeDrivers(const Handle(CDM_MessageDriver)& aMsgDrv) {
69 // Standard Drivers
70 Handle(BinMDF_ADriverTable) aTable = BinDrivers::AttributeDrivers(aMsgDrv);
71
72 // XCAF Drivers
73 BinMXCAFDoc::AddDrivers(aTable, aMsgDrv);
74
75 return aTable;
76}
77
78PLUGIN(BinXCAFDrivers)