# ApplicationFramework
TKTObj
TObj

# TObj_Model Class Reference

`#include <TObj_Model.hxx>`

## Public Member Functions

Standard_EXPORT void | SetMessenger (const Handle(Message_Messenger)&theMsgr)
| Set messenger to use for messages output.
Standard_EXPORT | Handle (Message_Messenger) Messenger() const
| Get messenger used for messages output (by default, the messenger from application is used).
virtual Standard_EXPORT Standard_Boolean | Load (const char *theFile)
| Load the OCAF model from a file.
virtual Standard_EXPORT Standard_Boolean | SaveAs (const char *theFile)
| Save the model to a file.
Standard_EXPORT Standard_Boolean | Save ()
| Save the model to the same file.
virtual Standard_EXPORT Standard_Boolean | Close ()
| Close the model.
Standard_EXPORT void | CloseDocument (const Handle(TDocStd_Document)&theDoc)
| Close Free OCAF document.
virtual Standard_EXPORT | Handle (TCollection_HAsciiString) GetFile() const
| Returns the full file name this model is to be saved to, or null if the model was not saved yet.
virtual Standard_EXPORT | Handle (TObj_ObjectIterator) GetObjects() const
| Returns an Iterator on all objects in the Model.
virtual Standard_EXPORT | Handle (TObj_ObjectIterator) GetChildren() const
| Returns an Iterator on objects in the main partition.
virtual Standard_EXPORT | Handle (TObj_Object) FindObject(const Handle(TCollection_HExtendedString)&theName
| Returns an Object by given Name (or Null if not found).
virtual Standard_EXPORT const | Handle (TObj_TNameContainer)&theDictionary) const
virtual Standard_EXPORT | Handle (TObj_CheckModel) GetChecker() const
| Returns the tool checking model consistency. Descendant may redefine it to return its own tool.
virtual Standard_EXPORT | Handle (TObj_Object) GetRoot() const
| Returns root object of model.
Standard_EXPORT | Handle (TObj_Partition) GetMainPartition() const
| Returns root object of model.
TDF_Label | GetLabel () const
| Returns OCAF label on which model data are stored.
virtual Standard_EXPORT | Handle (TCollection_HExtendedString) GetModelName() const
| Returns the name of the model.
Standard_EXPORT 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.
Standard_EXPORT 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.
Standard_EXPORT 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.
Standard_EXPORT Standard_Boolean | HasOpenCommand () const
| Returns True if a Command transaction is open Starting, finishing the transaction.
Standard_EXPORT void | OpenCommand () const
| Open a new command transaction.
Standard_EXPORT void | CommitCommand () const
| Commit the Command transaction. Do nothing If there is no Command transaction open.
Standard_EXPORT void | AbortCommand () const
| Abort the Command transaction. Do nothing If there is no Command transaction open.
virtual Standard_EXPORT Standard_Boolean | IsModified () const
| Modification status.
Standard_EXPORT void | SetModified (const Standard_Boolean theModified)
| Sets modification status.
virtual Standard_EXPORT const | Handle (TObj_Application) GetApplication()
| Returns handle to static instance of the relevant application class.
virtual Standard_EXPORT 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.
Standard_EXPORT Standard_Integer | GetFormatVersion () const
| Returns the version of format stored in TObj file.
virtual Standard_EXPORT Standard_Boolean | Update ()
| this method is called before activating this model
virtual Standard_EXPORT Standard_GUID | GetGUID () const
| Defines interface GUID for TObj_Model.
Standard_EXPORT | Handle (TObj_TNameContainer) GetDictionary() const
| Returns the map of names of the objects.
Standard_EXPORT | Handle (TDocStd_Document) GetDocument() const
| Returns OCAF document of Model.
void Standard_EXPORT | SetLabel (const TDF_Label &theLabel)
| Sets OCAF label on which model data are stored. Used by persistence mechanism.
virtual Standard_EXPORT 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.
virtual Standard_EXPORT | Handle (TObj_Model) NewEmpty()=0
| This function have to create a new model with type like me.
Standard_EXPORT void | CopyReferences (const Handle(TObj_Model)&theTarget, const Handle(TDF_RelocationTable)&theRelocTable)
| Copy references from me to the other.

## Static Public Member Functions

static Standard_EXPORT | Handle (TObj_Model) GetDocumentModel(const TDF_Label &theLabel)
| Returns model which contains a document with the label, or NULL handle if label is NULL.
static Standard_EXPORT void | SetNewName (const Handle(TObj_Object)&theObject)
| Sets new unique name for the object.

## 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

