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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
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>
28 IMPLEMENT_STANDARD_RTTIEXT(CDM_Application,Standard_Transient)
30 //=======================================================================
31 //function : Constructor
33 //=======================================================================
34 CDM_Application::CDM_Application()
36 myMessenger = new Message_Messenger;
38 //=======================================================================
39 //function : SetDocumentVersion
41 //=======================================================================
42 void CDM_Application::SetDocumentVersion
43 (const Handle(CDM_Document)& aDocument,
44 const Handle(CDM_MetaData)& aMetaData) const
46 aDocument->SetModifications(aMetaData->DocumentVersion(this));
49 //=======================================================================
50 //function : SetReferenceCounter
52 //=======================================================================
54 void CDM_Application::SetReferenceCounter
55 (const Handle(CDM_Document)& aDocument,
56 const Standard_Integer aReferenceCounter)
58 aDocument->SetReferenceCounter(aReferenceCounter);
61 //=======================================================================
62 //function : MessageDriver
64 //=======================================================================
66 Handle(Message_Messenger) CDM_Application::MessageDriver()
71 //=======================================================================
74 //=======================================================================
76 void CDM_Application::Write(const Standard_ExtString aString)
78 MessageDriver()->Send(aString);
81 //=======================================================================
82 //function : BeginOfUpdate
84 //=======================================================================
86 void CDM_Application::BeginOfUpdate (const Handle(CDM_Document)& /*aDocument*/)
88 TCollection_ExtendedString updating("Updating: ");
89 updating += "Document";
90 Write(updating.ToExtString());
93 //=======================================================================
94 //function : EndOfUpdate
96 //=======================================================================
98 void CDM_Application::EndOfUpdate
99 (const Handle(CDM_Document)& /*aDocument*/,
100 const Standard_Boolean theStatus,
101 const TCollection_ExtendedString& /*ErrorString*/)
103 TCollection_ExtendedString message;
107 message="Error during updating: ";
110 Write(message.ToExtString());
113 //=======================================================================
115 //purpose : returns the application name
116 //=======================================================================
118 TCollection_ExtendedString CDM_Application::Name() const
121 return TCollection_ExtendedString();
124 //=======================================================================
126 //purpose : returns the application version
127 //=======================================================================
129 TCollection_AsciiString CDM_Application::Version() const
132 return TCollection_AsciiString();
135 //=======================================================================
136 //function : MetaDataLookUpTable
137 //purpose : returns the MetaData LookUpTable
138 //=======================================================================
139 CDM_MetaDataLookUpTable& CDM_Application::MetaDataLookUpTable()
141 return myMetaDataLookUpTable;
144 //=======================================================================
145 //function : DumpJson
147 //=======================================================================
148 void CDM_Application::DumpJson (Standard_OStream& theOStream, Standard_Integer /*theDepth*/) const
150 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)