0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / CDM / CDM_Application.cxx
1 // Created on: 1997-10-22
2 // Created by: Jean-Louis Frenkel
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17
18 #include <CDM_Application.hxx>
19 #include <CDM_Document.hxx>
20 #include <CDM_MetaData.hxx>
21 #include <Resource_Manager.hxx>
22 #include <Standard_Dump.hxx>
23 #include <Standard_Type.hxx>
24 #include <TCollection_ExtendedString.hxx>
25 #include <Message.hxx>
26 #include <Message_Messenger.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(CDM_Application,Standard_Transient)
29
30 //=======================================================================
31 //function : Constructor
32 //purpose  : 
33 //=======================================================================
34 CDM_Application::CDM_Application()
35 {
36   myMessenger = new Message_Messenger;
37 }
38 //=======================================================================
39 //function : SetDocumentVersion
40 //purpose  : 
41 //=======================================================================
42 void CDM_Application::SetDocumentVersion
43                         (const Handle(CDM_Document)& aDocument,
44                          const Handle(CDM_MetaData)& aMetaData) const
45 {
46   aDocument->SetModifications(aMetaData->DocumentVersion(this));
47 }
48
49 //=======================================================================
50 //function : SetReferenceCounter
51 //purpose  : 
52 //=======================================================================
53
54 void CDM_Application::SetReferenceCounter
55                         (const Handle(CDM_Document)& aDocument,
56                          const Standard_Integer aReferenceCounter)
57 {
58   aDocument->SetReferenceCounter(aReferenceCounter);
59 }
60
61 //=======================================================================
62 //function : MessageDriver
63 //purpose  : 
64 //=======================================================================
65
66 Handle(Message_Messenger) CDM_Application::MessageDriver()
67 {
68   return myMessenger;
69 }
70
71 //=======================================================================
72 //function : Write
73 //purpose  : 
74 //=======================================================================
75
76 void CDM_Application::Write(const Standard_ExtString aString)
77 {
78   MessageDriver()->Send(aString);
79 }
80
81 //=======================================================================
82 //function : BeginOfUpdate
83 //purpose  : 
84 //=======================================================================
85
86 void CDM_Application::BeginOfUpdate (const Handle(CDM_Document)& /*aDocument*/)
87 {
88   TCollection_ExtendedString updating("Updating: ");
89   updating += "Document";
90   Write(updating.ToExtString());
91 }
92
93 //=======================================================================
94 //function : EndOfUpdate
95 //purpose  : 
96 //=======================================================================
97
98 void CDM_Application::EndOfUpdate
99                         (const Handle(CDM_Document)&       /*aDocument*/,
100                          const Standard_Boolean            theStatus,
101                          const TCollection_ExtendedString& /*ErrorString*/)
102 {
103   TCollection_ExtendedString message;
104   if (theStatus)
105     message="Updated: ";
106   else
107     message="Error during updating: ";
108       
109   message+="Document";
110   Write(message.ToExtString());
111 }
112
113 //=======================================================================
114 //function : Name
115 //purpose  : returns the application name
116 //=======================================================================
117
118 TCollection_ExtendedString CDM_Application::Name() const
119 {
120   // Default: empty
121   return TCollection_ExtendedString();
122 }
123
124 //=======================================================================
125 //function : Version
126 //purpose  : returns the application version
127 //=======================================================================
128
129 TCollection_AsciiString CDM_Application::Version() const
130 {
131   // Default: empty
132   return TCollection_AsciiString();
133 }
134
135 //=======================================================================
136 //function : MetaDataLookUpTable
137 //purpose  : returns the MetaData LookUpTable
138 //=======================================================================
139 CDM_MetaDataLookUpTable& CDM_Application::MetaDataLookUpTable()
140 {
141   return myMetaDataLookUpTable;
142 }
143
144 //=======================================================================
145 //function : DumpJson
146 //purpose  : 
147 //=======================================================================
148 void CDM_Application::DumpJson (Standard_OStream& theOStream, Standard_Integer /*theDepth*/) const
149 {
150   OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
151 }