- Comprehensive translation of French comments to English throughout the StepData module
- Enhanced inline documentation explaining complex algorithms and data structures
- Improved variable name comments and method descriptions for better code comprehension
IMPLEMENT_STANDARD_RTTIEXT(StepData_DefaultGeneral, StepData_GeneralModule)
-// DefaultGeneral de StepData reconnait UN SEUL TYPE : UndefinedEntity
+// StepData DefaultGeneral recognizes ONLY ONE TYPE: UndefinedEntity
StepData_DefaultGeneral::StepData_DefaultGeneral()
{
+ // Register this module globally with the StepData protocol
Interface_GeneralLib::SetGlobal(this, StepData::Protocol());
}
const Handle(Standard_Transient)& ent,
Interface_EntityIterator& iter) const
{
+ // Fill iterator with shared entities from UndefinedEntity parameters
if (casenum != 1)
- return;
+ return; // Only handles case 1 (UndefinedEntity)
DeclareAndCast(StepData_UndefinedEntity, undf, ent);
Handle(Interface_UndefinedContent) cont = undf->UndefinedContent();
Standard_Integer nb = cont->NbParams();
+ // Iterate through all parameters looking for entity references
for (Standard_Integer i = 1; i <= nb; i++)
{
Interface_ParamType ptype = cont->ParamType(i);
if (ptype == Interface_ParamSub)
{
+ // Handle sub-entity parameters recursively
DeclareAndCast(StepData_UndefinedEntity, subent, cont->ParamEntity(i));
FillSharedCase(casenum, cont->ParamEntity(i), iter);
}
else if (ptype == Interface_ParamIdent)
{
+ // Handle entity identifier parameters
iter.GetOneItem(cont->ParamEntity(i));
}
}
const Interface_ShareTool&,
Handle(Interface_Check)&) const
{
-} // pas de Check sur une UndefinedEntity
+} // No validation check performed on an UndefinedEntity
Standard_Boolean StepData_DefaultGeneral::NewVoid(const Standard_Integer CN,
Handle(Standard_Transient)& ent) const
{
+ // Create a new empty entity instance (only UndefinedEntity supported)
if (CN != 1)
- return Standard_False;
+ return Standard_False; // Only case 1 supported
ent = new StepData_UndefinedEntity;
return Standard_True;
}
const Handle(Standard_Transient)& entto,
Interface_CopyTool& TC) const
{
+ // Copy content from source UndefinedEntity to target UndefinedEntity
if (casenum != 1)
- return;
+ return; // Only handles case 1 (UndefinedEntity)
DeclareAndCast(StepData_UndefinedEntity, undfrom, entfrom);
DeclareAndCast(StepData_UndefinedEntity, undto, entto);
- undto->GetFromAnother(undfrom, TC); // On pourrait rapatrier cela
+ undto->GetFromAnother(undfrom, TC); // We could optimize this operation
}
StepData_ESDescr::StepData_ESDescr(const Standard_CString name)
: thenom(name)
{
+ // Constructor for Simple Entity Descriptor with the given type name
}
void StepData_ESDescr::SetNbFields(const Standard_Integer nb)
{
+ // Set the number of fields for this entity descriptor, preserving existing field data
Standard_Integer minb, i, oldnb = NbFields();
- thenames.Clear();
+ thenames.Clear(); // Clear name-to-index mapping
if (nb == 0)
{
thedescr.Nullify();
thedescr = li;
return;
}
+ // Copy existing field descriptors up to the minimum of old and new sizes
minb = (oldnb > nb ? nb : oldnb);
for (i = 1; i <= minb; i++)
{
DeclareAndCast(StepData_PDescr, pde, thedescr->Value(i));
if (!pde.IsNull())
- thenames.Bind(pde->Name(), i);
+ thenames.Bind(pde->Name(), i); // Rebuild name-to-index mapping
li->SetValue(i, pde);
}
thedescr = li;
const Standard_CString name,
const Handle(StepData_PDescr)& descr)
{
+ // Set field descriptor at specified position with given name and parameter descriptor
if (num < 1 || num > NbFields())
return;
Handle(StepData_PDescr) pde = new StepData_PDescr;
- pde->SetFrom(descr);
- pde->SetName(name);
+ pde->SetFrom(descr); // Copy descriptor properties
+ pde->SetName(name); // Set field name
thedescr->SetValue(num, pde);
- thenames.Bind(name, num);
+ thenames.Bind(name, num); // Update name-to-index mapping
}
void StepData_ESDescr::SetBase(const Handle(StepData_ESDescr)& base)
{
thebase = base;
- // il faut CUMULER les fields de la base et ses supers
+ // Need to ACCUMULATE the fields from the base and its superclasses
}
void StepData_ESDescr::SetSuper(const Handle(StepData_ESDescr)& super)
{
+ // Set the superclass descriptor, handling inheritance hierarchy
Handle(StepData_ESDescr) sup = super->Base();
if (sup.IsNull())
sup = super;
if (!thebase.IsNull())
- thebase->SetSuper(sup);
+ thebase->SetSuper(sup); // Delegate to base if exists
else
- thesuper = sup;
+ thesuper = sup; // Otherwise set directly
}
Standard_CString StepData_ESDescr::TypeName() const
Standard_Boolean StepData_ESDescr::IsSub(const Handle(StepData_ESDescr)& other) const
{
+ // Check if this descriptor is a subclass of the given descriptor
Handle(StepData_ESDescr) oth = other->Base();
if (oth.IsNull())
oth = other;
if (!thebase.IsNull())
- return thebase->IsSub(oth);
+ return thebase->IsSub(oth); // Delegate to base if exists
Handle(Standard_Transient) t1 = this;
if (oth == t1)
- return Standard_True;
+ return Standard_True; // Same descriptor
if (oth == thesuper)
- return Standard_True;
+ return Standard_True; // Direct superclass
else if (thesuper.IsNull())
- return Standard_False;
- return thesuper->IsSub(oth);
+ return Standard_False; // No superclass
+ return thesuper->IsSub(oth); // Check recursively up the hierarchy
}
Standard_Integer StepData_ESDescr::NbFields() const
Standard_Boolean StepData_ESDescr::Matches(const Standard_CString name) const
{
+ // Check if this descriptor matches the given type name (including inheritance)
if (thenom.IsEqual(name))
- return Standard_True;
+ return Standard_True; // Direct match
if (thesuper.IsNull())
- return Standard_False;
- return thesuper->Matches(name);
+ return Standard_False; // No superclass to check
+ return thesuper->Matches(name); // Check superclass hierarchy
}
Standard_Boolean StepData_ESDescr::IsComplex() const
Handle(StepData_Described) StepData_ESDescr::NewEntity() const
{
+ // Create a new simple entity instance based on this descriptor
Handle(StepData_Simple) ent = new StepData_Simple(this);
return ent;
}
#include <TColStd_HArray2OfReal.hxx>
#include <TColStd_HArray2OfTransient.hxx>
-// Le kind code le type de donnee, le mode d acces (direct ou via Select),
-// l arite (simple, liste, carre)
-// Valeurs pour Kind : 0 = Clear/Undefined
+// The kind encodes the data type, access mode (direct or via Select),
+// and arity (simple, list, square array)
+// Values for Kind: 0 = Clear/Undefined
// KindInteger KindBoolean KindLogical KindEnum KindReal KindString KindEntity
-// + KindSelect qui s y substitue et peut s y combiner
-// + KindList et KindList2 qui peuvent s y combiner
-// (sur masque KindArity et decalage ShiftArity)
+// + KindSelect which substitutes and can combine with them
+// + KindList and KindList2 which can combine with them
+// (on KindArity mask and ShiftArity offset)
#define KindInteger 1
#define KindBoolean 2
#define KindLogical 3
low = ht->Lower();
up = ht->Upper();
Handle(TColStd_HArray1OfTransient) ht2 = new TColStd_HArray1OfTransient(low, up);
- // faudrait reprendre les cas SelectMember ...
+ // Should handle SelectMember cases...
for (i = low; i <= up; i++)
ht2->SetValue(i, ht->Value(i));
return;
}
}
- // Reste la liste 2 ...
+ // Remains the 2D list...
// if ((thekind & KindArity) == KindList2) {
// DeclareAndCast(TColStd_HArray2OfTransient,ht,theany);
// }
void StepData_Field::SetList(const Standard_Integer size, const Standard_Integer first)
{
- // ATTENTION, on ne traite pas l agrandissement ...
+ // WARNING: we don't handle expansion...
theint = size;
thereal = 0.0;
const Standard_Integer f1,
const Standard_Integer f2)
{
- // ATTENTION, on ne traite pas l agrandissement ...
+ // WARNING: we don't handle expansion...
theint = siz1;
thereal = Standard_Real(siz2);
hi->SetValue(num, val);
return;
}
- // Si deja commence sur autre chose, changer et mettre des select
+ // If already started with something else, change and put selects
DeclareAndCast(TColStd_HArray1OfTransient, ht, theany);
if (ht.IsNull())
return; // yena erreur, ou alors OfReal
hr->SetValue(num, val);
return;
}
- // Si deja commence sur autre chose, changer et mettre des select
+ // If already started with something else, change and put selects
DeclareAndCast(TColStd_HArray1OfTransient, ht, theany);
if (ht.IsNull())
return; // yena erreur, ou alors OfInteger
Standard_Integer kind = TrueKind(thekind); // si Any, evaluer ...
if (kind != KindAny)
return kind;
- // Sinon, chercher un Transient
+ // Otherwise, look for a Transient
Handle(Standard_Transient) item;
if ((thekind & KindArity) == KindList)
{
IMPLEMENT_STANDARD_RTTIEXT(StepData_FileProtocol, StepData_Protocol)
// static TCollection_AsciiString thename("");
-static Standard_CString thename = "";
+static Standard_CString thename = ""; // Empty schema name for file protocols
-// Protocol fabrique a la demande avec d autres Protocoles
+// Protocol factory created on demand with other Protocols
StepData_FileProtocol::StepData_FileProtocol() {}
void StepData_FileProtocol::Add(const Handle(StepData_Protocol)& protocol)
{
+ // Add a protocol to the collection, avoiding duplicates of the same type
if (protocol.IsNull())
return;
Handle(Standard_Type) ptype = protocol->DynamicType();
Standard_Integer nb = thecomps.Length();
+ // Check if a protocol of the same type is already present
for (Standard_Integer i = 1; i <= nb; i++)
{
if (thecomps.Value(i)->IsInstance(ptype))
- return;
+ return; // Protocol of this type already exists
}
thecomps.Append(protocol);
}
Standard_Integer StepData_FileProtocol::NbResources() const
{
+ // Return the number of component protocols in this file protocol
return thecomps.Length();
}
Standard_Integer StepData_FileProtocol::TypeNumber(const Handle(Standard_Type)& /*atype*/) const
{
+ // FileProtocol doesn't recognize specific types directly (delegates to component protocols)
return 0;
}
Standard_Boolean StepData_FileProtocol::GlobalCheck(const Interface_Graph& G,
Handle(Interface_Check)& ach) const
{
+ // Perform global validation check across all component protocols
Standard_Boolean res = Standard_False;
Standard_Integer i, nb = NbResources();
for (i = 1; i <= nb; i++)
- res |= Resource(i)->GlobalCheck(G, ach);
+ res |= Resource(i)->GlobalCheck(G, ach); // Aggregate results from all protocols
return res;
}
void StepData_FreeFormEntity::SetStepType(const Standard_CString typenam)
{
+ // Set the STEP entity type name for this free-form entity
thetype.Clear();
thetype.AssignCat(typenam);
}
Standard_Boolean StepData_FreeFormEntity::IsComplex() const
{
+ // A complex entity is one that has additional entity parts linked via 'next'
return (!thenext.IsNull());
}
Standard_Boolean StepData_FreeFormEntity::Reorder(Handle(StepData_FreeFormEntity)& ent)
{
+ // Reorder complex entities to ensure alphabetical sorting of entity types
if (ent.IsNull())
return Standard_False;
if (!ent->IsComplex())
return Standard_False;
- Standard_Boolean afr = Standard_False;
+ Standard_Boolean afr = Standard_False; // flag: any reordering needed
Handle(StepData_FreeFormEntity) e1 = ent;
Handle(StepData_FreeFormEntity) e2 = ent->Next();
+ // Check if entities are already in alphabetical order
while (!e2.IsNull())
{
if (strcmp(e1->StepType(), e2->StepType()) > 0)
{
- afr = Standard_True;
+ afr = Standard_True; // Found out-of-order pair
break;
}
e1 = e2;
}
if (!afr)
return afr;
- // remise en ordre avec un dictionnaire
+ // Reordering using a dictionary (map) to sort entity types alphabetically
e1 = ent;
e2.Nullify();
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> dic;
dic.Bind(e1->StepType(), e1);
e1 = e1->Next();
}
- // d abord effacer les next en cours ...
+ // First clear the current 'next' links to break the chain...
for (NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(dic);
iter.More();
iter.Next())
if (!e1.IsNull())
e1->SetNext(e2);
}
- // ... puis les remettre dans l ordre
+ // ... then rebuild the chain in alphabetical order
e1.Nullify();
for (NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>::Iterator iter(dic);
iter.More();
void StepData_FreeFormEntity::SetNbFields(const Standard_Integer nb)
{
+ // Initialize the array of fields for this entity
if (nb <= 0)
thefields.Nullify();
else
Standard_Integer i, maxenum = other->EnumMax();
for (i = 0; i <= maxenum; i++)
AddEnumDef(other->EnumText(i));
- // ne sont pas reprises : les SELECT
+ // SELECT types are not copied
thetype = other->Type();
thearit = other->Arity();
thefrom = other;
void StepData_PDescr::Check(const StepData_Field& /*afild*/, Handle(Interface_Check)& /*ach*/) const
{
- // pour l instant ...
+ // For now...
}
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(StepData_Protocol, Interface_Protocol)
-// Le Protocol de base reconnait UnknownEntity
+// The base Protocol recognizes UnknownEntity
// static TCollection_AsciiString thename("(DEFAULT)");
static Standard_CString thename = "(DEFAULT)";
return Standard_False;
}
-// #### Description pour LateBinding
+// #### Description for LateBinding (runtime entity description support)
Standard_Integer StepData_Protocol::DescrNumber(const Handle(StepData_EDescr)& adescr) const
{
Handle(StepData_ESDescr) sd = Handle(StepData_ESDescr)::DownCast(adescr);
thedscnum.Bind(adescr, CN);
- // Simple : memorisee selon son nom
- // sinon que faire ? on memorise selon le numero passe en alpha-num ...
- // (temporaire)
+ // Simple descriptor: stored according to its name
+ // Otherwise what to do? Store according to the passed number in alpha-numeric form...
+ // (temporary solution)
if (!sd.IsNull())
thedscnam.Bind(sd->TypeName(), sd);
char fonom[10];
Standard_Integer StepData_ReadWriteModule::CaseStep(const TColStd_SequenceOfAsciiString&) const
{
return 0;
-} // par defaut
+} // default
Standard_Boolean StepData_ReadWriteModule::IsComplex(const Standard_Integer) const
{
return Standard_False;
-} // par defaut
+} // default
TCollection_AsciiString StepData_ReadWriteModule::ShortType(const Standard_Integer) const
{
return TCollection_AsciiString("");
-} // par defaut vide
+} // default empty
Standard_Boolean StepData_ReadWriteModule::ComplexType(const Standard_Integer,
TColStd_SequenceOfAsciiString&) const
IMPLEMENT_STANDARD_RTTIEXT(StepData_SelectMember, Standard_Transient)
-// Definitions reprises de Field :
+// Definitions taken from Field:
#define KindInteger 1
#define KindBoolean 2
#define KindLogical 3
IMPLEMENT_STANDARD_RTTIEXT(StepData_SelectNamed, StepData_SelectMember)
-// Definitions reprises de Field :
+// Definitions taken from Field:
#define KindInteger 1
#define KindBoolean 2
#define KindLogical 3
}
void StepData_Simple::Check(Handle(Interface_Check)& /*ach*/) const {
-} // qq chose ? cf la description
+} // something? see the description
void StepData_Simple::Shared(Interface_EntityIterator& list) const
{
#include <stdio.h>
+// Constructor: Initialize STEP dumper with model, protocol, and output mode
+// mode > 0 sets label mode to 2 for enhanced entity labeling
StepData_StepDumper::StepData_StepDumper(const Handle(StepData_StepModel)& amodel,
const Handle(StepData_Protocol)& protocol,
const Standard_Integer mode)
return thewriter;
}
+// Main dump method: outputs entity information to stream with different levels of detail
+// level <= 0: basic entity type and identifier information only
+// level == 1: entity identifiers and basic structure
+// level > 1: complete entity data with all referenced entities
Standard_Boolean StepData_StepDumper::Dump(Standard_OStream& S,
const Handle(Standard_Transient)& ent,
const Standard_Integer level)
{
Standard_Integer i, nb = themodel->NbEntities();
- TColStd_Array1OfInteger ids(0, nb);
+ TColStd_Array1OfInteger ids(0, nb); // Array to store entity identifiers
ids.Init(0);
- Standard_Integer num = themodel->Number(ent);
- Standard_Integer nlab = themodel->IdentLabel(ent);
+ Standard_Integer num = themodel->Number(ent); // Entity number in model
+ Standard_Integer nlab = themodel->IdentLabel(ent); // Entity identifier label
ids.SetValue(num, (nlab > 0 ? nlab : -1));
if (level <= 0)
{
+ // Basic output: show entity number and type information only
Handle(StepData_ReadWriteModule) module;
Standard_Integer CN;
if (num > 0)
S << "#" << num << " = ";
else
- S << "#??? = ";
+ S << "#??? = "; // Unknown entity number
if (thewlib.Select(ent, module, CN))
{
if (module->IsComplex(CN))
else if (level == 1)
{
- // ... Idents ...
+ // Collect entity identifiers
Handle(Standard_Transient) anent;
Handle(Interface_GeneralModule) module;
Standard_Integer CN;
{
Interface_EntityIterator iter;
module->FillSharedCase(CN, ent, iter);
- module->ListImpliedCase(CN, ent, iter); // on cumule ...
+ module->ListImpliedCase(CN, ent, iter); // accumulate entities
for (; iter.More(); iter.Next())
{
anent = iter.Value();
ids.SetValue(themodel->Number(anent), (nlab > 0 ? nlab : -1));
}
}
- // ... Envoi ...
+ // Send entity to writer
thewriter.SendEntity(num, thewlib);
//// thewriter.Print(S);
}
else
{
Handle(Standard_Transient) anent;
- // S<< " -- Dumping Entity n0 " << num << " --" << std::endl;
- // ... Envoi ...
+ // Debug output: dumping entity number
+ // Send entities to writer
TColStd_Array1OfInteger tab(0, nb);
tab.Init(0);
tab.SetValue(num, 1);
{
Interface_EntityIterator iter;
module->FillSharedCase(CN, ent, iter);
- module->ListImpliedCase(CN, ent, iter); // on cumule ...
+ module->ListImpliedCase(CN, ent, iter); // accumulate entities
for (; iter.More(); iter.Next())
{
tab.SetValue(themodel->Number(iter.Value()), 1);
}
for (i = 1; i <= nb; i++)
{
- // ... Listes des idents ...
+ // Process entity identifiers list
if (tab.Value(i) == 0)
continue;
anent = themodel->Value(i);
{
Interface_EntityIterator iter;
module->FillSharedCase(CN, anent, iter);
- module->ListImpliedCase(CN, anent, iter); // on cumule ...
+ module->ListImpliedCase(CN, anent, iter); // accumulate entities
for (; iter.More(); iter.Next())
{
anent = iter.Value();
//// thewriter.Print(S);
}
- // .... Affichage des idents silya ....
+ // Display entity identifiers if present
+ // Count different types of identifiers: distinct (nbi), matching entity number (nbq),
+ // without identifier (nbu), total entities with identifiers (nbe)
Standard_Integer nbi = 0, nbe = 0, nbq = 0, nbu = 0;
for (i = 1; i <= nb; i++)
{
nlab = ids.Value(i);
if (nlab == 0)
- continue;
- nbe++;
+ continue; // Skip entities without identifiers
+ nbe++; // Count entities with identifiers
if (nlab < 0)
- nbu = 0;
+ nbu = 0; // Entities without proper identifier
else if (nlab == i)
- nbq = 0;
+ nbq = 0; // Entities where identifier matches entity number
else if (nlab > 0)
- nbi++;
+ nbi++; // Entities with distinct proper identifiers
}
if (nbe > 0)
{
- // S<<" -- Displayed nums:"<<nbe<<" with ident=num:"<<nbq<<" , distinct proper
- // ident:"<<nbi<<"\n";
+ // Debug statistics: displayed entities, matching identifiers, distinct identifiers
if (nbu > 0)
{
S << " (no ident): ";
S << std::endl;
}
if (nbi < 0)
- { // on n affiche plus num:#id , on envoie un petit help
+ { // Display help format instead of individual num:#id entries
Standard_Integer nbl = 0, nbr = 0, nbr0 = 0, nbc = 0;
char unid[30];
- // S <<" (proper ident): #num #ident"<<std::endl;
+ // Alternative format: "#num #ident"
S << " (proper ident): num:#ident num:#ident ..." << std::endl;
for (i = 1; i <= nb; i++)
{
S << unid;
nbr0 = nbr;
- // if (nbl+nbc > 79) { S<<std::endl<<unid; nbl = 0; }
- // else { S<<unid; }
- // nbl += (nbc+nbr);
- // nbr = ((80-nbc) % 4) +1;
- // S<<" "<<i<<" ->#"<<ids.Value(i);
- // nbl ++; if (nbl > 5) { nbl = nbr = 0; S<<std::endl; }
+ // Alternative formatting approaches for entity identifiers:
+ // - Line wrapping at 79 characters
+ // - Grouped output with spacing
+ // - Tabular format with entity ranks and STEP identifiers
}
if (nbl > 0)
S << std::endl;
}
if (nbi > 0)
S << "In dump, iii:#jjj means : entity rank iii has step ident #jjj" << std::endl;
- // S<<" -- Dumping data, entity "<<num<<" level "<<level<<" :"<<std::endl;
+ // Debug output: entity dumping information with level details
}
if (level > 0)
{
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(StepData_StepModel, Interface_InterfaceModel)
-// Entete de fichier : liste d entites
+// File header: list of entities
+// Default constructor for STEP data model
StepData_StepModel::StepData_StepModel() {}
Handle(Standard_Transient) StepData_StepModel::Entity(const Standard_Integer num) const
{
return Value(num);
-} // nom plus joli
+} // More user-friendly name for accessing entities
+// Copy header entities from another STEP model
+// This method transfers only the header section, not the data entities
void StepData_StepModel::GetFromAnother(const Handle(Interface_InterfaceModel)& other)
{
theheader.Clear();
if (another.IsNull())
return;
Interface_EntityIterator iter = another->Header();
- // recopier le header. Attention, header distinct du contenu ...
+ // Copy the header. Important: header is distinct from content...
Interface_CopyTool TC(this, StepData::HeaderProtocol());
for (; iter.More(); iter.Next())
{
return iter;
}
+// Check if exactly one header entity of specified type exists
+// Returns true only if there is exactly one entity of the given type
Standard_Boolean StepData_StepModel::HasHeaderEntity(const Handle(Standard_Type)& atype) const
{
return (theheader.NbTypedEntities(atype) == 1);
return theheader.TypedEntity(atype);
}
-// Remplissage du Header
+// Header population methods
void StepData_StepModel::ClearHeader()
{
void StepData_StepModel::DumpHeader(Standard_OStream& S, const Standard_Integer /*level*/) const
{
- // NB : level n est pas utilise
+ // Note: level parameter is not used in this implementation
Handle(StepData_Protocol) stepro = StepData::HeaderProtocol();
Standard_Boolean iapro = !stepro.IsNull();
Handle(StepData_StepModel) me(this);
StepData_StepWriter SW(me);
- SW.SendModel(stepro, Standard_True); // envoi HEADER seul
+ SW.SendModel(stepro, Standard_True); // Send HEADER only
SW.Print(S);
}
theidnums.Nullify();
}
+// Set identifier label for an entity (used in STEP file format)
+// The identifier is typically a number like #123 that appears in STEP files
void StepData_StepModel::SetIdentLabel(const Handle(Standard_Transient)& ent,
const Standard_Integer ident)
{
Standard_Integer num = Number(ent);
if (!num)
- return;
+ return; // Entity not found in model
Standard_Integer nbEnt = NbEntities();
+
+ // Initialize identifier array if not yet created
if (theidnums.IsNull())
{
theidnums = new TColStd_HArray1OfInteger(1, nbEnt);
- theidnums->Init(0);
+ theidnums->Init(0); // Initialize all values to 0
}
+ // Resize array if model has grown since last allocation
else if (nbEnt > theidnums->Length())
{
Standard_Integer prevLength = theidnums->Length();
Handle(TColStd_HArray1OfInteger) idnums1 = new TColStd_HArray1OfInteger(1, nbEnt);
idnums1->Init(0);
+ // Copy existing identifier mappings
Standard_Integer k = 1;
for (; k <= prevLength; k++)
idnums1->SetValue(k, theidnums->Value(k));
//=================================================================================================
+// Get the length unit for writing STEP files
+// Returns the conversion factor from millimeters to the target unit
Standard_Real StepData_StepModel::WriteLengthUnit() const
{
+ // Lazy initialization of write unit from global parameters
if (!myWriteUnitIsInitialized)
{
myWriteUnitIsInitialized = Standard_True;
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(StepData_StepReaderData, Interface_FileReaderData)
-// Le Header est constitue d entites analogues dans leur principe a celles
-// du Data, a ceci pres qu elles sont sans identifieur, et ne peuvent ni
-// referencer, ni etre referencees (que ce soit avec Header ou avec Data)
-// Ainsi, dans StepReaderData, le Header est constitue des "thenbhead" 1res Entites
+// The Header consists of entities analogous in principle to those
+// of the Data, except that they are without identifier, and can neither
+// reference, nor be referenced (whether with Header or with Data)
+// Thus, in StepReaderData, the Header consists of the first "thenbhead" Entities
+// This separation allows STEP files to have metadata and structural information
+// separate from the main geometric and semantic data
// #########################################################################
-// .... Creation et Acces de base aux donnees atomiques du fichier ....
+// .... Creation and basic access to atomic file data ....
typedef TCollection_HAsciiString String;
-static char txtmes[200]; // plus commode que redeclarer partout
+static char txtmes[200]; // more convenient than redeclaring everywhere
static Standard_Boolean initstr = Standard_False;
#define Maxlst 64
Standard_Integer numlst;
if (type[0] != '(')
- thenbents++; // total de termes propres du fichier
+ thenbents++; // total number of proper file terms
thetypes.ChangeValue(num) = thenametypes.Add(TCollection_AsciiString(type));
else
numlst = ident[1] - 48;
if (thelastn < numlst)
- thelastn = numlst; // plus fort n0 de sous-liste
+ thelastn = numlst; // highest sub-list number
theidents.SetValue(num, -2 - numlst);
}
else if (ident[0] == '#')
theidents.SetValue(num, numlst);
if (numlst == 0 && num > thenbhead)
{
- // Header, ou bien Type Complexe ...
- // Si Type Complexe, retrouver Type Precedent (on considere que c est rare)
- // On chaine le type precedent sur le suivant
- // VERIFICATION que les types sont en ordre alphabetique
+ // Header, or Complex Type ...
+ // If Complex Type, find Previous Type (we consider this is rare)
+ // Chain the previous type to the next one
+ // VERIFICATION that types are in alphabetical order
for (Standard_Integer prev = num - 1; prev > thenbhead; prev--)
{
if (theidents(prev) >= 0)
}
// ########################################################################
-// .... Aides a la lecture des parametres, adaptees a STEP ....
+// .... Parameter reading aids, adapted for STEP ....
//=================================================================================================
if (n == 0) /*stat =*/
NamedForComplex(name, num0, n, ach); // on a rembobine
- // Pas dans l ordre alphabetique : boucler
+ // Not in alphabetical order: loop
Handle(String) errmess = new String("Parameter n0.%d (%s) not a LIST");
sprintf(txtmes, errmess->ToCString(), num0, name);
for (n = num0; n > 0; n = NextForComplex(n))
return Standard_True;
}
-// ... Facilites pour LateBinding
+// ... Utilities for LateBinding
//=================================================================================================
{
Standard_Integer nbp = NbParams(numsub);
if (nbp == 0)
- return 0; // liste vide = Handle Null
+ return 0; // empty list = Handle Null
const TCollection_AsciiString& rectyp = RecordType(numsub);
if (nbp == 1 && rectyp.ToCString()[0] != '(')
{
- // c est un type avec un parametre -> SelectNamed
- // cf ReadSelect mais ici, on est deja sur le contenu du parametre
+ // it's a type with one parameter -> SelectNamed
+ // cf ReadSelect but here, we are already on the parameter content
Handle(StepData_SelectNamed) sn = new StepData_SelectNamed;
val = sn;
sn->SetName(rectyp.ToCString());
return 0;
}
- // cas courant : faire un HArray1 de ... de ... de quoi au fait
+ // common case: make an HArray1 of ... of ... of what exactly
const Interface_FileParameter& FP0 = Param(numsub, 1);
Interface_ParamType FT, FT0 = FP0.ParamType();
Standard_CString str = FP0.CValue();
htr = new TColStd_HArray1OfTransient(1, nbp);
val = htr;
}
- // Attention : si type variable, faudra changer son fusil d epaule -> htr
+ // Attention: if variable type, will need to change approach -> htr
for (Standard_Integer ip = 1; ip <= nbp; ip++)
{
default:
break;
}
- // Restent les autres cas ... tout est possible. cf le type du Param
+ // Remaining other cases ... everything is possible. cf the Param type
if (kod > 0)
continue;
- // Il faut passer au transient ...
+ // Need to pass to transient ...
if (htr.IsNull())
{
htr = new TColStd_HArray1OfTransient(1, nbp);
}
}
}
- // A present, faut y aller : lire le champ et le mettre en place
- // Ce qui suit ressemble fortement a ReadAny ...
+ // Now, let's go: read the field and put it in place
+ // What follows strongly resembles ReadAny ...
switch (FT)
{
}
return -1;
}
- return 8; // pour Any
+ return 8; // for Any
}
//=================================================================================================
Standard_CString str = FP.CValue();
Interface_ParamType FT = FP.ParamType();
- // A present, faut y aller : lire le champ et le mettre en place
+ // Now, let's go: read the field and put it in place
switch (FT)
{
case Interface_ParamMisc:
Standard_Integer numsub = SubListNumber(num, nump, Standard_False);
Standard_Integer nbp = NbParams(numsub);
if (nbp == 0)
- return Standard_False; // liste vide = Handle Null
+ return Standard_False; // empty list = Handle Null
const TCollection_AsciiString& rectyp = RecordType(numsub);
if (nbp == 1 && rectyp.ToCString()[0] != '(')
{
Standard_Real& X,
Standard_Real& Y) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Integer numsub = SubListNumber(num, nump, Standard_False);
if (numsub != 0)
{
Standard_Real& Y,
Standard_Real& Z) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Integer numsub = SubListNumber(num, nump, Standard_False);
if (numsub != 0)
{
const Handle(Standard_Type)& atype,
Handle(Standard_Transient)& ent) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = Standard_False;
if (nump > 0 && nump <= NbParams(num))
{
Handle(Interface_Check)& ach,
StepData_SelectType& sel) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = Standard_False;
if (nump > 0 && nump <= NbParams(num))
{
}
else
{
- // Cas restant : on s interesse en fait au SelectMember ...
+ // Remaining case: we are actually interested in the SelectMember ...
Handle(Standard_Transient) sm = sel.NewMember();
- // SelectMember qui assure ce role. Peut etre specialise
+ // SelectMember which performs this role. Can be specialized
if (!ReadAny(num, nump, mess, ach, sel.Description(), sm))
errmess = new String("Parameter n0.%d (%s) : could not be read");
if (!sel.Matches(sm))
Handle(Interface_Check)& ach,
Standard_Integer& val) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = Standard_False;
if (nump > 0 && nump <= NbParams(num))
{
Handle(Interface_Check)& ach,
Handle(TCollection_HAsciiString)& val) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = Standard_False;
if (nump > 0 && nump <= NbParams(num))
{
Handle(Interface_Check)& ach,
Standard_CString& text) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = Standard_False;
if (nump > 0 && nump <= NbParams(num))
{
const StepData_EnumTool& enumtool,
Standard_Integer& val) const
{
- // reprendre avec ReadEnumParam ?
- Handle(String) errmess; // Null si pas d erreur
+ // resume with ReadEnumParam?
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = Standard_False;
if (nump > 0 && nump <= NbParams(num))
{
const Interface_FileParameter& FP = Param(num, nump);
if (FP.ParamType() != Interface_ParamSub)
{
- // Pas une sous-liste : OK si admis
+ // Not a sub-list: OK if allowed
numr = num;
numrp = nump;
typ.Clear();
Handle(Interface_Check)& ach,
const Standard_Boolean errstat) const
{
- Handle(String) errmess; // Null si pas d erreur
+ Handle(String) errmess; // Null if no error
Standard_Boolean warn = !errstat;
if (nump > 0 && nump <= NbParams(num))
{
}
// #########################################################################
-// .... Methodes specifiques (demandees par FileReaderData) .... //
+// .... Specific methods (requested by FileReaderData) .... //
//=================================================================================================
Standard_Integer StepData_StepReaderData::FindNextRecord(const Standard_Integer num) const
{
- // retourne, sur un numero d enregistrement donne (par num), le suivant qui
- // definit une entite, ou 0 si c est fini :
- // passe le Header (nbhend premiers records) et
- // saute les enregistrements SCOPE et ENDSCOPE et les SOUS-LISTES
+ // returns, for a given record number (by num), the next one which
+ // defines an entity, or 0 if finished:
+ // passes the Header (first nbhend records) and
+ // skips SCOPE and ENDSCOPE records and SUB-LISTS
if (num < 0)
return 0;
if (theidents(num1) > 0)
return num1;
- // SCOPE,ENDSCOPE et Sous-Liste ont un identifieur fictif: -1,-2 respectivement
- // et SUBLIST ont un negatif. Seule une vraie entite a un Ident positif
+ // SCOPE,ENDSCOPE and Sub-List have a fictitious identifier: -1,-2 respectively
+ // and SUBLIST have a negative one. Only a real entity has a positive Ident
num1++;
}
return 0;
Standard_Integer StepData_StepReaderData::FindEntityNumber(const Standard_Integer num,
const Standard_Integer id) const
{
- // Soit un "Id" : recherche dans les Parametres de type Ident de <num>,
- // si un d eux designe #Id justement. Si oui, retourne son EntityNumber
+ // Given an "Id": search in the Ident type Parameters of <num>,
+ // if one of them designates #Id precisely. If yes, return its EntityNumber
if (num == 0)
return 0;
Standard_Integer nb = NbParams(num);
}
// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
-// .... La fonction qui suit merite une attention speciale ....
-
-// Cette methode precharge les EntityNumbers dans les Params : ils designent
-// les Entites proprement dites dans la liste lue par BoundEntity
-// Interet : adresse de meme les sous-listes (Num->no record dans le Direc)
-// resultat exploite par ParamEntity et ParamNumber
-
-// En l absence de SCOPE, ou si les "ident" sont strictement ordonnes, a coup
-// sur ils ne sont pas dupliques, on peut utiliser une IndexedMap en toute
-// confiance. Sinon, il faut balayer dans le fichier, mais avec les SCOPES
-// cela va beaucoup plus vite (s ils sont assez gros) : on s y retrouve.
-
-// Pour la recherche par balayage, On opere en plusieurs etapes
-// Avant toute chose, le chargement a deja fait une preparation : les idents
-// (Entity, SubList) sont deja en entiers (rapidite de lecture), en particulier
-// dans les EntityNumber : ainsi, on lit cet ident, on le traite, et on remet
-// a la place un vrai numero de Record
+// .... The following function deserves special attention ....
+
+// This method preloads the EntityNumbers in the Params: they designate
+// the Entities properly said in the list read by BoundEntity
+// Interest: also addresses sub-lists (Num->record number in the Directory)
+// result exploited by ParamEntity and ParamNumber
+//
+// This is a critical optimization that resolves entity references during loading
+// rather than during each access, significantly improving performance for large files
+
+// In the absence of SCOPE, or if the "ident" are strictly ordered, for sure
+// they are not duplicated, we can use an IndexedMap with full
+// confidence. Otherwise, we must scan the file, but with SCOPES
+// this goes much faster (if they are big enough): we find our way around.
+
+// For the search by scanning, We operate in several steps
+// Before anything, the loading has already done preparation: the idents
+// (Entity, SubList) are already in integers (reading speed), in particular
+// in the EntityNumber: thus, we read this ident, we process it, and we put back
+// in its place a real Record number
//
-// D abord, on passe le directory en table d entiers, sous-listes expurgees
-// en // , table inverse vers cette table, car les sous-listes peuvent par
-// contre designer des objets ...
+// First, we pass the directory to integer table, sub-lists purged
+// in parallel, inverse table towards this table, because sub-lists can on the
+// contrary designate objects ...
-// Pour les sous-listes, on exploite leur mode de construction : elles sont
-// enregistrees AVANT d etre referencees. Un tableau "subn" note donc pour
-// chaque numero de sous-liste (relatif a une entite qui suit, et reference
-// par elle ou une autre sous-liste qui suit egalement), son n0 de record
-// REMARQUE : ceci marche aussi pour le Header, traite par l occasion
+// For sub-lists, we exploit their construction mode: they are
+// recorded BEFORE being referenced. A "subn" array thus notes for
+// each sub-list number (relative to an entity that follows, and referenced
+// by it or another sub-list that also follows), its record number
+// NOTE: this also works for the Header, processed on the occasion
//=================================================================================================
void StepData_StepReaderData::SetEntityNumbers(const Standard_Boolean withmap)
{
Message_Messenger::StreamBuffer sout = Message::SendTrace();
- // Passe initiale : Resolution directe par Map
- // si tout passe (pas de collision), OK. Sinon, autres passes a prevoir
- // On resoud du meme coup les sous-listes
+ // Initial pass: Direct resolution by Map
+ // if everything passes (no collision), OK. Otherwise, other passes to plan
+ // We resolve sub-lists at the same time
+ // The Map approach is O(1) lookup but requires unique identifiers
+ // If identifiers collide (due to SCOPE sections), we fall back to linear search
Standard_Integer nbdirec = NbRecords();
Handle(NCollection_IncAllocator) anAlloc =
new NCollection_IncAllocator(NCollection_IncAllocator::THE_MINIMUM_BLOCK_SIZE);
TColStd_Array1OfInteger subn(0, thelastn);
- Standard_Boolean pbmap = Standard_False; // au moins un conflit
+ Standard_Boolean pbmap = Standard_False; // at least one conflict
Standard_Integer nbmap = 0;
TColStd_IndexedMapOfInteger imap(thenbents, anAlloc);
- TColStd_Array1OfInteger indm(0, nbdirec); // Index Map -> Record Number (seulement si map)
+ TColStd_Array1OfInteger indm(0, nbdirec); // Index Map -> Record Number (only if map)
Standard_Integer num; // svv Jan11 2000 : porting on DEC
for (num = 1; num <= nbdirec; num++)
Standard_Integer ident = theidents(num);
if (ident > 0)
{ // Ident normal -> Map ?
- // Map : si Recouvrement, l inhiber. Sinon, noter index
+ // Map: if Overlap, inhibit it. Otherwise, note index
Standard_Integer indmap = imap.Add(ident);
if (indmap <= nbmap)
{
- indmap = imap.FindIndex(ident); // plus sur
+ indmap = imap.FindIndex(ident); // safer
indm(indmap) = -1; // Map -> pb
pbmap = Standard_True;
- // pbmap signifie qu une autre passe sera necessaire ...
+ // pbmap means another pass will be necessary ...
}
else
{
for (Standard_Integer na = nba; na > 0; na--)
{
- // On traite : les sous-listes (sf subn), les idents (si Map dit OK ...)
+ // We process: sub-lists (except subn), idents (if Map says OK ...)
Interface_FileParameter& FP = ChangeParameter(nda + na);
// Interface_FileParameter& FP = ChangeParam (num,na);
Interface_ParamType letype = FP.ParamType();
Standard_Integer id = FP.EntityNumber();
Standard_Integer indmap = imap.FindIndex(id);
if (indmap > 0)
- { // la map a trouve
+ { // the map found it
Standard_Integer num0 = indm(indmap);
if (num0 > 0)
- FP.SetEntityNumber(num0); // ET VOILA, on a resolu
+ FP.SetEntityNumber(num0); // AND THERE, we have resolved
else
- FP.SetEntityNumber(-id); // CONFLIT -> faudra resoudre ...
+ FP.SetEntityNumber(-id); // CONFLICT -> will need to resolve ...
}
else
- { // NON RESOLU, si pas pbmap, le dire
+ { // NOT RESOLVED, if no pbmap, say it
if (pbmap)
{
FP.SetEntityNumber(-id);
- continue; // pbmap : on se retrouvera
+ continue; // pbmap: we will find ourselves again
}
char failmess[100];
- // ... Construire le Check ...
+ // ... Build the Check ...
sprintf(failmess, "Unresolved Reference, Ent.Id.#%d Param.n0 %d (Id.#%d)", ident, na, id);
thecheck->AddFail(failmess, "Unresolved Reference");
- // ... Et sortir message un peu plus complet
+ // ... And output a more complete message
sout << "*** ERR StepReaderData *** Entite #" << ident << "\n Type:" << RecordType(num)
<< " Param.n0 " << na << ": #" << id << " Not found" << std::endl;
- } // FIN Mapping
- } // FIN Traitement Reference
- } // FIN Boucle Parametres
- } // FIN Boucle Repertoires
+ } // END Mapping
+ } // END Reference Processing
+ } // END Parameters Loop
+ } // END Directory Loop
if (!pbmap)
{
Standard_Integer nbseq = thenbents + 2 * thenbscop;
TColStd_Array1OfInteger inds(0, nbseq); // n0 Record/Entite
TColStd_Array1OfInteger indi(0, nbseq); // Idents/scopes
- TColStd_Array1OfInteger indr(0, nbdirec); // inverse de nds
- Handle(TColStd_HArray1OfInteger) indx; // pour EXPORT (silya)
+ TColStd_Array1OfInteger indr(0, nbdirec); // inverse of nds
+ Handle(TColStd_HArray1OfInteger) indx; // for EXPORT (if any)
imap.Clear();
anAlloc->Reset();
- Standard_Boolean iamap = withmap; // (par defaut True)
+ Standard_Boolean iamap = withmap; // (default True)
nbmap = 0;
- TColStd_SequenceOfInteger scopile(anAlloc); // chainage des scopes note par pile
+ TColStd_SequenceOfInteger scopile(anAlloc); // scope chaining noted by stack
Standard_Integer nr = 0;
for (num = 1; num <= nbdirec; num++)
{
Standard_Integer ident = theidents(num);
if (ident < -2)
- { // SOUS-LISTE (cas le plus courant)
- indr(num) = nr + 1; // recherche basee sur nr (objet qui suit)
+ { // SUB-LIST (most common case)
+ indr(num) = nr + 1; // search based on nr (following object)
}
else if (ident >= 0)
{ // Ident normal
indi(nr) = ident;
indr(num) = nr;
if (ident > 0)
- { // et non (iamap && ident > 0)
- // Map : si Recouvrement, l inhiber. Sinon, noter index
+ { // and not (iamap && ident > 0)
+ // Map: if Overlap, inhibit it. Otherwise, note index
Standard_Integer indmap = imap.Add(ident);
if (indmap <= nbmap)
{
pbmap = Standard_True;
if (thenbscop == 0)
errorscope = Standard_True;
- // Numeros identiques alors quilnya pas de SCOPE ? ERREUR !
- // (Bien sur, silya des SCOPES, on passe au travers, mais bon...)
+ // Identical numbers when there is no SCOPE? ERROR!
+ // (Of course, if there are SCOPES, we pass through, but still...)
else
{
- // Silya des SCOPES, tachons d y voir de plus pres pour signaler un probleme
- // Erreur si MEME groupe SCOPE
- // ATTENTION, on recherche, non dans tous les records, mais dans les records
- // CHAINES, cf nr et non num (pas de sous-liste, chainage scope-endscope)
+ // If there are SCOPES, let's look more closely to report a problem
+ // Error if SAME SCOPE group
+ // ATTENTION, we search, not in all records, but in the records
+ // CHAINED, cf nr and not num (no sub-list, scope-endscope chaining)
Standard_Integer fromscope = nr;
Standard_Integer toscope = indm(indmap);
if (toscope < 0)
toscope = -toscope;
for (;;)
{
- fromscope--; // iteration de base
+ fromscope--; // basic iteration
if (fromscope <= toscope)
{
- errorscope = Standard_True; // BANG, on est dessus
+ errorscope = Standard_True; // BANG, we are on it
break;
}
Standard_Integer idtest = indi(fromscope);
if (idtest >= 0)
- continue; // le suivant (enfin, le precedent)
+ continue; // the next one (well, the previous one)
if (idtest == -1)
- break; // pas meme niveau, donc c est OK
+ break; // not same level, so it's OK
if (idtest == -3)
{
fromscope = inds(fromscope);
if (fromscope < toscope)
- break; // on sort, pas en meme niveau
+ break; // we exit, not on same level
}
}
}
if (errorscope)
{
- // On est dedans : le signaler
+ // We are inside: report it
char ligne[80];
sprintf(ligne, "Ident defined SEVERAL TIMES : #%d", ident);
thecheck->AddFail(ligne, "Ident defined SEVERAL TIMES : #%d");
sout << "StepReaderData : SetEntityNumbers, " << ligne << std::endl;
}
if (indm(indmap) > 0)
- indm(indmap) = -indm(indmap); // Pas pour Map
- // Cas Normal pour la Map
+ indm(indmap) = -indm(indmap); // Not for Map
+ // Normal case for the Map
}
else
{
}
}
- // .. Resolution des EXPORT, silyena et silya besoin ..
- // Pour chaque valeur de EXPORT qui n a pas ete resolue par la MAP,
- // determiner sa position locale par recherche en arriere depuis ENDSCOPE
+ // .. EXPORT resolution, if any and if needed ..
+ // For each EXPORT value that has not been resolved by the MAP,
+ // determine its local position by backward search from ENDSCOPE
if ((!iamap || pbmap) && !indx.IsNull())
{
for (nr = 0; nr <= nbseq; nr++)
continue;
Standard_Integer id = -FP.EntityNumber();
if (id < 0)
- continue; // deja resolu en tete
+ continue; // already resolved at head
/* if (imap.Contains(id)) { et voila
FP.SetEntityNumber(indm(imap.FindIndex(id)));
continue;
} */
- // Recherche du Id demande : si EXPORT imbrique, deja resolu mais il faut
- // regarder ! (inutile par contre d aller y voir : c est deja fait, car
- // un EXPORT imbrique a ete traite AVANT celui qui imbrique)
+ // Search for the requested Id: if nested EXPORT, already resolved but we must
+ // look! (useless however to go see: it's already done, because
+ // a nested EXPORT has been processed BEFORE the one that nests)
Standard_Integer n0 = nr - 1;
if (indi(n0) == -3)
- n0--; // si on suit juste un ENDSCOPE
+ n0--; // if we just follow an ENDSCOPE
while (n0 > 0)
{
Standard_Integer irec = indi(n0);
if (irec == id)
- { // trouve
+ { // found
FP.SetEntityNumber(inds(n0));
break;
}
if (irec == -1)
- break; // SCOPE : fin de ce SCOPE/ENDSCOPE
+ break; // SCOPE: end of this SCOPE/ENDSCOPE
if (irec == -3)
{
- // gare a EXPORT : si un EXPORT detient Id, noter son Numero deja calcule
- // Attention : Id a lire depuis CValue car EntityNumber deja resolu
+ // beware of EXPORT: if an EXPORT holds Id, note its already calculated Number
+ // Attention: Id to be read from CValue because EntityNumber already resolved
Standard_Integer nok = FindEntityNumber(indx->Value(n0), id);
if (nok > 0)
{
FP.SetEntityNumber(nok);
break;
}
- n0 = inds(n0); // ENDSCOPE ou EXPORT infructueux : le sauter
- } // fin traitement sur un ENDSCOPE ou EXPORT
+ n0 = inds(n0); // ENDSCOPE or unsuccessful EXPORT: skip it
+ } // end processing on an ENDSCOPE or EXPORT
n0--;
- } // fin resolution d un Parametre EXPORT
- } // fin resolution de la liste d un EXPORT
- } // fin bouclage sur les EXPORT
+ } // end resolution of an EXPORT Parameter
+ } // end resolution of an EXPORT list
+ } // end looping on EXPORTs
}
- // Exploitation de la table : bouclage porte sur la table
+ // Table exploitation: looping operates on the table
- // Traitement des sous-listes : se fait dans la foulee, par gestion d une pile
- // basee sur la constitution des sous-listes
- Standard_Integer maxsubpil = 30; // pile simulee avec un Array : tres fort
- Handle(TColStd_HArray1OfInteger) subpile = // ... gagne de la memoire ...
+ // Sub-lists processing: done on the fly, by managing a stack
+ // based on the constitution of sub-lists
+ Standard_Integer maxsubpil = 30; // simulated stack with an Array: very strong
+ Handle(TColStd_HArray1OfInteger) subpile = // ... saves memory ...
new TColStd_HArray1OfInteger(1, maxsubpil);
- Standard_Integer nbsubpil = 0; // ... et tellement plus rapide !
+ Standard_Integer nbsubpil = 0; // ... and so much faster!
for (num = 1; num <= nbdirec; num++)
{
nr = indr(num);
if (nr == 0)
- continue; // pas un objet ou une sous-liste
+ continue; // not an object or a sub-list
Standard_Integer nba = NbParams(num);
for (Standard_Integer na = nba; na > 0; na--)
{
- // On lit depuis la fin : cela permet de traiter les sous-listes dans la foulee
- // Sinon, on devrait noter qu il y a eu des sous-listes et reprendre ensuite
+ // We read from the end: this allows processing sub-lists on the fly
+ // Otherwise, we should note that there were sub-lists and resume afterwards
+ // Reverse processing ensures that nested sub-lists are resolved before their containers
+ // This is critical for maintaining referential integrity in complex STEP structures
Interface_FileParameter& FP = ChangeParam(num, na);
Interface_ParamType letype = FP.ParamType();
if (letype == Interface_ParamSub)
{
- // parametre type sous-liste : numero de la sous-liste lu par depilement
+ // sub-list type parameter: sub-list number read by unstacking
FP.SetEntityNumber(subpile->Value(nbsubpil));
nbsubpil--; // subpile->Remove(nbsubpil);
}
else if (letype == Interface_ParamIdent)
{
- // parametre type ident (reference une entite) : chercher ident demande
+ // ident type parameter (references an entity): search for requested ident
Standard_Integer id = -FP.EntityNumber();
if (id < 0)
- continue; // deja resolu en tete
+ continue; // already resolved at head
- // Voila : on va chercher id dans ndi; algorithme de balayage
+ // Here we go: we will search for id in ndi; scanning algorithm
+ // This implements a bidirectional search strategy: first backward from current position
+ // to file beginning, then forward to file end. This optimizes for locality of references.
Standard_Integer pass, sens, nok, n0, irec;
pass = sens = nok = 0;
if (!iamap)
- pass = 1; // si map non disponible
+ pass = 1; // if map not available
while (pass < 3)
{
pass++;
- // MAP disponible
+ // MAP available
if (pass == 1)
- { // MAP DISPONIBLE
+ { // MAP AVAILABLE
Standard_Integer indmap = imap.FindIndex(id);
if (indmap > 0)
- { // la map a trouve
+ { // the map found it
nok = indm(indmap);
if (nok < 0)
- continue; // CONFLIT -> faut resoudre ...
+ continue; // CONFLICT -> need to resolve ...
break;
}
else
continue;
}
- // 1re Passe : REMONTEE -> Debut fichier
+ // 1st Pass: BACKWARD -> File beginning
if (sens == 0 && nr > 1)
{
n0 = nr - 1;
if (indi(n0) == -3)
- n0--; // si on suit juste un ENDSCOPE
+ n0--; // if we just follow an ENDSCOPE
while (n0 > 0)
{
irec = indi(n0);
if (irec == id)
- { // trouve
+ { // found
nok = n0;
break;
}
n0 = inds(n0);
else
{
- // EXPORT, il faut regarder
+ // EXPORT, we must look
nok = FindEntityNumber(indx->Value(n0), id);
if (nok > 0)
break;
- n0 = inds(n0); // ENDSCOPE : le sauter
+ n0 = inds(n0); // ENDSCOPE: skip it
}
}
n0--;
}
- // 2me Passe : DESCENTE -> Fin fichier
+ // 2nd Pass: DESCENT -> End of file
}
else if (nr < nbseq)
- { // descente -> fin fichier
+ { // descent -> end of file
n0 = nr + 1;
while (n0 <= nbseq)
{
irec = indi(n0);
if (irec == id)
- { // trouve
+ { // found
nok = n0;
break;
}
- // SCOPE : Attention a EXPORT sinon sauter
+ // SCOPE: Attention to EXPORT otherwise skip
if (irec == -1)
{
if (indx.IsNull())
n0 = inds(n0);
else
{
- // EXPORT, il faut regarder
+ // EXPORT, we must look
nok = FindEntityNumber(indx->Value(n0), id);
if (nok > 0)
break;
- n0 = inds(n0); // SCOPE : le sauter
+ n0 = inds(n0); // SCOPE: skip it
}
}
n0++;
}
if (nok > 0)
break;
- sens = 1 - sens; // passe suivante
+ sens = 1 - sens; // next pass
}
- // ici on a nok, numero trouve
+ // here we have nok, number found
if (nok > 0)
{
Standard_Integer num0 = inds(nok);
- FP.SetEntityNumber(num0); // ET VOILA, on a resolu
+ FP.SetEntityNumber(num0); // AND THERE, we have resolved
- // pas trouve : le signaler
+ // not found: report it
}
else
{
- // Alimenter le Check ... Pour cela, determiner n0 Entite et Ident
+ // Feed the Check ... For this, determine Entity n0 and Ident
char failmess[100];
Standard_Integer nument = 0;
Standard_Integer n0ent; // svv Jan11 2000 : porting on DEC
break;
}
}
- // ... Construire le Check ...
+ // ... Build the Check ...
sprintf(failmess,
"Unresolved Reference, Ent.n0 %d (Id.#%d) Param.n0 %d (Id.#%d)",
nument,
id);
thecheck->AddFail(failmess, "Unresolved Reference");
- // ... Et sortir message un peu plus complet
+ // ... And output a more complete message
sout << "*** ERR StepReaderData *** Entite " << nument << ", a " << (nr * 100) / nbseq
<< "% de DATA : #" << ident << "\n Type:" << RecordType(num) << " Param.n0 "
<< na << ": #" << id << " Not found" << std::endl;
- FP.SetEntityNumber(0); // -> Reference non resolue
+ FP.SetEntityNumber(0); // -> Unresolved reference
}
}
}
- // Si ce record est lui-meme une sous-liste, empiler !
+ // If this record is itself a sub-list, stack it!
if (inds(nr) != num)
{
if (nbsubpil >= maxsubpil)
}
// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
-// .... Gestion du Header : Preparation, lecture ....
+// .... Header Management: Preparation, reading ....
//=================================================================================================
Standard_Integer StepData_StepReaderData::FindNextHeaderRecord(const Standard_Integer num) const
{
- // retourne, sur un numero d enregistrement donne (par num), le suivant qui
- // definit une entite, ou 0 si c est fini :
- // Opere comme FindNextRecord mais ne balaie que le Header
+ // returns, for a given record number (by num), the next one which
+ // defines an entity, or 0 if finished:
+ // Operates like FindNextRecord but only scans the Header
if (num < 0)
return 0;
while (num1 <= max)
{
- // SCOPE,ENDSCOPE et Sous-Liste ont un identifieur negatif
- // Ne retenir que les Idents positifs ou nuls (nul : pas d Ident dans Header)
+ // SCOPE,ENDSCOPE and Sub-List have a negative identifier
+ // Only retain positive or null Idents (null: no Ident in Header)
if (RecordIdent(num1) >= 0)
return num1;
num1++;
void StepData_StepReaderData::PrepareHeader()
{
- // Resolution des references : ne concerne que les sous-listes
- // deja faite par SetEntityNumbers donc pas de souci a se faire
+ // Reference resolution: only concerns sub-lists
+ // already done by SetEntityNumbers so no need to worry
/*
- // Algorithme repris et adapte de SetEntityNumbers
+ // Algorithm taken and adapted from SetEntityNumbers
// Traitement des sous-listes : se fait dans la foulee, par gestion d une pile
// basee sur la constitution des sous-listes
TColStd_SequenceOfInteger subpile;
- Standard_Integer nbsubpil = 0; // profondeur de pile mais plus rapide ...
+ Standard_Integer nbsubpil = 0; // stack depth but faster ...
for (Standard_Integer num = 1 ; num <= thenbhead ; num ++) {
Standard_Integer nba = NbParams(num) ;
for (Standard_Integer na = nba ; na > 0 ; na --) {
- .. On lit depuis la fin : cela permet de traiter les sous-listes dans la foulee
- .. Sinon, on devrait noter qu il y a eu des sous-listes et reprendre ensuite
+ .. We read from the end: this allows processing sub-lists on the fly
+ .. Otherwise, we should note that there were sub-lists and resume afterwards
Interface_FileParameter& FP = ChangeParam(num,na);
Interface_ParamType letype = FP.ParamType();
if (letype == Interface_ParamSub) {
- .. parametre type sous-liste : numero de la sous-liste lu par depilement
+ .. sub-list type parameter: sub-list number read by unstacking
FP.SetEntityNumber(subpile.Last());
.. .. SetParam(num,na,FP);
subpile.Remove(nbsubpil);
nbsubpil --;
}
}
- .. Si c est une sous-liste, empiler
+ .. If it's a sub-list, stack
if (RecordIdent(num) < -2) {
subpile.Append(num);
nbsubpil ++;
//=================================================================================================
+// Constructor: Initialize the STEP reader tool with reader data and protocol
StepData_StepReaderTool::StepData_StepReaderTool(const Handle(StepData_StepReaderData)& reader,
const Handle(StepData_Protocol)& protocol)
- : theglib(protocol),
- therlib(protocol)
+ : theglib(protocol), // General library from protocol
+ therlib(protocol) // Reader library from protocol
{
SetData(reader, protocol);
}
//=================================================================================================
+// Recognize and create an entity from a STEP record number
+// Returns true if recognition was successful
Standard_Boolean StepData_StepReaderTool::Recognize(const Standard_Integer num,
Handle(Interface_Check)& ach,
Handle(Standard_Transient)& ent)
{
- // Handle(Standard_Transient) bid; // pas exploite
+ // Handle(Standard_Transient) bid; // not used
// return thereco->Evaluate(thetypes.Value(num),bid);
- // Recognizer : C est lui qui assure la Reconnaissance (-> Liste limitative)
+ // Recognizer: It ensures the Recognition (-> Restrictive list of types)
+ // If a specific recognizer is available, use it for type recognition
if (!thereco.IsNull())
{
DeclareAndCast(StepData_StepReaderData, stepdat, Data());
return thereco->Evaluate(stepdat->RecordType(num), ent);
}
- // Pas de Recognizer : Reconnaissance par la librairie
+ // No Recognizer: Recognition by the library
+ // Fall back to standard library recognition when no specific recognizer is set
return RecognizeByLib(num, theglib, therlib, ach, ent);
}
-// .... Methodes de preparations propres a StepReaderTool ....
+// .... Preparation methods specific to StepReaderTool ....
//=================================================================================================
+// Prepare the reader tool with a file recognizer and optimization flag
void StepData_StepReaderTool::Prepare(const Handle(StepData_FileRecognizer)& reco,
const Standard_Boolean optim)
{
- thereco = reco;
- Prepare(optim);
+ thereco = reco; // Store the recognizer for later use
+ Prepare(optim); // Continue with standard preparation
}
//=================================================================================================
void StepData_StepReaderTool::Prepare(const Standard_Boolean optim)
{
- // SetEntityNumbers a ete mis du cote de ReaderData, because beaucoup acces
+ // SetEntityNumbers has been moved to ReaderData side, because of many accesses
+ // Check if error handling is enabled to decide on exception handling strategy
Standard_Boolean erh = ErrorHandle();
DeclareAndCast(StepData_StepReaderData, stepdat, Data());
if (erh)
}
}
-// .... Gestion du Header : Preparation, lecture .... //
+// .... Header Management: Preparation, reading .... //
//=================================================================================================
+// Prepare header entities by recognizing their types and binding them
void StepData_StepReaderTool::PrepareHeader(const Handle(StepData_FileRecognizer)& reco)
{
- Standard_Integer i = 0;
+ Standard_Integer i = 0; // Index for iterating through header records
- // Reconnaissance des types
+ // Type recognition
DeclareAndCast(StepData_StepReaderData, stepdat, Data());
while ((i = stepdat->FindNextHeaderRecord(i)) != 0)
{
Handle(Standard_Transient) ent;
- // On a donne un Recognizer : il fixe une liste limitative de types reconnus
+ // A Recognizer was provided: it sets a restrictive list of recognized types
if (!reco.IsNull())
{
+ // Try to recognize the entity type using the provided recognizer
if (!reco->Evaluate(stepdat->RecordType(i), ent))
{
+ // If recognition fails, create an unknown entity
ent = Protocol()->UnknownEntity();
}
}
else
{
- // Pas de Recognizer : Reconnaissance par la librairie
- Handle(Interface_Check) ach = new Interface_Check; // faudrait le lister ... ?
+ // No Recognizer: Recognition by the library
+ Handle(Interface_Check) ach = new Interface_Check; // should this be listed...?
RecognizeByLib(i, theglib, therlib, ach, ent);
}
if (ent.IsNull())
stepdat->BindEntity(i, ent);
}
- // Reste la Resolution des references : ne concerne que les sous-listes
- // Assuree par ReaderData
+ // Remaining reference resolution: only concerns sub-lists
+ // Handled by ReaderData
stepdat->PrepareHeader();
}
-// .... Methodes pour la lecture du Modele (apres preparation) .... //
+// .... Methods for reading the Model (after preparation) .... //
//=================================================================================================
+// Begin reading process: clear model header and process header entities
void StepData_StepReaderTool::BeginRead(const Handle(Interface_InterfaceModel)& amodel)
{
Message_Messenger::StreamBuffer sout = Message::SendTrace();
//=================================================================================================
+// Analyze a STEP record and populate the corresponding entity
+// Returns true if analysis was successful (no failures)
Standard_Boolean StepData_StepReaderTool::AnalyseRecord(const Standard_Integer num,
const Handle(Standard_Transient)& anent,
Handle(Interface_Check)& acheck)
DeclareAndCast(StepData_StepReaderData, stepdat, Data());
Handle(Interface_ReaderModule) imodule;
Standard_Integer CN;
+ // Try to find appropriate reader module for this entity type
if (therlib.Select(anent, imodule, CN))
{
+ // Cast to STEP-specific module and read the entity data
Handle(StepData_ReadWriteModule) module = Handle(StepData_ReadWriteModule)::DownCast(imodule);
module->ReadStep(CN, stepdat, num, acheck, anent);
}
else
{
- // Pas trouve : tenter UndefinedEntity de StepData
+ // Not found: try UndefinedEntity from StepData
DeclareAndCast(StepData_UndefinedEntity, und, anent);
if (und.IsNull())
acheck->AddFail("# Entity neither Recognized nor set as UndefinedEntity from StepData #");
//=================================================================================================
+// Finish reading process: set entity labels from record identifiers
void StepData_StepReaderTool::EndRead(const Handle(Interface_InterfaceModel)& amodel)
{
DeclareAndCast(StepData_StepReaderData, stepdat, Data());
#include <stdio.h>
#define StepLong 72
-// StepLong : longueur maxi d une ligne de fichier Step
+// StepLong: maximum length of a Step file line
-// Constantes litterales (interessantes, pour les performances ET LA MEMOIRE)
+// Literal constants (useful for performance AND MEMORY)
static TCollection_AsciiString textscope(" &SCOPE");
static TCollection_AsciiString textendscope(" ENDSCOPE");
thecomm = Standard_False;
thelevel = theindval = 0;
theindent = Standard_False;
- // Format flottant : reporte dans le FloatWriter
+ // Floating point format: delegated to FloatWriter
}
-// .... Controle d Envoi des Flottants ....
+// .... Float Sending Control ....
//=================================================================================================
Interface_FloatWriter& StepData_StepWriter::FloatWriter()
{
return thefloatw;
-} // s y reporter
+} // refer to it
//=================================================================================================
return thetypmode;
}
-// .... Description des Scopes (AVANT Envoi) ....
+// .... Scope Description (BEFORE Sending) ....
//=================================================================================================
#endif
throw Interface_InterfaceMismatch("StepWriter : SetScope, already set");
}
- thescopenext->SetValue(numin, -1); // nouvelle fin de scope
+ thescopenext->SetValue(numin, -1); // new end of scope
if (thescopebeg->Value(numscope) == 0)
thescopebeg->SetValue(numscope, numin);
Standard_Integer lastin = thescopeend->Value(numscope);
}
// ###########################################################################
-// ## ## ## ## ENVOI DES SECTIONS ## ## ## ##
+// ## ## ## ## SENDING SECTIONS ## ## ## ##
-// .... Envoi du Modele Complet ....
+// .... Sending Complete Model ....
//=================================================================================================
thefile->Append(new TCollection_HAsciiString("ISO-10303-21;"));
SendHeader();
- // .... Header : suite d entites sans Ident ....
+ // .... Header: sequence of entities without Ident ....
Interface_EntityIterator header = themodel->Header();
thenum = 0;
}
else
{
- // Pas trouve ci-dessus ... tenter UndefinedEntity
+ // Not found above ... try UndefinedEntity
DeclareAndCast(StepData_UndefinedEntity, und, anent);
if (und.IsNull())
continue;
if (headeronly)
return;
- // Data : Comme Header mais avec des Idents ... sinon le code est le meme
+ // Data: Like Header but with Idents ... otherwise the code is the same
SendData();
- // .... Erreurs Globales (silya) ....
+ // .... Global Errors (if any) ....
Handle(Interface_Check) achglob = themodel->GlobalCheck();
Standard_Integer nbfails = achglob->NbFails();
NewLine(Standard_False);
}
- // .... Sortie des Entites une par une ....
+ // .... Output Entities one by one ....
Standard_Integer nb = themodel->NbEntities();
for (Standard_Integer i = 1; i <= nb; i++)
{
- // Liste principale : on n envoie pas les Entites dans un Scope
- // Elles le seront par l intermediaire du Scope qui les contient
+ // Main list: we don't send Entities that are in a Scope
+ // They will be sent through the Scope that contains them
if (!thescopebeg.IsNull())
{
if (thescopenext->Value(i) != 0)
EndFile();
}
-// .... DECOUPAGE DU FICHIER EN SECTIONS ....
+// .... FILE DIVISION INTO SECTIONS ....
//=================================================================================================
thesect = Standard_False;
}
-// .... ENVOI D UNE ENTITE ....
+// .... SENDING AN ENTITY ....
//=================================================================================================
Handle(Standard_Transient) anent = themodel->Entity(num);
Standard_Integer idnum = num, idtrue = 0;
- // themodel->Number(anent) et-ou IdentLabel(anent)
+ // themodel->Number(anent) and/or IdentLabel(anent)
if (thelabmode > 0)
idtrue = themodel->IdentLabel(anent);
if (thelabmode == 1)
else
sprintf(lident, "%d:#%d = ", idnum, idtrue); // skl 29.01.2003
- // SendIdent repris , lident vient d etre calcule
+ // SendIdent reused, lident has just been calculated
thecurr.Clear();
thecurr.Add(lident);
themult = Standard_False;
- // .... Traitement du Scope Eventuel
+ // .... Processing of Potential Scope
if (!thescopebeg.IsNull())
{
Standard_Integer numin = thescopebeg->Value(num);
}
}
- // .... Envoi de l Entite proprement dite
+ // .... Sending the Entity proper
// Write Entity via Lib
thenum = num;
Standard_Integer CN;
if (themodel->IsRedefinedContent(num))
{
- // Entite Erreur : Ecrire le Contenu + les Erreurs en Commentaires
+ // Error Entity: Write the Content + Errors as Comments
Handle(Interface_ReportEntity) rep = themodel->ReportEntity(num);
DeclareAndCast(StepData_UndefinedEntity, und, rep->Content());
if (und.IsNull())
AddString(") ", 2);
} // thelevel --; }
}
- EndEntity(); // AVANT les Commentaires
+ EndEntity(); // BEFORE Comments
NewLine(Standard_False);
Comment(Standard_True);
if (und.IsNull())
Comment(Standard_False);
NewLine(Standard_False);
- // Cas normal
+ // Normal case
}
else if (lib.Select(anent, module, CN))
{
}
else
{
- // Pas trouve ci-dessus ... tenter UndefinedEntity
+ // Not found above ... try UndefinedEntity
DeclareAndCast(StepData_UndefinedEntity, und, anent);
if (und.IsNull())
return;
}
// ###########################################################################
-// ## ## ## CONSTITUTION DU TEXTE A ENVOYER ## ## ##
+// ## ## ## TEXT CONSTITUTION FOR SENDING ## ## ##
-// Passer a la ligne. Ligne vide pas comptee sauf si evenempty == Standard_True
+// Go to next line. Empty line not counted unless evenempty == Standard_True
//=================================================================================================
thecurr.Clear();
}
-// Regrouper ligne en cours avec precedente; reste en cours sauf si newline
-// == Standard_True, auquel cas on commence une nouvelle ligne
-// Ne fait rien si : total correspondant > StepLong ou debut ou fin d`entite
+// Group current line with previous; remains current except if newline
+// == Standard_True, in which case we start a new line
+// Does nothing if: corresponding total > StepLong or start or end of entity
//=================================================================================================
if (themult)
{
// clang-format off
- if (thelevel != 1) throw Interface_InterfaceMismatch("StepWriter : StartEntity"); // decompte de parentheses mauvais ...
+ if (thelevel != 1) throw Interface_InterfaceMismatch("StepWriter : StartEntity"); // bad parentheses count...
// clang-format on
AddString(textendlist);
AddString(" ", 1); // skl 29.01.2003
AddString(") ", 2);
} // thelevel unchanged
-// .... SendField et ce qui va avec
+// .... SendField and what goes with it
//=================================================================================================
}
switch (kind)
{
- // ici les cas simples; ensuite on caste et on voit
+ // here the simple cases; then we cast and see
case 0:
SendUndef();
break;
if (done)
return;
- // Que reste-t-il : les tableaux ...
+ // What remains: the arrays ...
Standard_Integer arity = fild.Arity();
if (arity == 0)
{
void StepData_StepWriter::SendSelect(const Handle(StepData_SelectMember)& sm,
const Handle(StepData_PDescr)& /*descr*/)
{
- // Cas du SelectMember. Traiter le Select puis la valeur
- // NB : traitement actuel non recursif (pas de SELNAME(SELNAME(..)) )
+ // SelectMember case. Process the Select then the value
+ // NB: current processing non-recursive (no SELNAME(SELNAME(..)) )
Standard_Boolean selname = Standard_False;
if (sm.IsNull())
return; // ??
// end entity ?
}
-// .... Send* de base
+// .... Basic Send* methods
//=================================================================================================
void StepData_StepWriter::CloseSub()
{
AddString(textendlist);
- thefirst = Standard_False; // le parametre suivant une sous-liste n est donc pas 1er
+ thefirst = Standard_False; // the parameter following a sub-list is therefore not first
thelevel--;
}
void StepData_StepWriter::Send(const Standard_Real val)
{
- // Valeur flottante, expurgee de "0000" qui trainent et de "E+00"
+ // Floating point value, cleaned of trailing "0000" and "E+00"
char lval[24] = {};
Standard_Integer lng = thefloatw.Write(val, lval);
AddParam();
- AddString(lval, lng); // gere le format specifique : si besoin est
+ AddString(lval, lng); // handles specific format: if needed
}
-// Send(String) : attention, on envoie un Texte ... donc entre ' '
+// Send(String): note, we send a Text ... so between ' '
//=================================================================================================
//: i2 abv 31 Aug 98: ProSTEP TR9: avoid wrapping text or do it at spaces
- // Attention au depassement des 72 caracteres
+ // Watch out for exceeding 72 characters
if (thecurr.CanGet(aNn))
AddString(aVal, 0);
//: i2
{
if (aNn <= StepLong)
{
- thecurr.Add(aVal); // Ca yet, on a tout epuise
+ thecurr.Add(aVal); // That's it, we've exhausted everything
thecurr.FreezeInitial();
break;
}
return;
}
Standard_Integer num = themodel->Number(val);
- // String ? (si non repertoriee dans le Modele)
+ // String? (if not listed in the Model)
if (num == 0)
{
if (val->IsKind(STANDARD_TYPE(TCollection_HAsciiString)))
Send(TCollection_AsciiString(strval->ToCString()));
return;
}
- // SelectMember ? (toujours, si non repertoriee)
- // mais attention, pas de description attachee
+ // SelectMember? (always, if not listed)
+ // but beware, no description attached
else if (val->IsKind(STANDARD_TYPE(StepData_SelectMember)))
{
DeclareAndCast(StepData_SelectMember, sm, val);
Handle(StepData_PDescr) descr; // null
SendSelect(sm, descr);
}
- // Sinon, PAS NORMAL !
+ // Otherwise, NOT NORMAL!
else
{
thechecks.CCheck(thenum)->AddFail("UnknownReference");
// throw Interface_InterfaceMismatch("StepWriter : Sending Unknown Reference");
}
}
- // Cas normal : une bonne Entite, on envoie son Ident.
+ // Normal case: a good Entity, we send its Ident.
else
{
Standard_Integer idnum = num, idtrue = 0;
SendString(textunknown);
}
-// SendString : attention, on donne l'intitule exact
+// SendString: note, we give the exact label
//=================================================================================================
AddString(val);
}
-// SendString : attention, on donne l'intitule exact
+// SendString: note, we give the exact label
//=================================================================================================
AddString(val, (Standard_Integer)strlen(val));
}
-// SendEnum : attention, on envoie un intitule d'Enum ... donc entre . .
+// SendEnum: note, we send an Enum label ... so between . .
//=================================================================================================
AddString(aValue, 2);
}
-// SendEnum : attention, on envoie un intitule d'Enum ... donc entre . .
+// SendEnum: note, we send an Enum label ... so between . .
//=================================================================================================
AddString(textderived);
}
-// EndEntity : s'il faut mettre ; a la ligne, l'aligner sur debut d'entite ...
+// EndEntity: if we need to put ; on the line, align it with start of entity ...
//=================================================================================================
void StepData_StepWriter::EndEntity()
{
// clang-format off
- if (thelevel != 1) throw Interface_InterfaceMismatch("StepWriter : EndEntity"); // decompte de parentheses mauvais ...
+ if (thelevel != 1) throw Interface_InterfaceMismatch("StepWriter : EndEntity"); // parentheses count is wrong ...
// clang-format on
AddString(textendent);
thelevel = 0; // on garde theindval : sera traite au prochain NewLine
NewLine(Standard_False);
theindent = indent;
themult = Standard_False;
- // pour forcer indentation si necessaire
+ // to force indentation if necessary
}
-// gestion de la ligne courante (cf aussi NewLine/JoinLine)
+// current line management (see also NewLine/JoinLine)
//=================================================================================================
thecurr.Add(astr, lnstr);
}
-// ENVOI FINAL
+// FINAL SENDING
//=================================================================================================