Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes
Interface_CopyTool Class Reference

Performs Deep Copies of sets of Entities Allows to perform Copy of Interface Entities from a Model to another one. Works by calling general services GetFromAnother and GetImplied. Uses a CopyMap to bind a unique Result to each Copied Entity. More...

#include <Interface_CopyTool.hxx>

Inheritance diagram for Interface_CopyTool:
Inheritance graph
[legend]

Public Member Functions

 Interface_CopyTool (const occ::handle< Interface_InterfaceModel > &amodel, const Interface_GeneralLib &lib)
 Creates a CopyTool adapted to work from a Model. Works with a General Service Library, given as an argument.
 
 Interface_CopyTool (const occ::handle< Interface_InterfaceModel > &amodel, const occ::handle< Interface_Protocol > &protocol)
 Same as above, but Library is defined through a Protocol.
 
 Interface_CopyTool (const occ::handle< Interface_InterfaceModel > &amodel)
 Same as above, but works with the Active Protocol.
 
occ::handle< Interface_InterfaceModelModel () const
 Returns the Model on which the CopyTool works.
 
void SetControl (const occ::handle< Interface_CopyControl > &othermap)
 Changes the Map of Result for another one. This allows to work with a more sophisticated Mapping Control than the Standard one which is CopyMap (e.g. TransferProcess from Transfer)
 
occ::handle< Interface_CopyControlControl () const
 Returns the object used for Control.
 
virtual void Clear ()
 Clears Transfer List. Gets Ready to begin another Transfer.
 
virtual bool Copy (const occ::handle< Standard_Transient > &entfrom, occ::handle< Standard_Transient > &entto, const bool mapped, const bool errstat)
 Creates the CounterPart of an Entity (by ShallowCopy), Binds it, then Copies the content of the former Entity to the other one (same Type), by call to the General Service Library It may command the Copy of Referenced Entities Then, its returns True.
 
occ::handle< Standard_TransientTransferred (const occ::handle< Standard_Transient > &ent)
 Transfers one Entity, if not yet bound to a result Remark : For an Entity which is reported in the Starting Model, the ReportEntity will also be copied with its Content if it has one (at least ShallowCopy; Complete Copy if the Protocol recognizes the Content : see method Copy)
 
void Bind (const occ::handle< Standard_Transient > &ent, const occ::handle< Standard_Transient > &res)
 Defines a Result for the Transfer of a Starting object. Used by method Transferred (which performs a normal Copy), but can also be called to enforce a result : in the latter case, the enforced result must be compatible with the other Transfers which are performed.
 
bool Search (const occ::handle< Standard_Transient > &ent, occ::handle< Standard_Transient > &res) const
 Search for the result of a Starting Object (i.e. an Entity) Returns True if a Result is Bound (and fills "result") Returns False if no result is Bound.
 
void ClearLastFlags ()
 Clears LastFlags only. This allows to know what Entities are copied after its call (see method LastCopiedAfter). It can be used when copies are done by increments, which must be distinguished. ClearLastFlags is also called by Clear.
 
int LastCopiedAfter (const int numfrom, occ::handle< Standard_Transient > &ent, occ::handle< Standard_Transient > &res) const
 Returns an copied Entity and its Result which were operated after last call to ClearLastFlags. It returns the first "Last Copied Entity" which Number follows <numfrom>, Zero if none. It is used in a loop as follow : Integer num = 0; while ( (num = CopyTool.LastCopiedAfter(num,ent,res)) ) { .. Process Starting <ent> and its Result <res> }.
 
void TransferEntity (const occ::handle< Standard_Transient > &ent)
 Transfers one Entity and records result into the Transfer List Calls method Transferred.
 
void RenewImpliedRefs ()
 Renews the Implied References. These References do not involve Copying of referenced Entities. For such a Reference, if the Entity which defines it AND the referenced Entity are both copied, then this Reference is renewed. Else it is deleted in the copied Entities. Remark : this concerns only some specific references, such as "back pointers".
 
void FillModel (const occ::handle< Interface_InterfaceModel > &bmodel)
 Fills a Model with the result of the transfer (TransferList) Commands copy of Header too, and calls RenewImpliedRefs.
 
