Open CASCADE Technology
7.3.0
|
#include <TObj_Model.hxx>
Public Member Functions | |
void | SetMessenger (const Handle< Message_Messenger > &theMsgr) |
Set messenger to use for messages output. More... | |
Handle< Message_Messenger > | Messenger () const |
Get messenger used for messages output (by default, the messenger from application is used) More... | |
virtual Standard_Boolean | Load (const TCollection_ExtendedString &theFile) |
Load the OCAF model from a file. If the filename is empty or file does not exists, it just initializes model by empty data. More... | |
virtual Standard_Boolean | SaveAs (const TCollection_ExtendedString &theFile) |
Save the model to a file. More... | |
Standard_Boolean | Save () |
Save the model to the same file. More... | |
virtual Standard_Boolean | Close () |
Close the model. More... | |
void | CloseDocument (const Handle< TDocStd_Document > &theDoc) |
Close Free OCAF document. More... | |
virtual Handle< TCollection_HExtendedString > | GetFile () const |
Returns the full file name this model is to be saved to, or null if the model was not saved yet. More... | |
virtual Handle< TObj_ObjectIterator > | GetObjects () const |
Returns an Iterator on all objects in the Model. More... | |
virtual Handle< TObj_ObjectIterator > | GetChildren () const |
Returns an Iterator on objects in the main partition. More... | |
virtual Handle< TObj_Object > | FindObject (const Handle< TCollection_HExtendedString > &theName, const Handle< TObj_TNameContainer > &theDictionary) const |
Returns an Object by given Name (or Null if not found). More... | |
virtual Handle< TObj_CheckModel > | GetChecker () const |
Returns the tool checking model consistency. Descendant may redefine it to return its own tool. More... | |
virtual Handle< TObj_Object > | GetRoot () const |
Returns root object of model. More... | |
Handle< TObj_Partition > | GetMainPartition () const |
Returns root object of model. More... | |
TDF_Label | GetLabel () const |
Returns OCAF label on which model data are stored. More... | |
virtual Handle< TCollection_HExtendedString > | GetModelName () const |
Returns the name of the model. More... | |
Standard_Boolean | IsRegisteredName (const Handle< TCollection_HExtendedString > &theName, const Handle< TObj_TNameContainer > &theDictionary) const |
Returns True is name is registered in the names map The input argument may be NULL handle, then model check in own global container. More... | |
void | RegisterName (const Handle< TCollection_HExtendedString > &theName, const TDF_Label &theLabel, const Handle< TObj_TNameContainer > &theDictionary) const |
Register name in the map The input argument may be NULL handle, then model check in own global container. More... | |
void | UnRegisterName (const Handle< TCollection_HExtendedString > &theName, const Handle< TObj_TNameContainer > &theDictionary) const |
Unregisters name from the map The input argument may be NULL handle, then model check in own global container. More... | |
Standard_Boolean | HasOpenCommand () const |
Returns True if a Command transaction is open Starting, finishing the transaction. More... | |
void | OpenCommand () const |
Open a new command transaction. More... | |
void | CommitCommand () const |
Commit the Command transaction. Do nothing If there is no Command transaction open. More... | |
void | AbortCommand () const |
Abort the Command transaction. Do nothing If there is no Command transaction open. More... | |
virtual Standard_Boolean | IsModified () const |
Modification status. More... | |
void | SetModified (const Standard_Boolean theModified) |
Sets modification status. More... | |
virtual const Handle< TObj_Application > | GetApplication () |
Returns handle to static instance of the relevant application class. More... | |
virtual TCollection_ExtendedString | GetFormat () const |
Returns the format for save/restore. This implementation returns "BinOcaf". The method should be redefined for those models that should use another format. More... | |
Standard_Integer | GetFormatVersion () const |
Returns the version of format stored in TObj file. More... | |
virtual Standard_Boolean | Update () |
this method is called before activating this model More... | |
virtual Standard_GUID | GetGUID () const |
Defines interface GUID for TObj_Model. More... | |
Handle< TObj_TNameContainer > | GetDictionary () const |
Returns the map of names of the objects. More... | |
Handle< TDocStd_Document > | GetDocument () const |
Returns OCAF document of Model. More... | |
void | SetLabel (const TDF_Label &theLabel) |
Sets OCAF label on which model data are stored. Used by persistence mechanism. More... | |
virtual Standard_Boolean | Paste (Handle< TObj_Model > theModel, Handle< TDF_RelocationTable > theRelocTable=0) |
Pastes me to the new model references will not be copied if theRelocTable is not 0 if theRelocTable is not NULL theRelocTable is filled by objects. More... | |
virtual Handle< TObj_Model > | NewEmpty ()=0 |
This function have to create a new model with type like me. More... | |
void | CopyReferences (const Handle< TObj_Model > &theTarget, const Handle< TDF_RelocationTable > &theRelocTable) |
Copy references from me to the other. More... | |
Public Member Functions inherited from Standard_Transient | |
Standard_Transient () | |
Empty constructor. More... | |
Standard_Transient (const Standard_Transient &) | |
Copy constructor – does nothing. More... | |
Standard_Transient & | operator= (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_Transient * | This () 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... | |
Static Public Member Functions | |
static Handle< TObj_Model > | GetDocumentModel (const TDF_Label &theLabel) |
Returns model which contains a document with the label, or NULL handle if label is NULL. More... | |
static void | SetNewName (const Handle< TObj_Object > &theObject) |
Sets new unique name for the 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... | |
Protected Types | |
enum | DataTag { DataTag_FormatVersion = TObj_Partition::DataTag_Last, DataTag_Last } |
Model may store some data on the data labels of its main partition See TObj_Object for. More... | |
Protected Member Functions | |
TObj_Model () | |
Empty constructor. More... | |
~TObj_Model () | |
Destructor closes the model. More... | |
virtual Standard_Boolean | checkDocumentEmpty (const TCollection_ExtendedString &theFile) |
Check whether the document contains the OCAF data. More... | |
void | SetFormatVersion (const Standard_Integer theVersion) |
Sets the format version to save. More... | |
Handle< TObj_Partition > | getPartition (const TDF_Label &theLabel, const Standard_Boolean theHidden=Standard_False) const |
Returns (or creates a new) partition on a given label. More... | |
Handle< TObj_Partition > | getPartition (const TDF_Label &theLabel, const Standard_Integer theIndex, const TCollection_ExtendedString &theName, const Standard_Boolean theHidden=Standard_False) const |
Returns Partition specified by its index number on a given label If not exists, creates anew with specified name. More... | |
Handle< TObj_Partition > | getPartition (const Standard_Integer theIndex, const TCollection_ExtendedString &theName, const Standard_Boolean theHidden=Standard_False) const |
Returns Partition specified by its index number If not exists, creates anew with specified name. More... | |
TDF_Label | GetDataLabel () const |
Returns the labels under which the data is stored. the data stored from the third sublabel of this one. More... | |
virtual Standard_Boolean | initNewModel (const Standard_Boolean IsNew) |
Do the necessary initialisations after creation of a new model. This function is called by LoadModel after creation of OCAF document and setting myModel on its main label. Default implementation does nothing. Returns True is model sucsesfully initialized. More... | |
virtual void | updateBackReferences (const Handle< TObj_Object > &theObject) |
Updates back references of object Recursive method. More... | |
virtual Standard_Boolean | isToCheck () const |
Returns boolean value is to check model in Init new model The check could be useful if version of model changed Default implementation returns FALSE (check turned OFF) More... | |
Additional Inherited Members | |
Public Types inherited from Standard_Transient | |
typedef void | base_type |
Returns a type descriptor about this object. More... | |
Base class for OCAF based models. Defines common behaviour for all models based on TObject classes, basic services to access model objects and common operations with the model. Provides default implementation for many methods.
|
protected |
Model may store some data on the data labels of its main partition See TObj_Object for.
Enumerator | |
---|---|
DataTag_FormatVersion | |
DataTag_Last |
|
protected |
Empty constructor.
Constructors and Persistence
|
protected |
Destructor closes the model.
void TObj_Model::AbortCommand | ( | ) | const |
Abort the Command transaction. Do nothing If there is no Command transaction open.
|
protectedvirtual |
Check whether the document contains the OCAF data.
|
virtual |
Close the model.
Work with document
void TObj_Model::CloseDocument | ( | const Handle< TDocStd_Document > & | theDoc | ) |
Close Free OCAF document.
void TObj_Model::CommitCommand | ( | ) | const |
Commit the Command transaction. Do nothing If there is no Command transaction open.
void TObj_Model::CopyReferences | ( | const Handle< TObj_Model > & | theTarget, |
const Handle< TDF_RelocationTable > & | theRelocTable | ||
) |
Copy references from me to the other.
|
virtual |
Returns an Object by given Name (or Null if not found).
|
virtual |
Returns handle to static instance of the relevant application class.
Methods for obtaining application
|
virtual |
Returns the tool checking model consistency. Descendant may redefine it to return its own tool.
|
virtual |
Returns an Iterator on objects in the main partition.
|
protected |
Returns the labels under which the data is stored. the data stored from the third sublabel of this one.
Handle< TObj_TNameContainer > TObj_Model::GetDictionary | ( | ) | const |
Returns the map of names of the objects.
Internal methods
Handle< TDocStd_Document > TObj_Model::GetDocument | ( | ) | const |
Returns OCAF document of Model.
|
static |
Returns model which contains a document with the label, or NULL handle if label is NULL.
|
virtual |
Returns the full file name this model is to be saved to, or null if the model was not saved yet.
|
virtual |
Returns the format for save/restore. This implementation returns "BinOcaf". The method should be redefined for those models that should use another format.
Methods for obtaining the version of Format
Standard_Integer TObj_Model::GetFormatVersion | ( | ) | const |
Returns the version of format stored in TObj file.
|
virtual |
Defines interface GUID for TObj_Model.
Definition of interface GUID
|
inline |
Returns OCAF label on which model data are stored.
OCAF methods
Handle< TObj_Partition > TObj_Model::GetMainPartition | ( | ) | const |
Returns root object of model.
|
virtual |
Returns the name of the model.
Methods for supporting unique naming of the objects in model
|
virtual |
Returns an Iterator on all objects in the Model.
Access to the objects in the model
|
protected |
Returns (or creates a new) partition on a given label.
Internal methods
|
protected |
Returns Partition specified by its index number on a given label If not exists, creates anew with specified name.
|
protected |
Returns Partition specified by its index number If not exists, creates anew with specified name.
|
virtual |
Returns root object of model.
Methods for iteration on the model
Standard_Boolean TObj_Model::HasOpenCommand | ( | ) | const |
Returns True if a Command transaction is open Starting, finishing the transaction.
API for transaction mechanism
|
protectedvirtual |
Do the necessary initialisations after creation of a new model. This function is called by LoadModel after creation of OCAF document and setting myModel on its main label. Default implementation does nothing. Returns True is model sucsesfully initialized.
|
virtual |
Modification status.
Standard_Boolean TObj_Model::IsRegisteredName | ( | const Handle< TCollection_HExtendedString > & | theName, |
const Handle< TObj_TNameContainer > & | theDictionary | ||
) | const |
Returns True is name is registered in the names map The input argument may be NULL handle, then model check in own global container.
|
inlineprotectedvirtual |
Returns boolean value is to check model in Init new model The check could be useful if version of model changed Default implementation returns FALSE (check turned OFF)
|
virtual |
Load the OCAF model from a file. If the filename is empty or file does not exists, it just initializes model by empty data.
Implementation of Load/Save for OCAF based models
|
inline |
Get messenger used for messages output (by default, the messenger from application is used)
|
pure virtual |
This function have to create a new model with type like me.
void TObj_Model::OpenCommand | ( | ) | const |
Open a new command transaction.
|
virtual |
Pastes me to the new model references will not be copied if theRelocTable is not 0 if theRelocTable is not NULL theRelocTable is filled by objects.
Methods for clone model
void TObj_Model::RegisterName | ( | const Handle< TCollection_HExtendedString > & | theName, |
const TDF_Label & | theLabel, | ||
const Handle< TObj_TNameContainer > & | theDictionary | ||
) | const |
Register name in the map The input argument may be NULL handle, then model check in own global container.
Standard_Boolean TObj_Model::Save | ( | ) |
Save the model to the same file.
|
virtual |
Save the model to a file.
|
protected |
Sets the format version to save.
Methods for handling the version of the Format
|
inline |
Sets OCAF label on which model data are stored. Used by persistence mechanism.
|
inline |
Set messenger to use for messages output.
Messages mechanism
void TObj_Model::SetModified | ( | const Standard_Boolean | theModified | ) |
Sets modification status.
|
static |
Sets new unique name for the object.
void TObj_Model::UnRegisterName | ( | const Handle< TCollection_HExtendedString > & | theName, |
const Handle< TObj_TNameContainer > & | theDictionary | ||
) | const |
Unregisters name from the map The input argument may be NULL handle, then model check in own global container.
|
virtual |
this method is called before activating this model
Methods for updating model
|
protectedvirtual |
Updates back references of object Recursive method.