Open CASCADE Technology 7.8.0
Public Member Functions | Protected Member Functions
Interface_FileReaderTool Class Referenceabstract

Defines services which are required to load an InterfaceModel from a File. Typically, it may firstly transform a system file into a FileReaderData object, then work on it, not longer considering file contents, to load an Interface Model. It may also work on a FileReaderData already loaded. More...

#include <Interface_FileReaderTool.hxx>

Inheritance diagram for Interface_FileReaderTool:
Inheritance graph
[legend]

Public Member Functions

void SetData (const Handle< Interface_FileReaderData > &reader, const Handle< Interface_Protocol > &protocol)
 Sets Data to a FileReaderData. Works with a Protocol.
 
Handle< Interface_ProtocolProtocol () const
 Returns the Protocol given at creation time.
 
Handle< Interface_FileReaderDataData () const
 Returns the FileReaderData which is used to work.
 
void SetModel (const Handle< Interface_InterfaceModel > &amodel)
 Stores a Model. Used when the Model has been loaded.
 
Handle< Interface_InterfaceModelModel () const
 Returns the stored Model.
 
void SetMessenger (const Handle< Message_Messenger > &messenger)
 Sets Messenger used for outputting messages.
 
Handle< Message_MessengerMessenger () const
 Returns Messenger used for outputting messages. The returned object is guaranteed to be non-null; default is Message::Messenger().
 
void SetTraceLevel (const Standard_Integer tracelev)
 Sets trace level used for outputting messages.
 
Standard_Integer TraceLevel () const
 Returns trace level used for outputting messages.
 
