OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    TObj_Application Class Reference

    This is a base class for OCAF based TObj models with declared virtual methods. More...

    #include <TObj_Application.hxx>

    Inheritance diagram for TObj_Application:

    Public Member Functions

    occ::handle< Message_Messenger > & Messenger ()
     Returns reference to associated messenger handle.
    virtual bool SaveDocument (const occ::handle< TDocStd_Document > &theSourceDoc, const TCollection_ExtendedString &theTargetFile)
     Saving the OCAF document to a file.
    virtual bool SaveDocument (const occ::handle< TDocStd_Document > &theSourceDoc, Standard_OStream &theOStream)
     Saving the OCAF document to a stream.
    virtual bool LoadDocument (const TCollection_ExtendedString &theSourceFile, occ::handle< TDocStd_Document > &theTargetDoc)
     Loading the OCAF document from a file.
    virtual bool LoadDocument (Standard_IStream &theIStream, occ::handle< TDocStd_Document > &theTargetDoc)
     Loading the OCAF document from a stream.
    virtual bool CreateNewDocument (occ::handle< TDocStd_Document > &theDoc, const TCollection_ExtendedString &theFormat)
     Create the OCAF document from scratch.
    virtual void ErrorMessage (const TCollection_ExtendedString &theMsg, const Message_Gravity theLevel)
     Signal error during Load or Save Default imiplementation is empty.
    virtual void ErrorMessage (const TCollection_ExtendedString &theMsg)
     Signal error during Load or Save Default imiplementation invoke previous declaration with 0.
    void SetVerbose (const bool isVerbose)
     Sets the verbose flag, meaning that load/save models should show CPU and elapsed times.
    bool IsVerbose () const
     Returns the verbose flag.
    void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
     Dumps the content of me into the stream.
    const char * ResourcesName () override
     Return name of resource (i.e. "TObj").
    Public Member Functions inherited from TDocStd_Application
     TDocStd_Application ()
     Constructs the new instance and registers it in CDM_Session.
    bool IsDriverLoaded () const
     Check if meta data driver was successfully loaded by the application constructor.
    occ::handle< Resource_ManagerResources () override
     Returns resource manager defining supported persistent formats.
    void DefineFormat (const TCollection_AsciiString &theFormat, const TCollection_AsciiString &theDescription, const TCollection_AsciiString &theExtension, const occ::handle< PCDM_RetrievalDriver > &theReader, const occ::handle< PCDM_StorageDriver > &theWriter)
     Sets up resources and registers read and storage drivers for the specified format.
    void ReadingFormats (NCollection_Sequence< TCollection_AsciiString > &theFormats)
     Returns the sequence of reading formats supported by the application.
    void WritingFormats (NCollection_Sequence< TCollection_AsciiString > &theFormats)
     Returns the sequence of writing formats supported by the application.
    int NbDocuments () const
     returns the number of documents handled by the current applicative session.
    occ::handle< TDocStd_DocumentGetDocument (const int indexindex) const
     Returns the document at the given 1-based index. The index is any integer between 1 and NbDocuments().
    void GetDocument (const int indexindex, occ::handle< TDocStd_Document > &aDoc) const
    void NewDocument (const TCollection_ExtendedString &formatformat, occ::handle< CDM_Document > &aDoc) override
     Constructs the empty new document aDoc. This document will have the format format. If InitDocument is redefined for a specific application, the new document is handled by the applicative session.
    void NewDocument (const TCollection_ExtendedString &formatformat, occ::handle< TDocStd_Document > &aDoc)
     A non-virtual method taking a TDocStd_Documment object as an input. Internally it calls a virtual method NewDocument() with CDM_Document object.
    void InitDocument (const occ::handle< CDM_Document > &aDoc) const override
     Initialize the document aDoc for the applicative session. This virtual function is called by NewDocument and is to be redefined for each specific application.
    void Close (const occ::handle< TDocStd_Document > &aDoc)
     Close the given document. the document is not any more handled by the applicative session.
    int IsInSession (const TCollection_ExtendedString &pathpath) const
     Returns an index for the document found in the path path in this applicative session. If the returned value is 0, the document is not present in the applicative session. This method can be used for the interactive part of an application. For instance, on a call to Open, the document to be opened may already be in memory. IsInSession checks to see if this is the case. Open can be made to depend on the value of the index returned: if IsInSession returns 0, the document is opened; if it returns another value, a message is displayed asking the user if he wants to override the version of the document in memory. Example: int insession = A->IsInSession(aDoc); if (insession > 0) { std::cout << "document " << insession << " is already in session" << std::endl; return 0; }.
    PCDM_ReaderStatus Open (const TCollection_ExtendedString &thePath, occ::handle< TDocStd_Document > &theDoc, const occ::handle< PCDM_ReaderFilter > &theFilter, const Message_ProgressRange &theRange=Message_ProgressRange())
     Retrieves the document from specified file. In order not to override a version of the document which is already in memory, this method can be made to depend on the value returned by IsInSession.
    PCDM_ReaderStatus Open (const TCollection_ExtendedString &thePath, occ::handle< TDocStd_Document > &theDoc, const Message_ProgressRange &theRange=Message_ProgressRange())
     Retrieves the document from specified file. In order not to override a version of the document which is already in memory, this method can be made to depend on the value returned by IsInSession.
    PCDM_ReaderStatus Open (Standard_IStream &theIStream, occ::handle< TDocStd_Document > &theDoc, const occ::handle< PCDM_ReaderFilter > &theFilter, const Message_ProgressRange &theRange=Message_ProgressRange())
     Retrieves document from standard stream.
    PCDM_ReaderStatus Open (Standard_IStream &theIStream, occ::handle< TDocStd_Document > &theDoc, const Message_ProgressRange &theRange=Message_ProgressRange())
     Retrieves document from standard stream.
    PCDM_StoreStatus SaveAs (const occ::handle< TDocStd_Document > &theDoc, const TCollection_ExtendedString &pathpath, const Message_ProgressRange &theRange=Message_ProgressRange())
     Save the active document in the file <name> in the path <path>. overwrites the file if it already exists.
    PCDM_StoreStatus SaveAs (const occ::handle< TDocStd_Document > &theDoc, Standard_OStream &theOStream, const Message_ProgressRange &theRange=Message_ProgressRange())
     Save theDoc to standard SEEKABLE stream theOStream. the stream should support SEEK functionality.
    PCDM_StoreStatus Save (const occ::handle< TDocStd_Document > &theDoc, const Message_ProgressRange &theRange=Message_ProgressRange())
     Save aDoc active document. Exceptions: Standard_NotImplemented if the document was not retrieved in the applicative session by using Open.
    PCDM_StoreStatus SaveAs (const occ::handle< TDocStd_Document > &theDoc, const TCollection_ExtendedString &pathpath, TCollection_ExtendedString &theStatusMessage, const Message_ProgressRange &theRange=Message_ProgressRange())
     Save the active document in the file <name> in the path <path>. overwrite the file if it already exists.
    PCDM_StoreStatus SaveAs (const occ::handle< TDocStd_Document > &theDoc, Standard_OStream &theOStream, TCollection_ExtendedString &theStatusMessage, const Message_ProgressRange &theRange=Message_ProgressRange())
     Save theDoc TO standard SEEKABLE stream theOStream. the stream should support SEEK functionality.
    PCDM_StoreStatus Save (const occ::handle< TDocStd_Document > &theDoc, TCollection_ExtendedString &theStatusMessage, const Message_ProgressRange &theRange=Message_ProgressRange())
     Save the document overwriting the previous file.
    virtual void OnOpenTransaction (const occ::handle< TDocStd_Document > &theDoc)
     Notification that is fired at each OpenTransaction event.
    virtual void OnCommitTransaction (const occ::handle< TDocStd_Document > &theDoc)
     Notification that is fired at each CommitTransaction event.
    virtual void OnAbortTransaction (const occ::handle< TDocStd_Document > &theDoc)
     Notification that is fired at each AbortTransaction event.
    void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
     Dumps the content of me into the stream.
    Public Member Functions inherited from CDF_Application
    void Open (const occ::handle< CDM_Document > &aDocument)
     puts the document in the current session directory and calls the virtual method Activate on it.
    CDM_CanCloseStatus CanClose (const occ::handle< CDM_Document > &aDocument)
    void Close (const occ::handle< CDM_Document > &aDocument)
     removes the document of the current session directory and closes the document;
    occ::handle< CDM_DocumentRetrieve (const TCollection_ExtendedString &aFolder, const TCollection_ExtendedString &aName, const bool UseStorageConfiguration=true, const occ::handle< PCDM_ReaderFilter > &theFilter=occ::handle< PCDM_ReaderFilter >(), const Message_ProgressRange &theRange=Message_ProgressRange())
     This method retrieves a document from the database. If the Document references other documents which have been updated, the latest version of these documents will be used if {UseStorageConfiguration} is true. The content of {aFolder}, {aName} and {aVersion} depends on the Database Manager system. If the DBMS is only based on the OS, {aFolder} is a directory and {aName} is the name of a file. In this case the use of the syntax with {aVersion} has no sense. For example:
    occ::handle< CDM_DocumentRetrieve (const TCollection_ExtendedString &aFolder, const TCollection_ExtendedString &aName, const TCollection_ExtendedString &aVersion, const bool UseStorageConfiguration=true, const occ::handle< PCDM_ReaderFilter > &theFilter=occ::handle< PCDM_ReaderFilter >(), const Message_ProgressRange &theRange=Message_ProgressRange())
     This method retrieves a document from the database. If the Document references other documents which have been updated, the latest version of these documents will be used if {UseStorageConfiguration} is true. If the DBMS is only based on the OS, this syntax should not be used.
    PCDM_ReaderStatus CanRetrieve (const TCollection_ExtendedString &theFolder, const TCollection_ExtendedString &theName, const bool theAppendMode)
    PCDM_ReaderStatus CanRetrieve (const TCollection_ExtendedString &theFolder, const TCollection_ExtendedString &theName, const TCollection_ExtendedString &theVersion, const bool theAppendMode)
    PCDM_ReaderStatus GetRetrieveStatus () const
     Checks status after Retrieve.
    void Read (Standard_IStream &theIStream, occ::handle< CDM_Document > &theDocument, const occ::handle< PCDM_ReaderFilter > &theFilter=occ::handle< PCDM_ReaderFilter >(), const Message_ProgressRange &theRange=Message_ProgressRange())
     Reads theDocument from standard SEEKABLE stream theIStream, the stream should support SEEK functionality.
    virtual occ::handle< PCDM_ReaderReaderFromFormat (const TCollection_ExtendedString &aFormat)
     Returns instance of read driver for specified format.
    virtual occ::handle< PCDM_StorageDriverWriterFromFormat (const TCollection_ExtendedString &aFormat)
     Returns instance of storage driver for specified format.
    bool Format (const TCollection_ExtendedString &aFileName, TCollection_ExtendedString &theFormat)
     try to retrieve a Format directly in the file or in application resource by using extension. returns True if found
    const char16_t * DefaultFolder ()
    bool SetDefaultFolder (const char16_t *const aFolder)
    occ::handle< CDF_MetaDataDriverMetaDataDriver () const
     returns MetaDatdDriver of this application
    Public Member Functions inherited from CDM_Application
    virtual occ::handle< Message_MessengerMessageDriver ()
     Returns default messenger;.
    virtual void BeginOfUpdate (const occ::handle< CDM_Document > &aDocument)
     this method is called before the update of a document. By default, writes in MessageDriver().
    virtual void EndOfUpdate (const occ::handle< CDM_Document > &aDocument, const bool theStatus, const TCollection_ExtendedString &ErrorString)
     this method is called after the update of a document. By default, writes in MessageDriver().
    void Write (const char16_t *const aString)
     writes the string in the application MessagerDriver.
    virtual TCollection_ExtendedString Name () const
     Returns the application name.
    virtual TCollection_AsciiString Version () const
     Returns the application version.
    virtual NCollection_DataMap< TCollection_ExtendedString, occ::handle< CDM_MetaData > > & MetaDataLookUpTable ()
     Returns MetaData LookUpTable.
    void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
     Dumps the content of me into the stream.
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transientoperator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool 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.
    bool IsKind (const char *const 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.
    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.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Static Public Member Functions

    static occ::handle< TObj_ApplicationGetInstance ()
     Returns static instance of the application.
    Static Public Member Functions inherited from CDF_Application
    static occ::handle< CDF_ApplicationLoad (const Standard_GUID &aGUID)
     plugs an application.
    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.

    Protected Member Functions

     TObj_Application ()
     Constructor is protected. Use method GetInstance() method to obtain the static instance of the object (or derive your own application).
    void SetError (const PCDM_StoreStatus theStatus, const TCollection_ExtendedString &theInfo)
     Sets an error occurred on storage of a document.
    void SetError (const PCDM_ReaderStatus theStatus, const TCollection_ExtendedString &theInfo)
     Sets an error occurred on reading of a document.
    Protected Member Functions inherited from CDF_Application
     CDF_Application ()
    Protected Member Functions inherited from CDM_Application
     CDM_Application ()
    void SetDocumentVersion (const occ::handle< CDM_Document > &aDocument, const occ::handle< CDM_MetaData > &aMetaData) const
    void SetReferenceCounter (const occ::handle< CDM_Document > &aDocument, const int aReferenceCounter)

    Additional Inherited Members

    typedef void base_type
     Returns a type descriptor about this object.
    Data Fields inherited from CDF_Application
    occ::handle< CDF_MetaDataDrivermyMetaDataDriver
    occ::handle< CDF_DirectorymyDirectory
    Protected Attributes inherited from TDocStd_Application
    occ::handle< Resource_ManagermyResources
    bool myIsDriverLoaded
    Protected Attributes inherited from CDF_Application
    PCDM_ReaderStatus myRetrievableStatus
    NCollection_IndexedDataMap< TCollection_ExtendedString, occ::handle< PCDM_RetrievalDriver > > myReaders
    NCollection_IndexedDataMap< TCollection_ExtendedString, occ::handle< PCDM_StorageDriver > > myWriters

    Detailed Description

    This is a base class for OCAF based TObj models with declared virtual methods.

    Constructor & Destructor Documentation

    ◆ TObj_Application()

    TObj_Application::TObj_Application ( )
    protected

    Constructor is protected. Use method GetInstance() method to obtain the static instance of the object (or derive your own application).

    Constructor

    Member Function Documentation

    ◆ CreateNewDocument()

    virtual bool TObj_Application::CreateNewDocument ( occ::handle< TDocStd_Document > & theDoc,
    const TCollection_ExtendedString & theFormat )
    virtual

    Create the OCAF document from scratch.

    ◆ DumpJson()

    void TObj_Application::DumpJson ( Standard_OStream & theOStream,
    int theDepth = -1 ) const

    Dumps the content of me into the stream.

    ◆ ErrorMessage() [1/2]

    virtual void TObj_Application::ErrorMessage ( const TCollection_ExtendedString & theMsg)
    inlinevirtual

    Signal error during Load or Save Default imiplementation invoke previous declaration with 0.

    ◆ ErrorMessage() [2/2]

    virtual void TObj_Application::ErrorMessage ( const TCollection_ExtendedString & theMsg,
    const Message_Gravity theLevel )
    virtual

    Signal error during Load or Save Default imiplementation is empty.

    ◆ GetInstance()

    occ::handle< TObj_Application > TObj_Application::GetInstance ( )
    static

    Returns static instance of the application.

    ◆ IsVerbose()

    bool TObj_Application::IsVerbose ( ) const
    inline

    Returns the verbose flag.

    ◆ LoadDocument() [1/2]

    virtual bool TObj_Application::LoadDocument ( const TCollection_ExtendedString & theSourceFile,
    occ::handle< TDocStd_Document > & theTargetDoc )
    virtual

    Loading the OCAF document from a file.

    ◆ LoadDocument() [2/2]

    virtual bool TObj_Application::LoadDocument ( Standard_IStream & theIStream,
    occ::handle< TDocStd_Document > & theTargetDoc )
    virtual

    Loading the OCAF document from a stream.

    ◆ Messenger()

    occ::handle< Message_Messenger > & TObj_Application::Messenger ( )
    inline

    Returns reference to associated messenger handle.

    ◆ ResourcesName()

    const char * TObj_Application::ResourcesName ( )
    overridevirtual

    Return name of resource (i.e. "TObj").

    Redefined OCAF methods

    Reimplemented from TDocStd_Application.

    ◆ SaveDocument() [1/2]

    virtual bool TObj_Application::SaveDocument ( const occ::handle< TDocStd_Document > & theSourceDoc,
    const TCollection_ExtendedString & theTargetFile )
    virtual

    Saving the OCAF document to a file.

    Load/Save support

    ◆ SaveDocument() [2/2]

    virtual bool TObj_Application::SaveDocument ( const occ::handle< TDocStd_Document > & theSourceDoc,
    Standard_OStream & theOStream )
    virtual

    Saving the OCAF document to a stream.

    ◆ SetError() [1/2]

    void TObj_Application::SetError ( const PCDM_ReaderStatus theStatus,
    const TCollection_ExtendedString & theInfo )
    protected

    Sets an error occurred on reading of a document.

    ◆ SetError() [2/2]

    void TObj_Application::SetError ( const PCDM_StoreStatus theStatus,
    const TCollection_ExtendedString & theInfo )
    protected

    Sets an error occurred on storage of a document.

    ◆ SetVerbose()

    void TObj_Application::SetVerbose ( const bool isVerbose)
    inline

    Sets the verbose flag, meaning that load/save models should show CPU and elapsed times.


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