0030895: Coding Rules - specify std namespace explicitly for std::cout and streams
[occt.git] / src / BinXCAFDrivers / BinXCAFDrivers.cxx
1 // Created on: 2005-04-18
2 // Created by: Eugeny NAPALKOV
3 // Copyright (c) 2005-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
17 #include <BinDrivers.hxx>
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 <Message_Messenger.hxx>
24 #include <Plugin_Macro.hxx>
25 #include <Standard_Failure.hxx>
26 #include <Standard_GUID.hxx>
27 #include <TDocStd_Application.hxx>
28
29 static Standard_GUID BinXCAFStorageDriver  ("a78ff496-a779-11d5-aab4-0050044b1af1");
30 static Standard_GUID BinXCAFRetrievalDriver("a78ff497-a779-11d5-aab4-0050044b1af1");
31
32 //=======================================================================
33 //function :
34 //purpose  : 
35 //=======================================================================
36 const Handle(Standard_Transient)& BinXCAFDrivers::Factory(const Standard_GUID& theGUID) {
37
38   if (theGUID == BinXCAFStorageDriver)
39   {
40 #ifdef OCCT_DEBUG
41     std::cout << "BinXCAFDrivers : Storage Plugin" << std::endl;
42 #endif
43     static Handle(Standard_Transient) model_sd =
44       new BinXCAFDrivers_DocumentStorageDriver;
45     return model_sd;
46   }
47
48   if (theGUID == BinXCAFRetrievalDriver)
49   {
50 #ifdef OCCT_DEBUG
51     std::cout << "BinXCAFDrivers : Retrieval Plugin" << std::endl;
52 #endif
53     static Handle(Standard_Transient) model_rd =
54       new BinXCAFDrivers_DocumentRetrievalDriver;
55     return model_rd;
56   }
57
58
59   throw Standard_Failure("XCAFBinDrivers : unknown GUID");
60 }
61
62 //=======================================================================
63 //function : DefineFormat
64 //purpose  : 
65 //=======================================================================
66 void BinXCAFDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
67 {
68   theApp->DefineFormat ("BinXCAF", "Binary XCAF Document", "xbf",
69                         new BinXCAFDrivers_DocumentRetrievalDriver, 
70                         new BinXCAFDrivers_DocumentStorageDriver);
71 }
72
73 //=======================================================================
74 //function :
75 //purpose  : 
76 //=======================================================================
77 Handle(BinMDF_ADriverTable) BinXCAFDrivers::AttributeDrivers(const Handle(Message_Messenger)& aMsgDrv) {
78   // Standard Drivers
79   Handle(BinMDF_ADriverTable) aTable = BinDrivers::AttributeDrivers(aMsgDrv);
80
81   // XCAF Drivers
82   BinMXCAFDoc::AddDrivers(aTable, aMsgDrv);
83
84   return aTable;
85 }
86
87 PLUGIN(BinXCAFDrivers)