0024157: Parallelization of assembly part of BO
[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-2012 OPEN CASCADE SAS
5 //
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
10 //
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 //
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
20
21
22
23 #include <CDM_Application.ixx>
24 #include <CDM_NullMessageDriver.hxx>
25
26 //=======================================================================
27 //function : SetDocumentVersion
28 //purpose  : 
29 //=======================================================================
30
31 void CDM_Application::SetDocumentVersion
32                         (const Handle(CDM_Document)& aDocument,
33                          const Handle(CDM_MetaData)& aMetaData) const
34 {
35   aDocument->SetModifications(aMetaData->DocumentVersion(this));
36 }
37
38 //=======================================================================
39 //function : SetReferenceCounter
40 //purpose  : 
41 //=======================================================================
42
43 void CDM_Application::SetReferenceCounter
44                         (const Handle(CDM_Document)& aDocument,
45                          const Standard_Integer aReferenceCounter)
46 {
47   aDocument->SetReferenceCounter(aReferenceCounter);
48 }
49
50 //=======================================================================
51 //function : MessageDriver
52 //purpose  : 
53 //=======================================================================
54
55 Handle(CDM_MessageDriver) CDM_Application::MessageDriver()
56 {
57   static Handle(CDM_NullMessageDriver) theMessageDriver
58     =new CDM_NullMessageDriver;
59   return theMessageDriver;
60 }
61
62 //=======================================================================
63 //function : Write
64 //purpose  : 
65 //=======================================================================
66
67 void CDM_Application::Write(const Standard_ExtString aString)
68 {
69   MessageDriver()->Write(aString);
70 }
71
72 //=======================================================================
73 //function : BeginOfUpdate
74 //purpose  : 
75 //=======================================================================
76
77 void CDM_Application::BeginOfUpdate (const Handle(CDM_Document)& aDocument)
78 {
79   TCollection_ExtendedString updating("Updating:");
80   updating+=aDocument->Presentation();
81   Write(updating.ToExtString());
82 }
83
84 //=======================================================================
85 //function : EndOfUpdate
86 //purpose  : 
87 //=======================================================================
88
89 void CDM_Application::EndOfUpdate
90                         (const Handle(CDM_Document)&       aDocument,
91                          const Standard_Boolean            Status,
92                          const TCollection_ExtendedString& /*ErrorString*/)
93 {
94   TCollection_ExtendedString message;
95   if (Status) 
96     message="Updated:";
97   else
98     message="Error during updating:";
99       
100   message+=aDocument->Presentation();
101   Write(message.ToExtString());
102 }