0027104: DownCast() cannot return null for mismatched handle
[occt.git] / src / IGESAppli / IGESAppli.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IGESAppli.hxx>
16 #include <IGESAppli_GeneralModule.hxx>
17 #include <IGESAppli_Protocol.hxx>
18 #include <IGESAppli_ReadWriteModule.hxx>
19 #include <IGESAppli_SpecificModule.hxx>
20 #include <IGESData_SpecificLib.hxx>
21 #include <IGESData_WriterLib.hxx>
22 #include <IGESDefs.hxx>
23 #include <IGESDraw.hxx>
24 #include <Interface_GeneralLib.hxx>
25 #include <Interface_ReaderLib.hxx>
26
27 //  Ancillary data to work on a Package of IGES Entities with a Protocol
28 //  (Modules are created and loaded in appropriate libraries, once by Init)
29 static Handle(IGESAppli_Protocol) protocol;
30
31
32
33     void  IGESAppli::Init ()
34 {
35   IGESDefs::Init();
36   IGESDraw::Init();
37   if (protocol.IsNull()) {
38     protocol = new IGESAppli_Protocol;
39     Interface_GeneralLib::SetGlobal (new IGESAppli_GeneralModule,  protocol);
40     Interface_ReaderLib::SetGlobal  (new IGESAppli_ReadWriteModule,protocol);
41     IGESData_WriterLib::SetGlobal   (new IGESAppli_ReadWriteModule,protocol);
42     IGESData_SpecificLib::SetGlobal (new IGESAppli_SpecificModule, protocol);
43   }
44 }
45
46     Handle(IGESAppli_Protocol)  IGESAppli::Protocol ()
47 {
48   return protocol;
49 }