Standard_EXPORT | TObj_Model ()
| Empty constructor.
Standard_EXPORT | ~TObj_Model ()
| Destructor closes the model.
virtual Standard_EXPORT Standard_Boolean | checkDocumentEmpty (const char *theFile)
| Check whether the document contains the OCAF data. This implementation checks theFile on NULL only.
Standard_EXPORT void | SetFormatVersion (const Standard_Integer theVersion)
| Sets the format version to save.
Standard_EXPORT | Handle (TObj_Partition) getPartition(const TDF_Label &theLabel
| Returns (or creates a new) partition on a given label.
Standard_EXPORT | Handle (TObj_Partition) getPartition(const TDF_Label &theLabel
| Returns Partition specified by its index number on a given label If not exists, creates anew with specified name.
Standard_EXPORT | Handle (TObj_Partition) getPartition(const Standard_Integer theIndex
| Returns Partition specified by its index number If not exists, creates anew with specified name.
Standard_EXPORT TDF_Label | GetDataLabel () const
| Returns the labels under which the data is stored. the data stored from the third sublabel of this one.
virtual Standard_EXPORT 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.
virtual Standard_EXPORT void | updateBackReferences (const Handle(TObj_Object)&theObject)
| Updates back references of object Recursive method.
virtual Standard_EXPORT 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).

## Protected Attributes

Standard_EXPORT const Standard_Boolean | theHidden = Standard_False) const
Standard_EXPORT const Standard_Integer | theIndex
Standard_EXPORT const Standard_Integer const TCollection_ExtendedString & | theName
Standard_EXPORT const Standard_Integer const TCollection_ExtendedString const Standard_Boolean | theHidden = Standard_False) const
Standard_EXPORT const TCollection_ExtendedString & | theName
Standard_EXPORT const TCollection_ExtendedString const Standard_Boolean | theHidden = Standard_False) const

## Private Member Functions

| Handle (Message_Messenger) myMessenger
| Messenger object.

## Private Attributes

TDF_Label | myLabel
| Root label of the model in OCAF document.

## Detailed Description

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.

## Member Enumeration Documentation

enum TObj_Model::DataTag`[protected]`

Enumeration values:

  DataTag_FormatVersion |
  DataTag_Last |

## Constructor & Destructor Documentation

Standard_EXPORT TObj_Model::TObj_Model | ( |  | ) | `[protected]`

| Constructors and Persistence

Standard_EXPORT TObj_Model::~TObj_Model | ( |  | ) | `[protected]`

## Member Function Documentation

Standard_EXPORT void TObj_Model::AbortCommand | ( |  | ) | const

virtual Standard_EXPORT Standard_Boolean TObj_Model::checkDocumentEmpty | ( | const char * | theFile | ) | `[protected, virtual]`

virtual Standard_EXPORT Standard_Boolean TObj_Model::Close | ( |  | ) | `[virtual]`

| Work with document

Standard_EXPORT void TObj_Model::CloseDocument | ( | const Handle(TDocStd_Document)& | theDoc | ) |

Standard_EXPORT void TObj_Model::CommitCommand | ( |  | ) | const

Standard_EXPORT void TObj_Model::CopyReferences | ( | const Handle(TObj_Model)& | theTarget,
|  | const Handle(TDF_RelocationTable)& | theRelocTable
| ) |

Standard_EXPORT TDF_Label TObj_Model::GetDataLabel | ( |  | ) | const`[protected]`

virtual Standard_EXPORT TCollection_ExtendedString TObj_Model::GetFormat | ( |  | ) | const`[virtual]`

| Methods for obtaining the version of Format

Standard_EXPORT Standard_Integer TObj_Model::GetFormatVersion | ( |  | ) | const

virtual Standard_EXPORT Standard_GUID TObj_Model::GetGUID | ( |  | ) | const`[virtual]`

| Definition of interface GUID

TDF_Label TObj_Model::GetLabel | ( |  | ) | const`[inline]`

| OCAF methods

TObj_Model::Handle | ( | Message_Messenger |  | ) | `[private]`

virtual Standard_EXPORT TObj_Model::Handle | ( | TObj_Model |  | ) | `[pure virtual]`

Standard_EXPORT TObj_Model::Handle | ( | TDocStd_Document |  | ) | const

Standard_EXPORT TObj_Model::Handle | ( | TObj_Partition |  | ) | const`[protected]`

Standard_EXPORT TObj_Model::Handle | ( | TObj_Partition |  | ) | const`[protected]`

Standard_EXPORT TObj_Model::Handle | ( | TObj_Partition |  | ) | const`[protected]`

| Internal methods

Standard_EXPORT TObj_Model::Handle | ( | TObj_TNameContainer |  | ) | const

| Internal methods

virtual Standard_EXPORT const TObj_Model::Handle | ( | TObj_Application |  | ) | `[virtual]`

| Methods for obtaining application

virtual Standard_EXPORT TObj_Model::Handle | ( | TCollection_HExtendedString |  | ) | const`[virtual]`

| Methods for supporting unique naming of the objects in model

Standard_EXPORT TObj_Model::Handle | ( | TObj_Partition |  | ) | const

virtual Standard_EXPORT TObj_Model::Handle | ( | TObj_Object |  | ) | const`[virtual]`

