1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
// File: TopOpeBRep_traceSIFF.cxx
// Created: Wed Oct 22 18:57:02 1997
// Author: Jean Yves LEBEY
// <jyl@bistrox.paris1.matra-dtv.fr>
#ifdef DEB
#include <TopOpeBRep_traceSIFF.hxx>
#include <stdio.h>
TopOpeBRep_traceSIFF::TopOpeBRep_traceSIFF()
{
Reset();
}
void TopOpeBRep_traceSIFF::Reset()
{
mybrep1 = "";
mybrep2 = "";
myfilename = "";
myopen = Standard_False;
}
void TopOpeBRep_traceSIFF::Set(const Standard_Boolean b,
Standard_Integer n,
char**a)
{
if (n < 3 || !b || a == NULL) {
Reset();
return;
}
mybrep1 = a[0];
mybrep2 = a[1];
myfilename = a[2];
}
void TopOpeBRep_traceSIFF::Set(const TCollection_AsciiString& brep1,
const TCollection_AsciiString& brep2,
const TCollection_AsciiString& filename)
{
mybrep1 = brep1;
mybrep2 = brep2;
myfilename = filename;
}
TCollection_AsciiString TopOpeBRep_traceSIFF::Name1(const Standard_Integer I) const
{
TCollection_AsciiString s = mybrep1 + "_" + I;
return s;
}
TCollection_AsciiString TopOpeBRep_traceSIFF::Name2(const Standard_Integer I) const
{
TCollection_AsciiString s = mybrep2 + "_" + I;
return s;
}
const TCollection_AsciiString& TopOpeBRep_traceSIFF::File() const
{
return myfilename;
}
Standard_Boolean TopOpeBRep_traceSIFF::Start(const TCollection_AsciiString& s,
Standard_OStream& OS)
{
Standard_CString cs = myfilename.ToCString();
myopen = Standard_True;
if (!myfilebuf.open(cs,ios::out)) {
myopen = Standard_False;
}
if (!myopen) {
return myopen;
}
ostream osfic(&myfilebuf); osfic.precision(15);
if (s.Length()) {
OS<<s<<myfilename<<endl;
}
return myopen;
}
void TopOpeBRep_traceSIFF::Add(const Standard_Integer I1,
const Standard_Integer I2)
{
if (!myopen) {
return;
}
TCollection_AsciiString n1 = Name1(I1);
TCollection_AsciiString n2 = Name2(I2);
ostream osfic(&myfilebuf);
osfic<<n1<<" "<<n2<<"\n";
}
void TopOpeBRep_traceSIFF::End(const TCollection_AsciiString& s,
Standard_OStream& OS)
{
if (!myopen) {
return;
}
if (s.Length()) {
OS<<s<<myfilename<<endl;
}
myopen = Standard_False;
}
//////////////////////////////////////////////////////////////////////////
Standard_EXPORT TopOpeBRep_traceSIFF SIFF;
Standard_EXPORT void TopOpeBRep_SettraceSIFF(const Standard_Boolean b,
Standard_Integer n,char**a)
{
SIFF.Set(b,n,a);
}
Standard_EXPORT Standard_Boolean TopOpeBRep_GettraceSIFF()
{
Standard_Boolean b = (SIFF.File().Length() != 0);
return b;
}
// #ifdef DEB
#endif
|