646b6ee256c3400348c68790c44a40b33e18640c
[occt.git] / src / StepData / StepData_StepDumper.hxx
1 // Created on: 1994-03-14
2 // Created by: Christian CAILLET
3 // Copyright (c) 1994-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 #ifndef _StepData_StepDumper_HeaderFile
18 #define _StepData_StepDumper_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Interface_GeneralLib.hxx>
25 #include <StepData_WriterLib.hxx>
26 #include <StepData_StepWriter.hxx>
27 #include <Standard_Integer.hxx>
28 #include <Standard_Boolean.hxx>
29 class StepData_StepModel;
30 class Interface_InterfaceMismatch;
31 class StepData_Protocol;
32 class StepData_StepWriter;
33
34 //! Provides a way to dump entities processed through STEP, with
35 //! these features :
36 //! - same form as for writing a STEP File (because it is clear
37 //! and compact enough, even if the names of the fields do not
38 //! appear) : thus, no additionnal resource is required
39 //! - possibility to look for an entity itself (only its Type or
40 //! with its content), an entity and it shared items (one level)
41 //! or all the entities its refers to, directly or recursively.
42 class StepData_StepDumper 
43 {
44 public:
45
46   DEFINE_STANDARD_ALLOC
47
48   
49   //! Creates a StepDumper, able to work on a given StepModel
50   //! (which defines the total scope for dumping entities) and
51   //! a given Protocol from Step (which defines the authorized
52   //! types to be dumped)
53   //! <mode> commands what is to be displayed (number or label)
54   //! 0 for number (and corresponding labels  are displayed apart)
55   //! 1 for label  (and corresponding numbers are displayed apart)
56   //! 2 for label without anymore
57   Standard_EXPORT StepData_StepDumper(const Handle(StepData_StepModel)& amodel, const Handle(StepData_Protocol)& protocol, const Standard_Integer mode = 0);
58   
59   //! Gives an access to the tool which is used to work : this allow
60   //! to acts on some parameters : Floating Format, Scopes ...
61   Standard_EXPORT StepData_StepWriter& StepWriter();
62   
63   //! Dumps a Entity on an Messenger. Returns True if
64   //! sucess, False, if the entity to dump has not been recognized
65   //! by the Protocol. <level> can have one of these values :
66   //! - 0 : prints the TYPE only, as known in STEP Files (StepType)
67   //! If <ent> has not been regognized by the Protocol, or if its
68   //! type is Complex, the StepType is replaced by the display of
69   //! the cdl type. Complex Type are well processed by level 1.
70   //! - 1 : dumps the entity, completely (whatever it has simple or
71   //! complex type) but alone.
72   //! - 2 : dumps the entity completely, plus the item its refers to
73   //! at first level (a header message designates the starting
74   //! entity of the dump) <Lists Shared and Implied>
75   //! - 3 : dumps the entity and its refered items at any levels
76   //!
77   //! For levels 1,2,3, the numbers displayed (form #nnn) are the
78   //! numbers of the corresponding entities in the Model
79   Standard_EXPORT Standard_Boolean Dump (Standard_OStream& S, const Handle(Standard_Transient)& ent, const Standard_Integer level);
80   
81   //! Works as Dump with a Transient, but directly takes the
82   //! entity designated by its number in the Model
83   //! Returns False, also if <num> is out of range
84   Standard_EXPORT Standard_Boolean Dump (Standard_OStream& S, const Standard_Integer num, const Standard_Integer level);
85
86
87
88
89 protected:
90
91
92
93
94
95 private:
96
97
98
99   Handle(StepData_StepModel) themodel;
100   Interface_GeneralLib theslib;
101   StepData_WriterLib thewlib;
102   StepData_StepWriter thewriter;
103
104
105 };
106
107
108
109
110
111
112
113 #endif // _StepData_StepDumper_HeaderFile