| Methods for iteration on the model

virtual Standard_EXPORT TObj_Model::Handle | ( | TObj_CheckModel |  | ) | const`[virtual]`

virtual Standard_EXPORT const TObj_Model::Handle | ( | TObj_TNameContainer |  | ) | const

virtual Standard_EXPORT TObj_Model::Handle | ( | TObj_Object |  | ) | const`[virtual]`

virtual Standard_EXPORT TObj_Model::Handle | ( | TObj_ObjectIterator |  | ) | const`[virtual]`

virtual Standard_EXPORT TObj_Model::Handle | ( | TObj_ObjectIterator |  | ) | const`[virtual]`

| Access to the objects in the model

virtual Standard_EXPORT TObj_Model::Handle | ( | TCollection_HAsciiString |  | ) | const`[virtual]`

static Standard_EXPORT TObj_Model::Handle | ( | TObj_Model |  | ) | const`[static]`

Standard_EXPORT TObj_Model::Handle | ( | Message_Messenger |  | ) | const`[inline]`

Standard_EXPORT Standard_Boolean TObj_Model::HasOpenCommand | ( |  | ) | const

| API for transaction mechanism

virtual Standard_EXPORT Standard_Boolean TObj_Model::initNewModel | ( | const Standard_Boolean | IsNew | ) | `[protected, virtual]`

virtual Standard_EXPORT Standard_Boolean TObj_Model::IsModified | ( |  | ) | const`[virtual]`

Standard_EXPORT Standard_Boolean TObj_Model::IsRegisteredName | ( | const Handle(TCollection_HExtendedString)& | theName,
|  | const Handle(TObj_TNameContainer)& | theDictionary
| ) | const

virtual Standard_EXPORT Standard_Boolean TObj_Model::isToCheck | ( |  | ) | const`[inline, protected, virtual]`

virtual Standard_EXPORT Standard_Boolean TObj_Model::Load | ( | const char * | theFile | ) | `[virtual]`

| Implementation of Load/Save for OCAF based models

Standard_EXPORT void TObj_Model::OpenCommand | ( |  | ) | const

virtual Standard_EXPORT Standard_Boolean TObj_Model::Paste | ( | Handle(TObj_Model) | theModel,
|  | Handle(TDF_RelocationTable) | theRelocTable = `0`
| ) | `[virtual]`

| Methods for clone model

Standard_EXPORT void TObj_Model::RegisterName | ( | const Handle(TCollection_HExtendedString)& | theName,
|  | const TDF_Label & | theLabel,
|  | const Handle(TObj_TNameContainer)& | theDictionary
| ) | const

Standard_EXPORT Standard_Boolean TObj_Model::Save | ( |  | ) |

virtual Standard_EXPORT Standard_Boolean TObj_Model::SaveAs | ( | const char * | theFile | ) | `[virtual]`

Standard_EXPORT void TObj_Model::SetFormatVersion | ( | const Standard_Integer | theVersion | ) | `[protected]`

| Methods for handling the version of the Format

void Standard_EXPORT TObj_Model::SetLabel | ( | const TDF_Label & | theLabel | ) | `[inline]`

Standard_EXPORT void TObj_Model::SetMessenger | ( | const Handle(Message_Messenger)& | theMsgr | ) | `[inline]`

| Messages mechanism

Standard_EXPORT void TObj_Model::SetModified | ( | const Standard_Boolean | theModified | ) |

static Standard_EXPORT void TObj_Model::SetNewName | ( | const Handle(TObj_Object)& | theObject | ) | `[static]`

Standard_EXPORT void TObj_Model::UnRegisterName | ( | const Handle(TCollection_HExtendedString)& | theName,
|  | const Handle(TObj_TNameContainer)& | theDictionary
| ) | const

virtual Standard_EXPORT Standard_Boolean TObj_Model::Update | ( |  | ) | `[virtual]`

| Methods for updating model

virtual Standard_EXPORT void TObj_Model::updateBackReferences | ( | const Handle(TObj_Object)& | theObject | ) | `[protected, virtual]`

## Field Documentation

TDF_Label TObj_Model::myLabel`[private]`

| Fields

Standard_EXPORT const TCollection_ExtendedString const Standard_Boolean TObj_Model::theHidden = Standard_False) const`[protected]`

Standard_EXPORT const Standard_Integer const TCollection_ExtendedString const Standard_Boolean TObj_Model::theHidden = Standard_False) const`[protected]`

Standard_EXPORT const Standard_Boolean TObj_Model::theHidden = Standard_False) const`[protected]`

Standard_EXPORT const Standard_Integer TObj_Model::theIndex`[protected]`

Standard_EXPORT const TCollection_ExtendedString& TObj_Model::theName`[protected]`

Standard_EXPORT const Standard_Integer const TCollection_ExtendedString& TObj_Model::theName`[protected]`

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

- TObj_Model.hxx