void SetErrorHandle (const Standard_Boolean err)
 Allows controlling whether exception raisings are handled If err is False, they are not (hence, dbx can take control) If err is True, they are, and they are traced (by putting on messenger Entity's Number and file record num) Default given at Model's creation time is True.
 
Standard_Boolean ErrorHandle () const
 Returns ErrorHandle flag.
 
void SetEntities ()
 Fills records with empty entities; once done, each entity can ask the FileReaderTool for any entity referenced through an identifier. Calls Recognize which is specific to each specific type of FileReaderTool.
 
virtual Standard_Boolean Recognize (const Standard_Integer num, Handle< Interface_Check > &ach, Handle< Standard_Transient > &ent)=0
 Recognizes a record, given its number. Specific to each Interface; called by SetEntities. It can call the basic method RecognizeByLib. Returns False if recognition has failed, True else. <ach> has not to be filled if simply Recognition has failed : it must record true error messages : RecognizeByLib can generate error messages if NewRead is called.
 
Standard_Boolean RecognizeByLib (const Standard_Integer num, Interface_GeneralLib &glib, Interface_ReaderLib &rlib, Handle< Interface_Check > &ach, Handle< Standard_Transient > &ent) const
 Recognizes a record with the help of Libraries. Can be used to implement the method Recognize. <rlib> is used to find Protocol and CaseNumber to apply <glib> performs the creation (by service NewVoid, or NewRead if NewVoid gave no result) <ach> is a check, which is transmitted to NewRead if it is called, gives a result but which is false <ent> is the result Returns False if recognition has failed, True else.
 
Handle< Standard_TransientUnknownEntity () const
 Provides an unknown entity, specific to the Interface called by SetEntities when Recognize has failed (Unknown alone) or by LoadModel when an Entity has caused a Fail on reading (to keep at least its literal description) Uses Protocol to do it.
 
Handle< Interface_InterfaceModelNewModel () const
 Creates an empty Model of the norm. Uses Protocol to do it.
 
void LoadModel (const Handle< Interface_InterfaceModel > &amodel)
 Reads and fills Entities from the FileReaderData set by SetData to an InterfaceModel. It enchains required operations, the specific ones correspond to deferred methods (below) to be defined for each Norm. It manages also error recovery and trace. Remark : it calls SetModel. It Can raise any error which can occur during a load operation, unless Error Handling is set. This method can also be redefined if judged necessary.
 
Handle< Standard_TransientLoadedEntity (const Standard_Integer num)
 Reads, Fills and Returns one Entity read from a Record of the FileReaderData. This Method manages also case of Fail or Warning, by producing a ReportEntyty plus , for a Fail, a literal Content (as an UnknownEntity). Performs also Trace.
 
virtual void BeginRead (const Handle< Interface_InterfaceModel > &amodel)=0
 Fills model's header; each Interface defines for its Model its own file header; this method fills it from FileReaderTool.+ It is called by AnalyseFile from InterfaceModel.
 
virtual Standard_Boolean AnalyseRecord (const Standard_Integer num, const Handle< Standard_Transient > &anent, Handle< Interface_Check > &acheck)=0
 Fills an Entity, given record no; specific to each Interface, called by AnalyseFile from InterfaceModel (which manages its calling arguments) To work, each Interface can define a method in its proper Transient class, like this (given as an example) : AnalyseRecord (me : mutable; FR : in out FileReaderTool; num : Integer; acheck : in out Check) returns Boolean; and call it from AnalyseRecord.
 
virtual ~Interface_FileReaderTool ()
 
virtual void EndRead (const Handle< Interface_InterfaceModel > &amodel)
 Ends file reading after reading all the entities default is doing nothing; redefinable as necessary.
 
void Clear ()
 Clear fields.
 

Protected Member Functions

 Interface_FileReaderTool ()
 Constructor; sets default fields.
 

Detailed Description

Defines services which are required to load an InterfaceModel from a File. Typically, it may firstly transform a system file into a FileReaderData object, then work on it, not longer considering file contents, to load an Interface Model. It may also work on a FileReaderData already loaded.

FileReaderTool provides, on one hand, some general services which are common to all read operations but can be redefined, plus general actions to be performed specifically for each Norm, as deferred methods to define.

In particular, FileReaderTool defines the Interface's Unknown and Error entities

Constructor & Destructor Documentation

◆ ~Interface_FileReaderTool()

virtual Interface_FileReaderTool::~Interface_FileReaderTool ( )
virtual

◆ Interface_FileReaderTool()

Interface_FileReaderTool::Interface_FileReaderTool ( )
protected

Constructor; sets default fields.

Member Function Documentation

◆ AnalyseRecord()

virtual Standard_Boolean Interface_FileReaderTool::AnalyseRecord ( const Standard_Integer  num,
const Handle< Standard_Transient > &  anent,
Handle< Interface_Check > &  acheck 
)
pure virtual

Fills an Entity, given record no; specific to each Interface, called by AnalyseFile from InterfaceModel (which manages its calling arguments) To work, each Interface can define a method in its proper Transient class, like this (given as an example) : AnalyseRecord (me : mutable; FR : in out FileReaderTool; num : Integer; acheck : in out Check) returns Boolean; and call it from AnalyseRecord.

Returned Value : True if the entity could be loaded, False else (in case of syntactic fail)

Implemented in IGESData_IGESReaderTool, and StepData_StepReaderTool.

◆ BeginRead()

virtual void Interface_FileReaderTool::BeginRead ( const Handle< Interface_InterfaceModel > &  amodel)
pure virtual

Fills model's header; each Interface defines for its Model its own file header; this method fills it from FileReaderTool.+ It is called by AnalyseFile from InterfaceModel.

Implemented in IGESData_IGESReaderTool, and StepData_StepReaderTool.

◆ Clear()

void Interface_FileReaderTool::Clear ( )

Clear fields.

◆ Data()

Handle< Interface_FileReaderData > Interface_FileReaderTool::Data ( ) const

Returns the FileReaderData which is used to work.

◆ EndRead()

virtual void Interface_FileReaderTool::EndRead ( const Handle< Interface_InterfaceModel > &  amodel)
virtual

Ends file reading after reading all the entities default is doing nothing; redefinable as necessary.

Reimplemented in IGESData_IGESReaderTool, and StepData_StepReaderTool.

◆ ErrorHandle()

Standard_Boolean Interface_FileReaderTool::ErrorHandle ( ) const

Returns ErrorHandle flag.

◆ LoadedEntity()

Handle< Standard_Transient > Interface_FileReaderTool::LoadedEntity ( const Standard_Integer  num)

Reads, Fills and Returns one Entity read from a Record of the FileReaderData. This Method manages also case of Fail or Warning, by producing a ReportEntyty plus , for a Fail, a literal Content (as an UnknownEntity). Performs also Trace.

◆ LoadModel()

void Interface_FileReaderTool::LoadModel ( const Handle< Interface_InterfaceModel > &  amodel)

Reads and fills Entities from the FileReaderData set by SetData to an InterfaceModel. It enchains required operations, the specific ones correspond to deferred methods (below) to be defined for each Norm. It manages also error recovery and trace. Remark : it calls SetModel. It Can raise any error which can occur during a load operation, unless Error Handling is set. This method can also be redefined if judged necessary.

◆ Messenger()

Handle< Message_Messenger > Interface_FileReaderTool::Messenger ( ) const

Returns Messenger used for outputting messages. The returned object is guaranteed to be non-null; default is Message::Messenger().

◆ Model()

Handle< Interface_InterfaceModel > Interface_FileReaderTool::Model ( ) const

Returns the stored Model.

◆ NewModel()

Handle< Interface_InterfaceModel > Interface_FileReaderTool::NewModel ( ) const

Creates an empty Model of the norm. Uses Protocol to do it.

◆ Protocol()

Handle< Interface_Protocol > Interface_FileReaderTool::Protocol ( ) const

Returns the Protocol given at creation time.

◆ Recognize()

virtual Standard_Boolean Interface_FileReaderTool::Recognize ( const Standard_Integer  num,
Handle< Interface_Check > &  ach,
Handle< Standard_Transient > &  ent 
)
pure virtual

Recognizes a record, given its number. Specific to each Interface; called by SetEntities. It can call the basic method RecognizeByLib. Returns False if recognition has failed, True else. <ach> has not to be filled if simply Recognition has failed : it must record true error messages : RecognizeByLib can generate error messages if NewRead is called.

Note that it works thru a Recognizer (method Evaluate) which has to be memorized before starting

Implemented in IGESData_IGESReaderTool, and StepData_StepReaderTool.

◆ RecognizeByLib()

Standard_Boolean Interface_FileReaderTool::RecognizeByLib ( const Standard_Integer  num,
Interface_GeneralLib glib,
Interface_ReaderLib rlib,
Handle< Interface_Check > &  ach,
Handle< Standard_Transient > &  ent 
) const

Recognizes a record with the help of Libraries. Can be used to implement the method Recognize. <rlib> is used to find Protocol and CaseNumber to apply <glib> performs the creation (by service NewVoid, or NewRead if NewVoid gave no result) <ach> is a check, which is transmitted to NewRead if it is called, gives a result but which is false <ent> is the result Returns False if recognition has failed, True else.

◆ SetData()

void Interface_FileReaderTool::SetData ( const Handle< Interface_FileReaderData > &  reader,
const Handle< Interface_Protocol > &  protocol 
)

Sets Data to a FileReaderData. Works with a Protocol.

◆ SetEntities()

void Interface_FileReaderTool::SetEntities ( )

Fills records with empty entities; once done, each entity can ask the FileReaderTool for any entity referenced through an identifier. Calls Recognize which is specific to each specific type of FileReaderTool.

◆ SetErrorHandle()

void Interface_FileReaderTool::SetErrorHandle ( const Standard_Boolean  err)

Allows controlling whether exception raisings are handled If err is False, they are not (hence, dbx can take control) If err is True, they are, and they are traced (by putting on messenger Entity's Number and file record num) Default given at Model's creation time is True.

◆ SetMessenger()

void Interface_FileReaderTool::SetMessenger ( const Handle< Message_Messenger > &  messenger)

Sets Messenger used for outputting messages.

◆ SetModel()

void Interface_FileReaderTool::SetModel ( const Handle< Interface_InterfaceModel > &  amodel)

Stores a Model. Used when the Model has been loaded.

◆ SetTraceLevel()

void Interface_FileReaderTool::SetTraceLevel ( const Standard_Integer  tracelev)

Sets trace level used for outputting messages.

  • 0: no trace at all
  • 1: errors
  • 2: errors and warnings
  • 3: all messages Default is 1 : Errors traced

◆ TraceLevel()

Standard_Integer Interface_FileReaderTool::TraceLevel ( ) const

Returns trace level used for outputting messages.

◆ UnknownEntity()

Handle< Standard_Transient > Interface_FileReaderTool::UnknownEntity ( ) const

Provides an unknown entity, specific to the Interface called by SetEntities when Recognize has failed (Unknown alone) or by LoadModel when an Entity has caused a Fail on reading (to keep at least its literal description) Uses Protocol to do it.


The documentation for this class was generated from the following file: