0027349: XtControl_Reader is not thread-safe
[occt.git] / src / IGESCAFControl / IGESCAFControl_Reader.hxx
CommitLineData
42cf5bc1 1// Created on: 2000-08-15
2// Created by: Andrey BETENEV
3// Copyright (c) 2000-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IGESCAFControl_Reader_HeaderFile
17#define _IGESCAFControl_Reader_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
42cf5bc1 23#include <IGESControl_Reader.hxx>
7f56eba8 24#include <TCollection_AsciiString.hxx>
42cf5bc1 25class XSControl_WorkSession;
26class TDocStd_Document;
42cf5bc1 27
28
29//! Provides a tool to read IGES file and put it into
30//! DECAF document. Besides transfer of shapes (including
31//! assemblies) provided by IGESControl, supports also
32//! colors and part names
33//! IGESCAFControl_Reader reader; Methods for translation of an IGES file:
34//! reader.ReadFile("filename");
35//! reader.Transfer(Document); or
36//! reader.Perform("filename",doc);
37//! Methods for managing reading attributes.
38//! Colors
39//! reader.SetColorMode(colormode);
40//! Standard_Boolean colormode = reader.GetColorMode();
41//! Layers
42//! reader.SetLayerMode(layermode);
43//! Standard_Boolean layermode = reader.GetLayerMode();
44//! Names
45//! reader.SetNameMode(namemode);
46//! Standard_Boolean namemode = reader.GetNameMode();
47class IGESCAFControl_Reader : public IGESControl_Reader
48{
7f56eba8 49 public:
42cf5bc1 50
51 DEFINE_STANDARD_ALLOC
52
42cf5bc1 53 //! Creates a reader with an empty
54 //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
7f56eba8 55 IGESCAFControl_Reader()
56 : myColorMode( Standard_True ),
57 myNameMode ( Standard_True ),
58 myLayerMode( Standard_True )
59 {}
42cf5bc1 60
61 //! Creates a reader tool and attaches it to an already existing Session
62 //! Clears the session if it was not yet set for IGES
7f56eba8 63 IGESCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS, const Standard_Boolean FromScratch = Standard_True)
64 : myColorMode( Standard_True ),
65 myNameMode ( Standard_True ),
66 myLayerMode( Standard_True )
67 { SetWS (theWS,FromScratch); }
42cf5bc1 68
69 //! Translates currently loaded IGES file into the document
70 //! Returns True if succeeded, and False in case of fail
7f56eba8 71 Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& theDoc);
42cf5bc1 72
7f56eba8 73 Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& theFileName, Handle(TDocStd_Document)& theDoc)
74 { return Perform (theFileName.ToCString(), theDoc); }
42cf5bc1 75
76 //! Translate IGES file given by filename into the document
77 //! Return True if succeeded, and False in case of fail
7f56eba8 78 Standard_EXPORT Standard_Boolean Perform (const Standard_CString theFileName, Handle(TDocStd_Document)& theDoc);
42cf5bc1 79
80 //! Set ColorMode for indicate read Colors or not.
7f56eba8 81 void SetColorMode (const Standard_Boolean theMode)
82 { myColorMode = theMode; }
83
84 Standard_Boolean GetColorMode() const
85 { return myColorMode; }
42cf5bc1 86
87 //! Set NameMode for indicate read Name or not.
7f56eba8 88 void SetNameMode (const Standard_Boolean theMode)
89 { myNameMode = theMode; }
42cf5bc1 90
7f56eba8 91 Standard_Boolean GetNameMode() const
92 { return myNameMode; }
42cf5bc1 93
7f56eba8 94 //! Set LayerMode for indicate read Layers or not.
95 void SetLayerMode (const Standard_Boolean theMode)
96 { myLayerMode = theMode; }
42cf5bc1 97
7f56eba8 98 Standard_Boolean GetLayerMode() const
99 { return myLayerMode; }
42cf5bc1 100
7f56eba8 101 private:
42cf5bc1 102
103 Standard_Boolean myColorMode;
104 Standard_Boolean myNameMode;
105 Standard_Boolean myLayerMode;
42cf5bc1 106};
107
42cf5bc1 108#endif // _IGESCAFControl_Reader_HeaderFile