Open CASCADE Technology  7.7.0
Public Member Functions | Protected Member Functions
IFSelect_WorkLibrary Class Referenceabstract

This class defines the (empty) frame which can be used to enrich a XSTEP set with new capabilities In particular, a specific WorkLibrary must give the way for Reading a File into a Model, and Writing a Model to a File Thus, it is possible to define several Work Libraries for each norm, but recommended to define one general class for each one : this general class will define the Read and Write methods. More...

#include <IFSelect_WorkLibrary.hxx>

Inheritance diagram for IFSelect_WorkLibrary:
Inheritance graph
[legend]

Public Member Functions

virtual Standard_Integer ReadFile (const Standard_CString name, Handle< Interface_InterfaceModel > &model, const Handle< Interface_Protocol > &protocol) const =0
 Gives the way to Read a File and transfer it to a Model <mod> is the resulting Model, which has to be created by this method. In case of error, <mod> must be returned Null Return value is a status with free values. Simply, 0 is for "Execution OK" The Protocol can be used to work (e.g. create the Model, read and recognize the Entities) More...
 
virtual Standard_Integer ReadStream (const Standard_CString theName, std::istream &theIStream, Handle< Interface_InterfaceModel > &model, const Handle< Interface_Protocol > &protocol) const
 Interface to read a data from the specified stream. More...
 
virtual Standard_Boolean WriteFile (IFSelect_ContextWrite &ctx) const =0
 Gives the way to Write a File from a Model. <ctx> contains all necessary information : the model, the protocol, the file name, and the list of File Modifiers to be applied, also with restricted list of selected entities for each one, if required. In return, it brings the produced check-list. More...
 
virtual Standard_Boolean CopyModel (const Handle< Interface_InterfaceModel > &original, const Handle< Interface_InterfaceModel > &newmodel, const Interface_EntityIterator &list, Interface_CopyTool &TC) const
 Performs the copy of entities from an original model to a new one. It must also copy headers if any. Returns True when done. The provided default works by copying the individual entities designated in the list, by using the general service class CopyTool. It can be redefined for a norm which, either implements Copy by another way (do not forget to Bind each copied result with its original entity in TC) and returns True, or does not know how to copy and returns False. More...
 
virtual void DumpEntity (const Handle< Interface_InterfaceModel > &model, const Handle< Interface_Protocol > &protocol, const Handle< Standard_Transient > &entity, Standard_OStream &S, const Standard_Integer level) const =0
 Gives the way of dumping an entity under a form comprehensive for each norm. <model> helps to identify, number ... entities. <level> is to be interpreted for each norm (because of the formats which can be very different) More...
 
void DumpEntity (const Handle< Interface_InterfaceModel > &model, const Handle< Interface_Protocol > &protocol, const Handle< Standard_Transient > &entity, Standard_OStream &S) const
 Calls deferred DumpEntity with the recorded default level. More...
 
void SetDumpLevels (const Standard_Integer def, const Standard_Integer max)
 Records a default level and a maximum value for level level for DumpEntity can go between 0 and <max> default value will be <def> More...
 
void DumpLevels (Standard_Integer &def, Standard_Integer &max) const
 Returns the recorded default and maximum dump levels If none was recorded, max is returned negative, def as zero. More...
 
void SetDumpHelp (const Standard_Integer level, const Standard_CString help)
 Records a short line of help for a level (0 - max) More...
 
Standard_CString DumpHelp (const Standard_Integer level) const
 Returns the help line recorded for <level>, or an empty string. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Protected Member Functions

 IFSelect_WorkLibrary ()
 Required to initialise fields. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Detailed Description

This class defines the (empty) frame which can be used to enrich a XSTEP set with new capabilities In particular, a specific WorkLibrary must give the way for Reading a File into a Model, and Writing a Model to a File Thus, it is possible to define several Work Libraries for each norm, but recommended to define one general class for each one : this general class will define the Read and Write methods.

Also a Dump service is provided, it can produce, according the norm, either a parcel of a file for an entity, or any other kind of information relevant for the norm,

Constructor & Destructor Documentation

◆ IFSelect_WorkLibrary()

IFSelect_WorkLibrary::IFSelect_WorkLibrary ( )
protected

Required to initialise fields.

Member Function Documentation

◆ CopyModel()

virtual Standard_Boolean IFSelect_WorkLibrary::CopyModel ( const Handle< Interface_InterfaceModel > &  original,
const Handle< Interface_InterfaceModel > &  newmodel,
const Interface_EntityIterator list,
Interface_CopyTool TC 
) const
virtual

