mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0029269: Improvement for thread safety of the STEP translator - cleanup
Removal of unused stuff and some protections implemented within #29269
This commit is contained in:
@@ -3,14 +3,8 @@ StepData.hxx
|
||||
StepData_Array1OfField.hxx
|
||||
StepData_DefaultGeneral.cxx
|
||||
StepData_DefaultGeneral.hxx
|
||||
StepData_DescrGeneral.cxx
|
||||
StepData_DescrGeneral.hxx
|
||||
StepData_Described.cxx
|
||||
StepData_Described.hxx
|
||||
StepData_DescrProtocol.cxx
|
||||
StepData_DescrProtocol.hxx
|
||||
StepData_DescrReadWrite.cxx
|
||||
StepData_DescrReadWrite.hxx
|
||||
StepData_ECDescr.cxx
|
||||
StepData_ECDescr.hxx
|
||||
StepData_EDescr.cxx
|
||||
@@ -40,8 +34,6 @@ StepData_GeneralModule.hxx
|
||||
StepData_GlobalNodeOfWriterLib.hxx
|
||||
StepData_GlobalNodeOfWriterLib_0.cxx
|
||||
StepData_HArray1OfField.hxx
|
||||
StepData_HeaderTool.cxx
|
||||
StepData_HeaderTool.hxx
|
||||
StepData_Logical.hxx
|
||||
StepData_NodeOfWriterLib.hxx
|
||||
StepData_NodeOfWriterLib_0.cxx
|
||||
|
@@ -1,62 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_CopyTool.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_ShareTool.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_DescrGeneral.hxx>
|
||||
#include <StepData_Described.hxx>
|
||||
#include <StepData_EDescr.hxx>
|
||||
#include <StepData_Protocol.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrGeneral,StepData_GeneralModule)
|
||||
|
||||
StepData_DescrGeneral::StepData_DescrGeneral
|
||||
(const Handle(StepData_Protocol)& proto)
|
||||
: theproto (proto) { }
|
||||
|
||||
|
||||
void StepData_DescrGeneral::FillSharedCase
|
||||
(const Standard_Integer, const Handle(Standard_Transient)& ent,
|
||||
Interface_EntityIterator& iter) const
|
||||
{
|
||||
Handle(StepData_Described) ds = Handle(StepData_Described)::DownCast(ent);
|
||||
if (!ds.IsNull()) ds->Shared (iter);
|
||||
}
|
||||
|
||||
|
||||
void StepData_DescrGeneral::CheckCase(const Standard_Integer ,
|
||||
const Handle(Standard_Transient)&,
|
||||
const Interface_ShareTool&,
|
||||
Handle(Interface_Check)&) const
|
||||
{
|
||||
} // pour l instant
|
||||
|
||||
|
||||
void StepData_DescrGeneral::CopyCase(const Standard_Integer,
|
||||
const Handle(Standard_Transient)&,
|
||||
const Handle(Standard_Transient)&,
|
||||
Interface_CopyTool&) const
|
||||
{
|
||||
} // pour l instant
|
||||
|
||||
Standard_Boolean StepData_DescrGeneral::NewVoid
|
||||
(const Standard_Integer CN, Handle(Standard_Transient)& ent) const
|
||||
{
|
||||
ent = theproto->Descr(CN)->NewEntity();
|
||||
return (!ent.IsNull());
|
||||
}
|
@@ -1,78 +0,0 @@
|
||||
// Created on: 1997-05-21
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _StepData_DescrGeneral_HeaderFile
|
||||
#define _StepData_DescrGeneral_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <StepData_GeneralModule.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class StepData_Protocol;
|
||||
class Standard_Transient;
|
||||
class Interface_EntityIterator;
|
||||
class Interface_ShareTool;
|
||||
class Interface_Check;
|
||||
class Interface_CopyTool;
|
||||
|
||||
|
||||
class StepData_DescrGeneral;
|
||||
DEFINE_STANDARD_HANDLE(StepData_DescrGeneral, StepData_GeneralModule)
|
||||
|
||||
//! Works with a Protocol by considering its entity descriptions
|
||||
class StepData_DescrGeneral : public StepData_GeneralModule
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT StepData_DescrGeneral(const Handle(StepData_Protocol)& proto);
|
||||
|
||||
Standard_EXPORT void FillSharedCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, Interface_EntityIterator& iter) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void CheckCase (const Standard_Integer CN, const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares, Handle(Interface_Check)& ach) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void CopyCase (const Standard_Integer CN, const Handle(Standard_Transient)& entfrom, const Handle(Standard_Transient)& entto, Interface_CopyTool& TC) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT Standard_Boolean NewVoid (const Standard_Integer CN, Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepData_DescrGeneral,StepData_GeneralModule)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(StepData_Protocol) theproto;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _StepData_DescrGeneral_HeaderFile
|
@@ -1,41 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Interface_GeneralLib.hxx>
|
||||
#include <Interface_ReaderLib.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_DescrGeneral.hxx>
|
||||
#include <StepData_DescrProtocol.hxx>
|
||||
#include <StepData_DescrReadWrite.hxx>
|
||||
#include <StepData_WriterLib.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrProtocol,StepData_FileProtocol)
|
||||
|
||||
StepData_DescrProtocol::StepData_DescrProtocol () { }
|
||||
|
||||
void StepData_DescrProtocol::SetSchemaName (const Standard_CString name)
|
||||
{ thename.Clear(); thename.AssignCat (name); }
|
||||
|
||||
void StepData_DescrProtocol::LibRecord () const
|
||||
{
|
||||
if (!HasDescr()) return; // rien a recorder dans la lib ?
|
||||
Handle(StepData_DescrGeneral) gen = new StepData_DescrGeneral (this);
|
||||
Handle(StepData_DescrReadWrite) rwm = new StepData_DescrReadWrite (this);
|
||||
Interface_GeneralLib::SetGlobal (gen,this);
|
||||
Interface_ReaderLib::SetGlobal (rwm,this);
|
||||
StepData_WriterLib::SetGlobal (rwm,this);
|
||||
}
|
||||
|
||||
Standard_CString StepData_DescrProtocol::SchemaName () const
|
||||
{ return thename.ToCString(); }
|
@@ -1,86 +0,0 @@
|
||||
// Created on: 1997-05-21
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _StepData_DescrProtocol_HeaderFile
|
||||
#define _StepData_DescrProtocol_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <StepData_FileProtocol.hxx>
|
||||
#include <Standard_CString.hxx>
|
||||
|
||||
|
||||
class StepData_DescrProtocol;
|
||||
DEFINE_STANDARD_HANDLE(StepData_DescrProtocol, StepData_FileProtocol)
|
||||
|
||||
//! A DescrProtocol is a protocol dynamically (at execution time)
|
||||
//! defined with :
|
||||
//! - a list of resources (inherits FileProtocol)
|
||||
//! - a list of entity descriptions
|
||||
//! i.e. it can be defined with only C++ writing to initialize it
|
||||
//! Its initialization must :
|
||||
//! - set its schema name
|
||||
//! - define its resources (which can also be other DescrProtocol)
|
||||
//! - define its entity descriptions
|
||||
//! - record it in the system by calling RecordLib
|
||||
class StepData_DescrProtocol : public StepData_FileProtocol
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT StepData_DescrProtocol();
|
||||
|
||||
//! Defines a specific Schema Name for this Protocol
|
||||
Standard_EXPORT void SetSchemaName (const Standard_CString name);
|
||||
|
||||
//! Records this Protocol in the service libraries, with a
|
||||
//! DescrGeneral and a DescrReadWrite
|
||||
//! Does nothing if the Protocol brings no proper description
|
||||
Standard_EXPORT void LibRecord() const;
|
||||
|
||||
//! Returns the Schema Name attached to each class of Protocol
|
||||
//! here, returns the SchemaName set by SetSchemaName
|
||||
//! was C++ : return const
|
||||
Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepData_DescrProtocol,StepData_FileProtocol)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
TCollection_AsciiString thename;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _StepData_DescrProtocol_HeaderFile
|
@@ -1,143 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Interface_Check.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <StepData_DescrReadWrite.hxx>
|
||||
#include <StepData_ECDescr.hxx>
|
||||
#include <StepData_EDescr.hxx>
|
||||
#include <StepData_ESDescr.hxx>
|
||||
#include <StepData_FieldListN.hxx>
|
||||
#include <StepData_Plex.hxx>
|
||||
#include <StepData_Protocol.hxx>
|
||||
#include <StepData_Simple.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TColStd_HSequenceOfAsciiString.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_DescrReadWrite,StepData_ReadWriteModule)
|
||||
|
||||
static TCollection_AsciiString nocp("?");
|
||||
|
||||
|
||||
StepData_DescrReadWrite::StepData_DescrReadWrite
|
||||
(const Handle(StepData_Protocol)& proto)
|
||||
: theproto (proto) { }
|
||||
|
||||
Standard_Integer StepData_DescrReadWrite::CaseStep
|
||||
(const TCollection_AsciiString& atype) const
|
||||
{
|
||||
Handle(StepData_ESDescr) descr = theproto->ESDescr (atype.ToCString(),Standard_False);
|
||||
if (descr.IsNull()) return 0;
|
||||
return theproto->DescrNumber (descr);
|
||||
}
|
||||
|
||||
Standard_Integer StepData_DescrReadWrite::CaseStep
|
||||
(const TColStd_SequenceOfAsciiString& types) const
|
||||
{
|
||||
Handle(StepData_ECDescr) descr = theproto->ECDescr (types,Standard_False);
|
||||
if (descr.IsNull()) return 0;
|
||||
return theproto->DescrNumber (descr);
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean StepData_DescrReadWrite::IsComplex
|
||||
(const Standard_Integer CN) const
|
||||
{
|
||||
Handle(StepData_EDescr) descr = theproto->Descr (CN);
|
||||
if (descr.IsNull()) return Standard_False;
|
||||
return descr->IsComplex();
|
||||
}
|
||||
|
||||
const TCollection_AsciiString& StepData_DescrReadWrite::StepType
|
||||
(const Standard_Integer CN) const
|
||||
{
|
||||
Handle(StepData_ESDescr) descr = Handle(StepData_ESDescr)::DownCast
|
||||
(theproto->Descr (CN));
|
||||
if (descr.IsNull()) return nocp;
|
||||
return descr->StepType();
|
||||
}
|
||||
|
||||
Standard_Boolean StepData_DescrReadWrite::ComplexType
|
||||
(const Standard_Integer CN, TColStd_SequenceOfAsciiString& types) const
|
||||
{
|
||||
Handle(StepData_ECDescr) descr = Handle(StepData_ECDescr)::DownCast
|
||||
(theproto->Descr (CN));
|
||||
if (descr.IsNull()) return Standard_False;
|
||||
Handle(TColStd_HSequenceOfAsciiString) list = descr->TypeList();
|
||||
if (list.IsNull()) return Standard_False;
|
||||
Standard_Integer i, nb = list->Length();
|
||||
for (i = 1; i <= nb; i ++) types.Append (list->Value(i));
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
void StepData_DescrReadWrite::ReadStep(const Standard_Integer CN,
|
||||
const Handle(StepData_StepReaderData)& data,
|
||||
const Standard_Integer num,
|
||||
Handle(Interface_Check)& ach,
|
||||
const Handle(Standard_Transient)&ent) const
|
||||
{
|
||||
if (CN == 0) return;
|
||||
DeclareAndCast(StepData_Simple,sent,ent);
|
||||
if (!sent.IsNull()) {
|
||||
Handle(StepData_ESDescr) sdescr = sent->ESDescr();
|
||||
StepData_FieldListN& fl = sent->CFields();
|
||||
data->ReadList (num,ach,sdescr,fl);
|
||||
return;
|
||||
}
|
||||
|
||||
DeclareAndCast(StepData_Plex,cent,ent);
|
||||
Standard_Integer i, nb=0;
|
||||
if (!cent.IsNull()) nb = cent->NbMembers();
|
||||
Standard_Integer n0 = num;
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(StepData_Simple) si = cent->Member(i);
|
||||
Handle(StepData_ESDescr) sdescr = si->ESDescr();
|
||||
StepData_FieldListN& fl = si->CFields();
|
||||
data->ReadList (n0,ach,sdescr,fl);
|
||||
if (i < nb) n0 = data->NextForComplex(n0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void StepData_DescrReadWrite::WriteStep
|
||||
(const Standard_Integer CN,
|
||||
StepData_StepWriter& SW,
|
||||
const Handle(Standard_Transient)&ent) const
|
||||
{
|
||||
if (CN == 0) return;
|
||||
|
||||
DeclareAndCast(StepData_Simple,sent,ent);
|
||||
if (!sent.IsNull()) {
|
||||
Handle(StepData_ESDescr) sdescr = sent->ESDescr();
|
||||
const StepData_FieldListN& fl = sent->Fields();
|
||||
SW.SendList (fl,sdescr);
|
||||
return;
|
||||
}
|
||||
|
||||
DeclareAndCast(StepData_Plex,cent,ent);
|
||||
Standard_Integer i, nb=0;
|
||||
if (!cent.IsNull()) nb = cent->NbMembers();
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
Handle(StepData_Simple) si = cent->Member(i);
|
||||
Handle(StepData_ESDescr) sdescr = si->ESDescr();
|
||||
const StepData_FieldListN& fl = si->Fields();
|
||||
SW.StartEntity (sdescr->TypeName());
|
||||
SW.SendList (fl,sdescr);
|
||||
}
|
||||
}
|
@@ -1,85 +0,0 @@
|
||||
// Created on: 1997-05-21
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1997-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _StepData_DescrReadWrite_HeaderFile
|
||||
#define _StepData_DescrReadWrite_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
|
||||
#include <StepData_ReadWriteModule.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
class StepData_Protocol;
|
||||
class TCollection_AsciiString;
|
||||
class StepData_StepReaderData;
|
||||
class Interface_Check;
|
||||
class Standard_Transient;
|
||||
class StepData_StepWriter;
|
||||
|
||||
|
||||
class StepData_DescrReadWrite;
|
||||
DEFINE_STANDARD_HANDLE(StepData_DescrReadWrite, StepData_ReadWriteModule)
|
||||
|
||||
|
||||
class StepData_DescrReadWrite : public StepData_ReadWriteModule
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT StepData_DescrReadWrite(const Handle(StepData_Protocol)& proto);
|
||||
|
||||
Standard_EXPORT Standard_Integer CaseStep (const TCollection_AsciiString& atype) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Integer CaseStep (const TColStd_SequenceOfAsciiString& types) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean IsComplex (const Standard_Integer CN) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT const TCollection_AsciiString& StepType (const Standard_Integer CN) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean ComplexType (const Standard_Integer CN, TColStd_SequenceOfAsciiString& types) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void ReadStep (const Standard_Integer CN, const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT void WriteStep (const Standard_Integer CN, StepData_StepWriter& SW, const Handle(Standard_Transient)& ent) const Standard_OVERRIDE;
|
||||
|
||||
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(StepData_DescrReadWrite,StepData_ReadWriteModule)
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(StepData_Protocol) theproto;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _StepData_DescrReadWrite_HeaderFile
|
@@ -1,152 +0,0 @@
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Interface_Protocol.hxx>
|
||||
#include <Interface_ReaderLib.hxx>
|
||||
#include <StepData_FileProtocol.hxx>
|
||||
#include <StepData_HeaderTool.hxx>
|
||||
#include <StepData_Protocol.hxx>
|
||||
#include <StepData_StepReaderData.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
// HeaderTool prend en charge le Schema de Donnees utilise pour un Fichier
|
||||
// Ce Schema peut etre compose de un ou plusieurs Protocoles, chacun etant
|
||||
// designe par une String. Les Strings correspondent au type "SCHEMA_NAME"
|
||||
// (typedef) et le Schema est une entite de Header de type "FILE_SCHEMA",
|
||||
// il a cette forme dans le fichier :
|
||||
static Interface_ReaderLib lib;
|
||||
|
||||
|
||||
StepData_HeaderTool::StepData_HeaderTool
|
||||
(const Handle(StepData_StepReaderData)& data)
|
||||
{
|
||||
lib.SetComplete();
|
||||
thedone = Standard_False;
|
||||
Standard_Integer num = 0;
|
||||
while ( (num = data->FindNextRecord(num)) != 0) {
|
||||
const TCollection_AsciiString& headertype = data->RecordType(num);
|
||||
if (headertype == "FILE_SCHEMA") {
|
||||
Standard_Integer numsub = data->SubListNumber(num,1,Standard_True);
|
||||
Standard_Integer nb = data->NbParams(numsub);
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
TCollection_AsciiString unom = data->ParamCValue(numsub,i);
|
||||
unom.Remove(unom.Length());
|
||||
unom.Remove(1); // quotes debut et fin
|
||||
thenames.Append(unom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
StepData_HeaderTool::StepData_HeaderTool
|
||||
(const TColStd_SequenceOfAsciiString& names)
|
||||
{
|
||||
lib.SetComplete();
|
||||
thedone = Standard_False;
|
||||
Standard_Integer nb = names.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) thenames.Append(names.Value(i));
|
||||
}
|
||||
|
||||
Standard_Integer StepData_HeaderTool::NbSchemaNames () const
|
||||
{ return thenames.Length(); }
|
||||
|
||||
const TCollection_AsciiString& StepData_HeaderTool::SchemaName
|
||||
(const Standard_Integer num) const
|
||||
{ return thenames.Value(num); }
|
||||
|
||||
Handle(StepData_Protocol) StepData_HeaderTool::NamedProtocol
|
||||
(const TCollection_AsciiString& name) const
|
||||
{
|
||||
Handle(StepData_Protocol) proto;
|
||||
for (lib.Start(); lib.More(); lib.Next()) {
|
||||
proto = Handle(StepData_Protocol)::DownCast(lib.Protocol());
|
||||
if ( name.IsEqual(proto->SchemaName()) ) return proto;
|
||||
}
|
||||
return proto;
|
||||
}
|
||||
|
||||
|
||||
void StepData_HeaderTool::Build
|
||||
(const Handle(StepData_FileProtocol)& proto)
|
||||
{
|
||||
thedone = Standard_True;
|
||||
theignored.Clear();
|
||||
Standard_Integer nb = thenames.Length();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Handle(StepData_Protocol) unproto = NamedProtocol(thenames.Value(i));
|
||||
if (unproto.IsNull()) theignored.Append(thenames.Value(i));
|
||||
else proto->Add(unproto);
|
||||
}
|
||||
}
|
||||
|
||||
Handle(StepData_Protocol) StepData_HeaderTool::Protocol ()
|
||||
{
|
||||
thedone = Standard_True;
|
||||
theignored.Clear();
|
||||
Handle(StepData_Protocol) unproto;
|
||||
if (thenames.IsEmpty()) return unproto;
|
||||
if (thenames.Length() == 1) {
|
||||
unproto = NamedProtocol (thenames.Value(1));
|
||||
if (unproto.IsNull()) theignored.Append (thenames.Value(1));
|
||||
return unproto;
|
||||
}
|
||||
Handle(StepData_FileProtocol) proto = new StepData_FileProtocol;
|
||||
Build(proto);
|
||||
return proto;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean StepData_HeaderTool::IsDone () const
|
||||
{ return thedone; }
|
||||
|
||||
|
||||
Standard_Integer StepData_HeaderTool::NbIgnoreds () const
|
||||
{ return theignored.Length(); }
|
||||
|
||||
const TCollection_AsciiString& StepData_HeaderTool::Ignored
|
||||
(const Standard_Integer num) const
|
||||
{ return theignored.Value(num); }
|
||||
|
||||
|
||||
void StepData_HeaderTool::Print (Standard_OStream& S) const
|
||||
{
|
||||
Standard_Integer nb = thenames.Length();
|
||||
Standard_Integer lng = 0; Standard_Integer ln1;
|
||||
S << " --- StepData_HeaderTool : List of Protocol Names --- Count : "
|
||||
<< nb << std::endl;
|
||||
Standard_Integer i; // svv Jan11 2000 : porting on DEC
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
ln1 = thenames.Value(i).Length() + 8; lng += ln1;
|
||||
if (lng > 80) { S << std::endl; lng = ln1; }
|
||||
S << " " << i << " : " << thenames.Value(i);
|
||||
}
|
||||
if (lng == 0) S << std::endl;
|
||||
|
||||
nb = theignored.Length();
|
||||
if (!thedone) {
|
||||
S << " --- Evaluation of Protocol not Done ---" << std::endl;
|
||||
} else if (nb == 0) {
|
||||
S << " --- All Names correspond to a known Protocol ---" << std::endl;
|
||||
} else {
|
||||
lng = ln1 = 0;
|
||||
S << " --- Among them, " << nb << " remain unrecognized ---" << std::endl;
|
||||
for (i = 1; i <= nb; i ++) {
|
||||
ln1 = theignored.Value(i).Length() + 3; lng += ln1;
|
||||
if (lng > 80) { S << std::endl; lng = ln1; }
|
||||
S << " : " << theignored.Value(i);
|
||||
}
|
||||
if (lng == 0) S << std::endl;
|
||||
}
|
||||
}
|
@@ -1,117 +0,0 @@
|
||||
// Created on: 1993-07-23
|
||||
// Created by: Christian CAILLET
|
||||
// Copyright (c) 1993-1999 Matra Datavision
|
||||
// Copyright (c) 1999-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _StepData_HeaderTool_HeaderFile
|
||||
#define _StepData_HeaderTool_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_DefineAlloc.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_OStream.hxx>
|
||||
class StepData_StepReaderData;
|
||||
class TCollection_AsciiString;
|
||||
class StepData_Protocol;
|
||||
class StepData_FileProtocol;
|
||||
|
||||
|
||||
//! HeaderTool exploits data from Header to build a Protocol :
|
||||
//! it uses the Header Entity FileSchema to do this.
|
||||
//! It builds a Protocol from the Global List of Protocols
|
||||
//! stored in the Library ReaderLib
|
||||
class StepData_HeaderTool
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
//! Creates a HeaderTool from data read from a File. Computes the
|
||||
//! list of Schema Names. The Protocol will be computed later
|
||||
//! (because there are several options)
|
||||
Standard_EXPORT StepData_HeaderTool(const Handle(StepData_StepReaderData)& data);
|
||||
|
||||
//! Creates a HeaderTool directly from a list of Schema Names
|
||||
Standard_EXPORT StepData_HeaderTool(const TColStd_SequenceOfAsciiString& names);
|
||||
|
||||
//! Returns the count of SchemaNames
|
||||
Standard_EXPORT Standard_Integer NbSchemaNames() const;
|
||||
|
||||
//! Returns a SchemaName, given its rank
|
||||
Standard_EXPORT const TCollection_AsciiString& SchemaName (const Standard_Integer num) const;
|
||||
|
||||
//! Returns the Protocol which corresponds to a Schema Name
|
||||
//! Returns a Null Handle if this Schema Name is attached to no
|
||||
//! Protocol recorded in the Global List of ReaderLib
|
||||
Standard_EXPORT Handle(StepData_Protocol) NamedProtocol (const TCollection_AsciiString& name) const;
|
||||
|
||||
//! Fills a FileProtocol with the list of Protocols attached to
|
||||
//! the list of Schema Names. It can remain empty ...
|
||||
Standard_EXPORT void Build (const Handle(StepData_FileProtocol)& protocol);
|
||||
|
||||
//! Returns a Protocol computed from the list of Schema Names :
|
||||
//! - a Null Handle if no SchemaName has been recognized (or list
|
||||
//! empty)
|
||||
//! - a single Protocol if only one SchemaName has been recognized
|
||||
//! - a FileProtocol with its componants if several SchemaNames
|
||||
//! have been recognized
|
||||
Standard_EXPORT Handle(StepData_Protocol) Protocol();
|
||||
|
||||
//! Returns True if either Build or Protocol has been called
|
||||
//! If it is False, Ignored and NbIgnored should not be called
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
//! Returns the count of ignored SchemaNames (0 if all were OK)
|
||||
Standard_EXPORT Standard_Integer NbIgnoreds() const;
|
||||
|
||||
//! Returns an ignored SchemaName, given its rank in the list of
|
||||
//! Ignored SchemaNames (not in the total list)
|
||||
Standard_EXPORT const TCollection_AsciiString& Ignored (const Standard_Integer num) const;
|
||||
|
||||
//! Sends the state of the HeaderTool in a comprehensive way,
|
||||
//! to an output stream
|
||||
Standard_EXPORT void Print (Standard_OStream& S) const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
TColStd_SequenceOfAsciiString thenames;
|
||||
Standard_Boolean thedone;
|
||||
TColStd_SequenceOfAsciiString theignored;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _StepData_HeaderTool_HeaderFile
|
@@ -21,6 +21,8 @@
|
||||
#include <StepData_SelectNamed.hxx>
|
||||
#include <StepData_SelectReal.hxx>
|
||||
#include <StepData_SelectType.hxx>
|
||||
#include <StepData_UndefinedEntity.hxx>
|
||||
|
||||
|
||||
Standard_Boolean StepData_SelectType::Matches
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
@@ -35,6 +37,8 @@ Standard_Boolean StepData_SelectType::Matches
|
||||
void StepData_SelectType::SetValue (const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
if (ent.IsNull()) thevalue.Nullify();
|
||||
else if (ent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
|
||||
thevalue = ent;
|
||||
else if (!Matches(ent))
|
||||
throw Standard_TypeMismatch("StepData : SelectType, SetValue");
|
||||
else thevalue = ent;
|
||||
|
@@ -141,11 +141,22 @@ void StepData_StepModel::SetIdentLabel
|
||||
Standard_Integer num = Number(ent);
|
||||
if (!num)
|
||||
return;
|
||||
Standard_Integer nbEnt = NbEntities();
|
||||
if(theidnums.IsNull())
|
||||
{
|
||||
theidnums = new TColStd_HArray1OfInteger(1, NbEntities());
|
||||
theidnums = new TColStd_HArray1OfInteger(1,nbEnt);
|
||||
theidnums->Init(0);
|
||||
}
|
||||
else if(nbEnt > theidnums->Length())
|
||||
{
|
||||
Standard_Integer prevLength = theidnums->Length();
|
||||
Handle(TColStd_HArray1OfInteger) idnums1 = new TColStd_HArray1OfInteger(1,nbEnt);
|
||||
idnums1->Init(0);
|
||||
Standard_Integer k =1;
|
||||
for( ; k <= prevLength; k++)
|
||||
idnums1->SetValue(k , theidnums->Value(k));
|
||||
theidnums = idnums1;
|
||||
}
|
||||
theidnums->SetValue(num,ident);
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_ParamList.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
@@ -46,6 +45,7 @@
|
||||
#include <TColStd_HSequenceOfReal.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <StepData_UndefinedEntity.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_StepReaderData, Interface_FileReaderData)
|
||||
@@ -117,7 +117,6 @@ StepData_StepReaderData::StepData_StepReaderData
|
||||
thenbscop = 0; thenbents = 0; thelastn = 0; thenbhead = nbheader;
|
||||
//themults.Init(0);
|
||||
thecheck = new Interface_Check;
|
||||
//:S4136 acceptvoid = Interface_Static::IVal("step.readaccept.void");
|
||||
if (initstr) return;
|
||||
//for (Standard_Integer i = 0; i < Maxlst; i ++) {
|
||||
// sprintf(textnum,"$%d",i+1);
|
||||
@@ -999,8 +998,8 @@ Standard_Boolean StepData_StepReaderData::ReadReal(const Standard_Integer num,
|
||||
Handle(String) errmess; // Null si pas d erreur
|
||||
if (nump > 0 && nump <= NbParams(num)) {
|
||||
const Interface_FileParameter& FP = Param(num, nump);
|
||||
if (FP.ParamType() == Interface_ParamReal) val =
|
||||
Interface_FileReaderData::Fastof(FP.CValue());
|
||||
if (FP.ParamType() == Interface_ParamReal || FP.ParamType() == Interface_ParamInteger)
|
||||
val = Interface_FileReaderData::Fastof(FP.CValue());
|
||||
else errmess = new String("Parameter n0.%d (%s) not a Real");
|
||||
}
|
||||
else errmess = new String("Parameter n0.%d (%s) absent");
|
||||
@@ -1035,10 +1034,14 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
|
||||
if (FP.ParamType() == Interface_ParamIdent) {
|
||||
warn = (acceptvoid > 0);
|
||||
if (nent > 0) {
|
||||
Handle(Standard_Transient) entent = BoundEntity(nent);
|
||||
Handle(Standard_Transient) entent = BoundEntity(nent);
|
||||
if (entent.IsNull() || !entent->IsKind(atype))
|
||||
{
|
||||
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
|
||||
else ent = entent;
|
||||
if (entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
|
||||
ent = entent;
|
||||
}
|
||||
else ent = entent;
|
||||
}
|
||||
else errmess = new String("Parameter n0.%d (%s) : Unresolved reference");
|
||||
}
|
||||
@@ -1079,10 +1082,15 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
|
||||
if (FP.ParamType() == Interface_ParamIdent) {
|
||||
warn = (acceptvoid > 0);
|
||||
if (nent > 0) {
|
||||
Handle(Standard_Transient) entent = BoundEntity(nent);
|
||||
Handle(Standard_Transient) entent = BoundEntity(nent);
|
||||
if (!sel.Matches(entent))
|
||||
{
|
||||
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
|
||||
else
|
||||
//fot not suppported STEP entity
|
||||
if (entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
|
||||
sel.SetValue(entent);
|
||||
}
|
||||
else
|
||||
sel.SetValue(entent);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user