Interface_EntityIterator CompleteResult (const bool withreports=false) const
 Returns the complete list of copied Entities If <withreports> is given True, the entities which were reported in the Starting Model are replaced in the list by the copied ReportEntities.
 
Interface_EntityIterator RootResult (const bool withreports=false) const
 Returns the list of Root copied Entities (those which were asked for copy by the user of CopyTool, not by copying another Entity)
 
virtual ~Interface_CopyTool ()
 

Protected Member Functions

virtual bool NewVoid (const occ::handle< Standard_Transient > &entfrom, occ::handle< Standard_Transient > &entto)
 Creates a new void instance (just created) of the same class as <entfrom>. Uses the general service GeneralModule:NewVoid Returns True if OK (Recognize has succeeded), False else (in such a case, the standard method ShallowCopy is called to produce <ento> from <entfrom> : hence it is not void)
 

Protected Attributes

Interface_GeneralLib thelib
 

Detailed Description

Performs Deep Copies of sets of Entities Allows to perform Copy of Interface Entities from a Model to another one. Works by calling general services GetFromAnother and GetImplied. Uses a CopyMap to bind a unique Result to each Copied Entity.

It is possible to command Copies of Entities (and those they reference) by call to the General Service Library, or to enforce results for transfer of some Entities (calling Bind)

A Same CopyTool can be used for several successive Copies from the same Model : either by restarting from scratch (e.g. to copy different parts of a starting Model to several Targets), or incremental : in that case, it is possible to know what is the content of the last increment (defined by last call to ClearLastFlags and queried by call to LastCopiedAfter)