Performs the copy of entities from an original model to a new one. It must also copy headers if any. Returns True when done. The provided default works by copying the individual entities designated in the list, by using the general service class CopyTool. It can be redefined for a norm which, either implements Copy by another way (do not forget to Bind each copied result with its original entity in TC) and returns True, or does not know how to copy and returns False.

Reimplemented in StepSelect_WorkLibrary.

◆ DumpEntity() [1/2]

virtual void IFSelect_WorkLibrary::DumpEntity ( const Handle< Interface_InterfaceModel > &  model,
const Handle< Interface_Protocol > &  protocol,
const Handle< Standard_Transient > &  entity,
Standard_OStream S,
const Standard_Integer  level 
) const
pure virtual

Gives the way of dumping an entity under a form comprehensive for each norm. <model> helps to identify, number ... entities. <level> is to be interpreted for each norm (because of the formats which can be very different)

Implemented in StepSelect_WorkLibrary, and IGESSelect_WorkLibrary.

◆ DumpEntity() [2/2]

void IFSelect_WorkLibrary::DumpEntity ( const Handle< Interface_InterfaceModel > &  model,
const Handle< Interface_Protocol > &  protocol,
const Handle< Standard_Transient > &  entity,
Standard_OStream S 
) const

Calls deferred DumpEntity with the recorded default level.

◆ DumpHelp()

Standard_CString IFSelect_WorkLibrary::DumpHelp ( const Standard_Integer  level) const

Returns the help line recorded for <level>, or an empty string.

◆ DumpLevels()

void IFSelect_WorkLibrary::DumpLevels ( Standard_Integer def,
Standard_Integer max 
) const

Returns the recorded default and maximum dump levels If none was recorded, max is returned negative, def as zero.

◆ ReadFile()

virtual Standard_Integer IFSelect_WorkLibrary::ReadFile ( const Standard_CString  name,
Handle< Interface_InterfaceModel > &  model,
const Handle< Interface_Protocol > &  protocol 
) const
pure virtual

Gives the way to Read a File and transfer it to a Model <mod> is the resulting Model, which has to be created by this method. In case of error, <mod> must be returned Null Return value is a status with free values. Simply, 0 is for "Execution OK" The Protocol can be used to work (e.g. create the Model, read and recognize the Entities)

Implemented in StepSelect_WorkLibrary, and IGESSelect_WorkLibrary.

◆ ReadStream()

virtual Standard_Integer IFSelect_WorkLibrary::ReadStream ( const Standard_CString  theName,
std::istream &  theIStream,
Handle< Interface_InterfaceModel > &  model,
const Handle< Interface_Protocol > &  protocol 
) const
virtual

Interface to read a data from the specified stream.

Parameters
modelis the resulting Model, which has to be created by this method. In case of error, model must be returned Null Return value is a status: 0 - OK, 1 - read failure, -1 - stream failure.

Default implementation returns 1 (error).

Reimplemented in StepSelect_WorkLibrary.

◆ SetDumpHelp()

void IFSelect_WorkLibrary::SetDumpHelp ( const Standard_Integer  level,
const Standard_CString  help 
)

Records a short line of help for a level (0 - max)

◆ SetDumpLevels()

void IFSelect_WorkLibrary::SetDumpLevels ( const Standard_Integer  def,
const Standard_Integer  max 
)

Records a default level and a maximum value for level level for DumpEntity can go between 0 and <max> default value will be <def>

◆ WriteFile()

virtual Standard_Boolean IFSelect_WorkLibrary::WriteFile ( IFSelect_ContextWrite ctx) const
pure virtual

Gives the way to Write a File from a Model. <ctx> contains all necessary information : the model, the protocol, the file name, and the list of File Modifiers to be applied, also with restricted list of selected entities for each one, if required. In return, it brings the produced check-list.

The WorkLibrary has to query <applied> to get then run the ContextWrite by looping like this (example) : for (numap = 1; numap <= ctx.NbModifiers(); numap ++) { ctx.SetModifier (numap); cast ctx.FileModifier() to specific type -> variable filemod if (!filemod.IsNull()) filemod->Perform (ctx,writer); filemod then works with ctx. It can, either act on the model itself (for instance on its header), or iterate on selected entities (Start/Next/More/Value) it can call AddFail or AddWarning, as necessary }

Implemented in StepSelect_WorkLibrary, and IGESSelect_WorkLibrary.


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