Works in two times : first, create the list of copied Entities second, pushes them to a target Model (manages also Model's Header) or returns the Result as an Iterator, as desired

The core action (Copy) works by using ShallowCopy (method attached to each class) and Copy from GeneralLib (itself using dedicated tools). It can be redefined for specific actions.

Constructor & Destructor Documentation

◆ Interface_CopyTool() [1/3]

Interface_CopyTool::Interface_CopyTool ( const occ::handle< Interface_InterfaceModel > & amodel,
const Interface_GeneralLib & lib )

Creates a CopyTool adapted to work from a Model. Works with a General Service Library, given as an argument.

◆ Interface_CopyTool() [2/3]

Interface_CopyTool::Interface_CopyTool ( const occ::handle< Interface_InterfaceModel > & amodel,
const occ::handle< Interface_Protocol > & protocol )

Same as above, but Library is defined through a Protocol.

◆ Interface_CopyTool() [3/3]

Interface_CopyTool::Interface_CopyTool ( const occ::handle< Interface_InterfaceModel > & amodel)

Same as above, but works with the Active Protocol.

◆ ~Interface_CopyTool()

virtual Interface_CopyTool::~Interface_CopyTool ( )
virtual

Member Function Documentation

◆ Bind()

void Interface_CopyTool::Bind ( const occ::handle< Standard_Transient > & ent,
const occ::handle< Standard_Transient > & res )

Defines a Result for the Transfer of a Starting object. Used by method Transferred (which performs a normal Copy), but can also be called to enforce a result : in the latter case, the enforced result must be compatible with the other Transfers which are performed.

◆ Clear()

virtual void Interface_CopyTool::Clear ( )
virtual

Clears Transfer List. Gets Ready to begin another Transfer.

◆ ClearLastFlags()

void Interface_CopyTool::ClearLastFlags ( )

Clears LastFlags only. This allows to know what Entities are copied after its call (see method LastCopiedAfter). It can be used when copies are done by increments, which must be distinguished. ClearLastFlags is also called by Clear.

◆ CompleteResult()

Interface_EntityIterator Interface_CopyTool::CompleteResult ( const bool withreports = false) const

Returns the complete list of copied Entities If <withreports> is given True, the entities which were reported in the Starting Model are replaced in the list by the copied ReportEntities.

◆ Control()

occ::handle< Interface_CopyControl > Interface_CopyTool::Control ( ) const

Returns the object used for Control.

◆ Copy()

virtual bool Interface_CopyTool::Copy ( const occ::handle< Standard_Transient > & entfrom,
occ::handle< Standard_Transient > & entto,
const bool mapped,
const bool errstat )
virtual

Creates the CounterPart of an Entity (by ShallowCopy), Binds it, then Copies the content of the former Entity to the other one (same Type), by call to the General Service Library It may command the Copy of Referenced Entities Then, its returns True.

If <mapped> is True, the Map is used to store the Result Else, the Result is simply produced : it can be used to Copy internal sub-parts of Entities, which are not intended to be shared (Strings, Arrays, etc...) If <errstat> is True, this means that the Entity is recorded in the Model as Erroneous : in this case, the General Service for Deep Copy is not called (this could be dangerous) : hence the Counter-Part is produced but empty, it can be referenced.

This method does nothing and returns False if the Protocol does not recognize <ent>. It basically makes a Deep Copy without changing the Types. It can be redefined for special uses.

Reimplemented in Transfer_TransferDispatch.

◆ FillModel()

void Interface_CopyTool::FillModel ( const occ::handle< Interface_InterfaceModel > & bmodel)

Fills a Model with the result of the transfer (TransferList) Commands copy of Header too, and calls RenewImpliedRefs.

◆ LastCopiedAfter()

int Interface_CopyTool::LastCopiedAfter ( const int numfrom,
occ::handle< Standard_Transient > & ent,
occ::handle< Standard_Transient > & res ) const

Returns an copied Entity and its Result which were operated after last call to ClearLastFlags. It returns the first "Last Copied Entity" which Number follows <numfrom>, Zero if none. It is used in a loop as follow : Integer num = 0; while ( (num = CopyTool.LastCopiedAfter(num,ent,res)) ) { .. Process Starting <ent> and its Result <res> }.

◆ Model()

occ::handle< Interface_InterfaceModel > Interface_CopyTool::Model ( ) const

Returns the Model on which the CopyTool works.

◆ NewVoid()

virtual bool Interface_CopyTool::NewVoid ( const occ::handle< Standard_Transient > & entfrom,
occ::handle< Standard_Transient > & entto )
protectedvirtual

Creates a new void instance (just created) of the same class as <entfrom>. Uses the general service GeneralModule:NewVoid Returns True if OK (Recognize has succeeded), False else (in such a case, the standard method ShallowCopy is called to produce <ento> from <entfrom> : hence it is not void)

No mapping is managed by this method

◆ RenewImpliedRefs()

void Interface_CopyTool::RenewImpliedRefs ( )

Renews the Implied References. These References do not involve Copying of referenced Entities. For such a Reference, if the Entity which defines it AND the referenced Entity are both copied, then this Reference is renewed. Else it is deleted in the copied Entities. Remark : this concerns only some specific references, such as "back pointers".

◆ RootResult()

Interface_EntityIterator Interface_CopyTool::RootResult ( const bool withreports = false) const

Returns the list of Root copied Entities (those which were asked for copy by the user of CopyTool, not by copying another Entity)

◆ Search()

bool Interface_CopyTool::Search ( const occ::handle< Standard_Transient > & ent,
occ::handle< Standard_Transient > & res ) const

Search for the result of a Starting Object (i.e. an Entity) Returns True if a Result is Bound (and fills "result") Returns False if no result is Bound.

◆ SetControl()

void Interface_CopyTool::SetControl ( const occ::handle< Interface_CopyControl > & othermap)

Changes the Map of Result for another one. This allows to work with a more sophisticated Mapping Control than the Standard one which is CopyMap (e.g. TransferProcess from Transfer)

◆ TransferEntity()

void Interface_CopyTool::TransferEntity ( const occ::handle< Standard_Transient > & ent)

Transfers one Entity and records result into the Transfer List Calls method Transferred.

◆ Transferred()

occ::handle< Standard_Transient > Interface_CopyTool::Transferred ( const occ::handle< Standard_Transient > & ent)

Transfers one Entity, if not yet bound to a result Remark : For an Entity which is reported in the Starting Model, the ReportEntity will also be copied with its Content if it has one (at least ShallowCopy; Complete Copy if the Protocol recognizes the Content : see method Copy)

Field Documentation

◆ thelib

Interface_GeneralLib Interface_CopyTool::thelib
protected

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