mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
59
src/CDM/CDM.cdl
Executable file
59
src/CDM/CDM.cdl
Executable file
@@ -0,0 +1,59 @@
|
||||
-- File: CDM.cdl
|
||||
-- Created: Tue May 6 10:39:52 1997
|
||||
-- Author: Jean-Louis Frenkel, Remi Lequette
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
package CDM
|
||||
|
||||
|
||||
uses TCollection,TColStd,Resource
|
||||
|
||||
is
|
||||
|
||||
enumeration CanCloseStatus is CCS_OK, CCS_NotOpen, CCS_UnstoredReferenced,CCS_ModifiedReferenced,CCS_ReferenceRejection
|
||||
end CanCloseStatus from CDM;
|
||||
|
||||
|
||||
class MetaData;
|
||||
|
||||
deferred class MessageDriver;
|
||||
|
||||
deferred class Document;
|
||||
|
||||
class ReferenceIterator;
|
||||
|
||||
class NullMessageDriver;
|
||||
---Purpose: a MessageDriver that writes nowhere.
|
||||
|
||||
class COutMessageDriver;
|
||||
---Purpose: aMessageDriver for output to COUT (only ASCII strings)
|
||||
|
||||
---Category: classes to manager automatic naming of documents.
|
||||
|
||||
private alias NamesDirectory is DataMapOfStringInteger from TColStd;
|
||||
---Purpose: this map will allows to get a directory object from a name.
|
||||
|
||||
private class PresentationDirectory instantiates DataMap from TCollection
|
||||
---Purpose: this map will allows to get a directory object from a name.
|
||||
(ExtendedString from TCollection,
|
||||
Document from CDM,
|
||||
ExtendedString from TCollection);
|
||||
|
||||
private pointer DocumentPointer to Document from CDM;
|
||||
private class Reference;
|
||||
|
||||
private class ListOfReferences instantiates List from TCollection(Reference from CDM);
|
||||
deferred class Application;
|
||||
|
||||
private class MetaDataLookUpTable instantiates DataMap from TCollection(ExtendedString from TCollection, MetaData from CDM, ExtendedString from TCollection);
|
||||
|
||||
|
||||
---Category: reusable classes
|
||||
|
||||
class DocumentHasher instantiates MapHasher from TCollection(Document from CDM);
|
||||
class MapOfDocument instantiates Map from TCollection(Document from CDM, DocumentHasher from CDM);
|
||||
class ListOfDocument instantiates List from TCollection(Document from CDM);
|
||||
class StackOfDocument instantiates Stack from TCollection(Document from CDM);
|
||||
|
||||
end CDM;
|
62
src/CDM/CDM_Application.cdl
Executable file
62
src/CDM/CDM_Application.cdl
Executable file
@@ -0,0 +1,62 @@
|
||||
-- File: CDM_Application.cdl
|
||||
-- Created: Wed Oct 22 15:05:47 1997
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copy: Matra Datavision 1997
|
||||
|
||||
deferred class Application from CDM inherits Transient from Standard
|
||||
|
||||
uses Document from CDM,
|
||||
MetaData from CDM,
|
||||
Reference from CDM,
|
||||
MessageDriver from CDM,
|
||||
Manager from Resource,
|
||||
ExtendedString from TCollection
|
||||
is
|
||||
|
||||
Retrieve(me: mutable; aMetaData: MetaData from CDM; UseStorageConfiguration: Boolean from Standard)
|
||||
returns mutable Document from CDM
|
||||
is deferred private;
|
||||
|
||||
|
||||
DocumentVersion(me: mutable; aMetaData: MetaData from CDM)
|
||||
returns Integer from Standard
|
||||
is deferred private;
|
||||
---Purpose: returns -1 if the metadata has no modification counter.
|
||||
|
||||
SetDocumentVersion(me; aDocument: Document from CDM; aMetaData: MetaData from CDM)
|
||||
is protected;
|
||||
|
||||
SetReferenceCounter(me:mutable ; aDocument: Document from CDM; aReferenceCounter: Integer from Standard)
|
||||
is protected;
|
||||
|
||||
Resources(me: mutable)
|
||||
returns Manager from Resource
|
||||
is deferred;
|
||||
---Purpose: the manager returned by this virtual method will be
|
||||
-- used to search for Format`.Retrieval resource items.
|
||||
--
|
||||
|
||||
MessageDriver(me: mutable) returns MessageDriver from CDM
|
||||
is virtual;
|
||||
---Purpose: By default returns a NullMessageDriver;
|
||||
|
||||
BeginOfUpdate(me:mutable; aDocument: Document from CDM)
|
||||
is virtual;
|
||||
---Purpose: this method is called before the update of a document.
|
||||
-- By default, writes in MessageDriver().
|
||||
|
||||
EndOfUpdate(me:mutable; aDocument: Document from CDM; Status: Boolean from Standard; ErrorString: ExtendedString from TCollection)
|
||||
is virtual;
|
||||
---Purpose: this method is called affter the update of a document.
|
||||
-- By default, writes in MessageDriver().
|
||||
|
||||
Write(me: mutable; aString: ExtString from Standard);
|
||||
---Purpose: writes the string in the application MessagerDriver.
|
||||
|
||||
friends
|
||||
|
||||
class Reference from CDM,
|
||||
class MetaData from CDM
|
||||
|
||||
end Application from CDM;
|
86
src/CDM/CDM_Application.cxx
Executable file
86
src/CDM/CDM_Application.cxx
Executable file
@@ -0,0 +1,86 @@
|
||||
// File: CDM_Application.cxx
|
||||
// Created: Wed Oct 22 16:58:01 1997
|
||||
// Author: Jean-Louis Frenkel
|
||||
// <rmi@frilox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <CDM_Application.ixx>
|
||||
#include <CDM_NullMessageDriver.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDocumentVersion
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void CDM_Application::SetDocumentVersion
|
||||
(const Handle(CDM_Document)& aDocument,
|
||||
const Handle(CDM_MetaData)& aMetaData) const
|
||||
{
|
||||
aDocument->SetModifications(aMetaData->DocumentVersion(this));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetReferenceCounter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void CDM_Application::SetReferenceCounter
|
||||
(const Handle(CDM_Document)& aDocument,
|
||||
const Standard_Integer aReferenceCounter)
|
||||
{
|
||||
aDocument->SetReferenceCounter(aReferenceCounter);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MessageDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(CDM_MessageDriver) CDM_Application::MessageDriver()
|
||||
{
|
||||
static Handle(CDM_NullMessageDriver) theMessageDriver
|
||||
=new CDM_NullMessageDriver;
|
||||
return theMessageDriver;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void CDM_Application::Write(const Standard_ExtString aString)
|
||||
{
|
||||
MessageDriver()->Write(aString);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BeginOfUpdate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void CDM_Application::BeginOfUpdate (const Handle(CDM_Document)& aDocument)
|
||||
{
|
||||
TCollection_ExtendedString updating("Updating:");
|
||||
updating+=aDocument->Presentation();
|
||||
Write(updating.ToExtString());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : EndOfUpdate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void CDM_Application::EndOfUpdate
|
||||
(const Handle(CDM_Document)& aDocument,
|
||||
const Standard_Boolean Status,
|
||||
const TCollection_ExtendedString& /*ErrorString*/)
|
||||
{
|
||||
TCollection_ExtendedString message;
|
||||
if (Status)
|
||||
message="Updated:";
|
||||
else
|
||||
message="Error during updating:";
|
||||
|
||||
message+=aDocument->Presentation();
|
||||
Write(message.ToExtString());
|
||||
}
|
11
src/CDM/CDM_COutMessageDriver.cdl
Executable file
11
src/CDM/CDM_COutMessageDriver.cdl
Executable file
@@ -0,0 +1,11 @@
|
||||
-- File: CDM_COutMessageDriver.cdl
|
||||
-- Created: Thu Aug 30 15:48:11 2001
|
||||
-- Author: Alexander GRIGORIEV
|
||||
--Copyright: Open Cascade 2001
|
||||
|
||||
class COutMessageDriver from CDM inherits MessageDriver from CDM
|
||||
|
||||
is
|
||||
Write (me:mutable; aString: ExtString from Standard);
|
||||
|
||||
end COutMessageDriver from CDM;
|
38
src/CDM/CDM_COutMessageDriver.cxx
Executable file
38
src/CDM/CDM_COutMessageDriver.cxx
Executable file
@@ -0,0 +1,38 @@
|
||||
// File: CDM_COutMessageDriver.cxx
|
||||
// Created: Thu Aug 30 15:50:11 2001
|
||||
// Author: Alexander GRIGORIEV
|
||||
// Copyright: Open Cascade 2001
|
||||
// History:
|
||||
|
||||
#include <CDM_COutMessageDriver.ixx>
|
||||
#include <Standard_PCharacter.hxx>
|
||||
//=======================================================================
|
||||
//function : Write
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void CDM_COutMessageDriver::Write (const Standard_ExtString aString)
|
||||
{
|
||||
// Find the length of the input string
|
||||
Standard_ExtCharacter aChar = aString[0];
|
||||
Standard_Integer aLength = 0;
|
||||
while (aChar) {
|
||||
if (IsAnAscii(aChar) == Standard_False)
|
||||
return;
|
||||
aChar = aString [++aLength];
|
||||
}
|
||||
|
||||
// Copy the input string to ASCII buffer
|
||||
Standard_PCharacter anAsciiString = new Standard_Character [aLength+2];
|
||||
Standard_Integer anI = 0;
|
||||
while (anI < aLength) {
|
||||
anAsciiString[anI] = Standard_Character (aString[anI]);
|
||||
++ anI;
|
||||
}
|
||||
anAsciiString[anI+0] = '\n';
|
||||
anAsciiString[anI+1] = '\0';
|
||||
|
||||
// Output
|
||||
cout << anAsciiString << flush;
|
||||
delete anAsciiString;
|
||||
}
|
521
src/CDM/CDM_Document.cdl
Executable file
521
src/CDM/CDM_Document.cdl
Executable file
@@ -0,0 +1,521 @@
|
||||
-- File: Document_Document.cdl
|
||||
-- Created: Wed Jul 30 08:45:22 1997
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
deferred class Document from CDM
|
||||
|
||||
inherits Transient from Standard
|
||||
|
||||
---Purpose: An applicative document is an instance of a class inheriting CDM_Document.
|
||||
-- These documents have the following properties:
|
||||
-- - they can have references to other documents.
|
||||
-- - the modifications of a document are propagated to the referencing
|
||||
-- documents.
|
||||
-- - a document can be stored in different formats, with or
|
||||
-- without a persistent model.
|
||||
-- - the drivers for storing and retrieving documents are
|
||||
-- plugged in when necessary.
|
||||
-- - a document has a modification counter. This counter is
|
||||
-- incremented when the document is modified. When a document
|
||||
-- is stored, the current counter value is memorized as the
|
||||
-- last storage version of the document. A document is
|
||||
-- considered to be modified when the counter value is
|
||||
-- different from the storage version. Once the document is
|
||||
-- saved the storage version and the counter value are
|
||||
-- identical. The document is now not considered to be
|
||||
-- modified.
|
||||
-- - a reference is a link between two documents. A reference has two
|
||||
-- components: the "From Document" and the "To Document". When
|
||||
-- a reference is created, an identifier of the reference is generated.
|
||||
-- This identifier is unique in the scope of the From Document and
|
||||
-- is conserved during storage and retrieval. This means that the
|
||||
-- referenced document will be always accessible through this
|
||||
-- identifier.
|
||||
-- - a reference memorizes the counter value of the To Document when
|
||||
-- the reference is created. The From Document is considered to
|
||||
-- be up to date relative to the To Document when the
|
||||
-- reference counter value is equal to the To Document counter value.
|
||||
-- - retrieval of a document having references does not imply
|
||||
-- the retrieving of the referenced documents.
|
||||
|
||||
uses
|
||||
Reference from CDM,
|
||||
ReferenceIterator from CDM,
|
||||
ExtendedString from TCollection,MetaData from CDM, Application from CDM,
|
||||
ListOfReferences from CDM, SequenceOfExtendedString from TColStd,
|
||||
GUID from Standard,Manager from Resource,CanCloseStatus from CDM
|
||||
|
||||
|
||||
raises NoSuchObject from Standard,Failure from Standard,DomainError from Standard
|
||||
is
|
||||
|
||||
Initialize;
|
||||
|
||||
Destroy(me: mutable) is protected;
|
||||
---C++: alias ~
|
||||
---Category: virtual methods
|
||||
|
||||
Update(me: mutable; aToDocument: Document from CDM; aReferenceIdentifier: Integer from Standard; aModifContext: Address from Standard)
|
||||
---Purpose: The Update method will be called once for each
|
||||
-- reference, but it should not perform any computation,
|
||||
-- to avoid multiple computation of a same document.
|
||||
is virtual;
|
||||
|
||||
|
||||
Update(me:mutable; ErrorString: out ExtendedString from TCollection)
|
||||
returns Boolean from Standard
|
||||
---Purpose: This method Update will be called
|
||||
-- to signal the end of the modified references list.
|
||||
-- The document should be recomputed and
|
||||
-- UpdateFromDocuments should be called. Update should
|
||||
-- returns True in case of success, false otherwise. In
|
||||
-- case of Failure, additional information can be given in
|
||||
-- ErrorString.
|
||||
is virtual;
|
||||
|
||||
|
||||
StorageFormat(me)
|
||||
returns ExtendedString from TCollection
|
||||
---Purpose: The Storage Format is the key which is used to determine in the
|
||||
-- application resources the storage driver plugin, the file
|
||||
-- extension and other data used to store the document.
|
||||
is deferred;
|
||||
|
||||
Extensions(me; Extensions: out SequenceOfExtendedString from TColStd)
|
||||
is virtual;
|
||||
---Purpose: by default empties the extensions.
|
||||
--
|
||||
|
||||
GetAlternativeDocument(me: mutable; aFormat: ExtendedString from TCollection;
|
||||
anAlternativeDocument: out Document from CDM)
|
||||
returns Boolean from Standard
|
||||
---Purpose: This method can be redefined to extract another document in
|
||||
-- a different format. For example, to extract a MDTV-Shape
|
||||
-- from an applicative document.
|
||||
is virtual;
|
||||
|
||||
---Category: Reference management.
|
||||
--
|
||||
CreateReference(me: mutable; anOtherDocument: Document from CDM)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Creates a reference from this document to {anOtherDocument}.
|
||||
-- Returns a reference identifier. This reference identifier
|
||||
-- is unique in the document and will not be used for the
|
||||
-- next references, even after the storing of the document.
|
||||
-- If there is already a reference between the two documents,
|
||||
-- the reference is not created, but its reference identifier
|
||||
-- is returned.
|
||||
|
||||
|
||||
RemoveReference(me: mutable; aReferenceIdentifier: Integer from Standard);
|
||||
---Purpose: Removes the reference between the From Document and the
|
||||
-- To Document identified by a reference identifier.
|
||||
|
||||
|
||||
RemoveAllReferences(me: mutable);
|
||||
---Purpose: Removes all references having this document for From Document.
|
||||
|
||||
Document(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Document from CDM
|
||||
---Purpose: Returns the To Document of the reference identified by
|
||||
-- aReferenceIdentifier. If the ToDocument is stored and
|
||||
-- has not yet been retrieved, this method will retrieve it.
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
IsInSession(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
---Purpose: returns True if the To Document of the reference
|
||||
-- identified by aReferenceIdentifier is in session, False
|
||||
-- if it corresponds to a not yet retrieved document.
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
IsStored(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
---Purpose: returns True if the To Document of the reference
|
||||
-- identified by aReferenceIdentifier has already been stored,
|
||||
-- False otherwise.
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
Name(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns ExtendedString from TCollection
|
||||
---Purpose: returns the name of the metadata of the To Document of
|
||||
-- the reference identified by aReferenceIdentifier.
|
||||
raises DomainError from Standard;
|
||||
---Warning: if the corresponding document is not stored.
|
||||
|
||||
UpdateFromDocuments(me; aModifContext: Address from Standard);
|
||||
---Purpose: call virtual method Update on all referencing
|
||||
-- documents. This method keeps the list of the --
|
||||
-- documents to process.It may be the starting of an
|
||||
-- update -- cycle. If not, the reentrant calls made by
|
||||
-- Update method (without argument) will append the
|
||||
-- referencing documents to the list and call the Update method
|
||||
-- (with arguments). Only the first call to UpdateFromDocuments
|
||||
-- generate call to Update().
|
||||
|
||||
ToReferencesNumber(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose: returns the number of references having this document as
|
||||
-- From Document.
|
||||
|
||||
|
||||
FromReferencesNumber(me)
|
||||
returns Integer from Standard;
|
||||
---Purpose: returns the number of references having this document as
|
||||
-- To Document.
|
||||
|
||||
ShallowReferences(me; aDocument: Document from CDM)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True is this document references aDocument;
|
||||
--
|
||||
DeepReferences(me; aDocument: Document from CDM)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns True is this document references aDocument;
|
||||
--
|
||||
CopyReference(me: mutable; aFromDocument: Document from CDM; aReferenceIdentifier: Integer from Standard)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Copies a reference to this document. This method
|
||||
-- avoid retrieval of referenced document. The arguments
|
||||
-- are the original document and a valid reference
|
||||
-- identifier Returns the local identifier.
|
||||
--
|
||||
---Category: Modifications Counter management.
|
||||
|
||||
IsReadOnly(me) returns Boolean from Standard;
|
||||
---Purpose: indicates that this document cannot be modified.
|
||||
|
||||
|
||||
|
||||
IsReadOnly(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: indicates that the referenced document cannot be modified,
|
||||
|
||||
|
||||
SetIsReadOnly(me: mutable);
|
||||
|
||||
UnsetIsReadOnly(me: mutable);
|
||||
|
||||
Modify(me: mutable);
|
||||
---Purpose: Indicates that this document has been modified.
|
||||
-- This method increments the modification counter.
|
||||
--
|
||||
Modifications(me) returns Integer from Standard;
|
||||
---Purpose: returns the current modification counter.
|
||||
|
||||
UnModify(me: mutable);
|
||||
|
||||
IsUpToDate(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns true if the modification counter found in the given
|
||||
-- reference is equal to the actual modification counter of
|
||||
-- the To Document. This method is able to deal with a reference
|
||||
-- to a not retrieved document.
|
||||
|
||||
|
||||
SetIsUpToDate(me: mutable; aReferenceIdentifier: Integer from Standard);
|
||||
---Purpose: Resets the modification counter in the given reference
|
||||
-- to the actual modification counter of its To Document.
|
||||
-- This method should be called after the application has updated
|
||||
-- this document.
|
||||
|
||||
|
||||
SetComment(me: mutable; aComment: ExtendedString from TCollection);
|
||||
---Purpose: associates a comment with this document.
|
||||
|
||||
AddComment(me: mutable; aComment: ExtendedString from TCollection);
|
||||
---Purpose: appends a comment into comments of this document.
|
||||
|
||||
SetComments(me: mutable; aComments: SequenceOfExtendedString from TColStd);
|
||||
---Purpose: associates a comments with this document.
|
||||
|
||||
Comments(me; aComments: out SequenceOfExtendedString from TColStd);
|
||||
---Purpose: returns the associated comments through <aComments>.
|
||||
-- Returns empty sequence if no comments are associated.
|
||||
|
||||
Comment(me) returns ExtString from Standard;
|
||||
---Purpose: returns the first of associated comments. By defaut
|
||||
-- the comment is an empty string.
|
||||
|
||||
---Category: presentation methods. The presentation is an alphanumeric string.
|
||||
-- In a given session a presentation cannot be given to two differents
|
||||
-- documents.
|
||||
|
||||
Presentation(me: mutable) returns ExtString from Standard;
|
||||
---Purpose: Returns an alphanumeric string identifying this document
|
||||
-- in a unique manner in the current process. The presentation
|
||||
-- may change when the document is stored.
|
||||
-- Tries to get the 'FileFormat`.Presentation resource
|
||||
-- This item is used to give a default presentation
|
||||
-- to the document.
|
||||
FindFromPresentation(myclass; aPresentation: ExtendedString from TCollection)
|
||||
returns Document from CDM
|
||||
---Purpose: returns the document having the given alphanumeric presentation.
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
|
||||
FindPresentation(myclass; aPresentation: ExtendedString from TCollection)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: indicates whether a document having the given presentation
|
||||
-- does exist.
|
||||
|
||||
---Category: database related methods
|
||||
IsStored(me) returns Boolean from Standard;
|
||||
|
||||
StorageVersion(me) returns Integer from Standard;
|
||||
---Purpose: returns the value of the modification counter at the
|
||||
-- time of storage. By default returns 0.
|
||||
|
||||
|
||||
SetMetaData(me: mutable; aMetaData: MetaData from CDM);
|
||||
---Purpose: associates database information to a document which
|
||||
-- has been stored. The name of the document is now the
|
||||
-- name which has beenused to store the data.
|
||||
|
||||
|
||||
UnsetIsStored(me: mutable);
|
||||
|
||||
MetaData(me) returns MetaData from CDM
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
Folder(me) returns ExtendedString from TCollection
|
||||
raises NoSuchObject from Standard;
|
||||
---Warning: if the object is not stored;
|
||||
|
||||
|
||||
---Category: methods to define where to store the document, the name
|
||||
-- under which it has to be stored and some other metadatas.
|
||||
|
||||
|
||||
|
||||
SetRequestedFolder(me: mutable; aFolder: ExtendedString from TCollection);
|
||||
---Purpose: defines the folder in which the object should be stored.
|
||||
|
||||
RequestedFolder(me) returns ExtendedString from TCollection
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
|
||||
HasRequestedFolder(me) returns Boolean from Standard;
|
||||
|
||||
|
||||
|
||||
|
||||
SetRequestedName(me: mutable; aName: ExtendedString from TCollection);
|
||||
---Purpose: defines the name under which the object should be stored.
|
||||
RequestedName(me:mutable) returns ExtendedString from TCollection;
|
||||
---Purpose: determines under which the document is going to be
|
||||
-- store. By default the name of the document wil be --
|
||||
-- used. If the document has no name its presentation
|
||||
-- will be used.
|
||||
|
||||
SetRequestedPreviousVersion(me: mutable; aPreviousVersion: ExtendedString from TCollection);
|
||||
|
||||
UnsetRequestedPreviousVersion(me: mutable);
|
||||
|
||||
HasRequestedPreviousVersion(me) returns Boolean from Standard;
|
||||
RequestedPreviousVersion(me) returns ExtendedString from TCollection
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
SetRequestedComment(me: mutable; aComment: ExtendedString from TCollection);
|
||||
---Purpose: defines the Comment with which the object should be stored.
|
||||
|
||||
RequestedComment(me) returns ExtendedString from TCollection;
|
||||
|
||||
|
||||
---Category: resource reading methods
|
||||
--
|
||||
--
|
||||
--
|
||||
--
|
||||
-- Resources are read once at the creation of the document
|
||||
-- until LoadResources is called again.
|
||||
--
|
||||
--
|
||||
LoadResources(me: mutable);
|
||||
---Purpose: read (or rereads) the following resource.
|
||||
|
||||
StorageResource(me: mutable) returns Manager from Resource
|
||||
is private;
|
||||
---Purpose: the manager returned by this method will be
|
||||
-- used to search for the following resource items.
|
||||
|
||||
FindFileExtension(me: mutable) returns Boolean from Standard;
|
||||
|
||||
FileExtension(me: mutable) returns ExtendedString from TCollection;
|
||||
---Purpose: gets the Desktop.Domain.Application.`FileFormat`.FileExtension resource.
|
||||
FindDataType(me: mutable) returns Boolean from Standard;
|
||||
|
||||
DataType(me: mutable) returns ExtendedString from TCollection;
|
||||
---Purpose: this datatype will be used if the DBMS deals with this concept
|
||||
---Purpose: gets the `FileFormat`.DataType resource.
|
||||
-- concept.
|
||||
|
||||
FindVersionDataType(me: mutable) returns Boolean from Standard;
|
||||
|
||||
VersionDataType(me: mutable) returns ExtendedString from TCollection;
|
||||
---Purpose: this datatype will be used if the DBMS deals with this concept
|
||||
---Purpose: gets the `FileFormat`.VersionDataType resource.
|
||||
--
|
||||
FindDescription(me: mutable) returns Boolean from Standard;
|
||||
|
||||
Description(me: mutable) returns ExtendedString from TCollection;
|
||||
---Purpose: gets the `FileFormat`.Description resource.
|
||||
|
||||
FindDomain(me: mutable) returns Boolean from Standard;
|
||||
|
||||
Domain(me: mutable) returns ExtendedString from TCollection;
|
||||
---Purpose: gets the `FileFormat`.Domain resource.
|
||||
|
||||
|
||||
FindStoragePlugin(me: mutable) returns Boolean from Standard;
|
||||
|
||||
StoragePlugin(me: mutable) returns GUID from Standard;
|
||||
|
||||
---Category: Miscellaneous methods
|
||||
|
||||
IsModified(me) returns Boolean from Standard;
|
||||
---Purpose: returns true if the version is greater than the
|
||||
-- storage version
|
||||
|
||||
---Category: print method
|
||||
Print(me; anOStream: in out OStream from Standard)
|
||||
returns OStream from Standard;
|
||||
---C++: return &
|
||||
---C++: alias "Standard_OStream& operator << (Standard_OStream& anOStream);"
|
||||
|
||||
---Category: activation controll
|
||||
|
||||
IsOpened(me) returns Boolean from Standard;
|
||||
|
||||
Open(me: mutable; anApplication: Application from CDM);
|
||||
|
||||
|
||||
CanClose(me) returns CanCloseStatus from CDM;
|
||||
---Purpose:
|
||||
--Returns CDM_CCS_OK true if it is possible to close the document.
|
||||
-- Otherwise, returns:
|
||||
-- CDM_CSS_NotOpen if the document has not been opened
|
||||
-- CDM_CCS_UnstoredReferenced if the document is not stored if it
|
||||
-- is referenced.
|
||||
-- CDM_CSS_ModifiedReferenced if the document has been modified,
|
||||
-- if it is referenced, since it has been stored.
|
||||
-- CDM_CCS_ReferenceRejection if one of the referencing documents
|
||||
-- does not allow the closing of the document.
|
||||
Close(me: mutable);
|
||||
|
||||
Application(me) returns Application from CDM
|
||||
raises Failure from Standard;
|
||||
---C++: return const &
|
||||
---Warning: exception if the document is not open
|
||||
|
||||
|
||||
CanCloseReference(me; aDocument: Document from CDM;
|
||||
aReferenceIdentifier: Integer from Standard)
|
||||
returns Boolean from Standard
|
||||
is virtual;
|
||||
---Purpose: A referenced document may indicate through this
|
||||
-- virtual method that it does not allow the closing of
|
||||
-- aDocument which it references through the reference
|
||||
-- aReferenceIdentifier. By default returns Standard_True;;
|
||||
|
||||
CloseReference(me: mutable; aDocument: Document from CDM;
|
||||
aReferenceIdentifier: Integer from Standard)
|
||||
is virtual;
|
||||
---Purpose: A referenced document may update its internal
|
||||
-- data structure when {aDocument} which it references
|
||||
-- through the reference {aReferenceIdentifier} is being closed.
|
||||
-- By default this method does nothing.
|
||||
|
||||
IsOpened(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
---Purpose: returns true if the document corresponding to the
|
||||
-- given reference has been retrieved and opened.
|
||||
-- Otherwise returns false. This method does not retrieve
|
||||
-- the referenced document
|
||||
|
||||
---Category: private methods;
|
||||
--
|
||||
Reference(me; aReferenceIdentifier: Integer from Standard)
|
||||
returns Reference from CDM
|
||||
is private;
|
||||
|
||||
ComputePresentation(me: mutable)
|
||||
is private;
|
||||
|
||||
UnvalidPresentation(me: mutable)
|
||||
is private;
|
||||
|
||||
CreateReference(me: mutable; aMetaData: MetaData from CDM; aReferenceIdentifier: Integer from Standard; anApplication: Application from CDM; aToDocumentVersion: Integer from Standard; UseStorageConfiguration: Boolean from Standard);
|
||||
|
||||
CreateReference(me: mutable; aMetaData: MetaData from CDM; anApplication: Application from CDM; aDocumentVersion: Integer from Standard; UseStorageConfiguration: Boolean from Standard)
|
||||
returns Integer from Standard;
|
||||
|
||||
AddToReference(me: mutable; aReference: Reference from CDM)
|
||||
is private;
|
||||
|
||||
AddFromReference(me: mutable; aReference: Reference from CDM)
|
||||
is private;
|
||||
|
||||
RemoveFromReference(me: mutable; aReferenceIdentifier: Integer from Standard)
|
||||
is private;
|
||||
|
||||
SetModifications(me: mutable; Modifications: Integer from Standard)
|
||||
is private;
|
||||
|
||||
ReferenceCounter(me) returns Integer from Standard;
|
||||
|
||||
SetReferenceCounter(me: mutable; aReferenceCounter: Integer from Standard)
|
||||
is private;
|
||||
|
||||
---Category: obsolete methods
|
||||
|
||||
Update(me: mutable)
|
||||
is virtual;
|
||||
---Purpose: the following method should be used instead:
|
||||
--
|
||||
-- Update(me:mutable; ErrorString: out ExtendedString from TCollection)
|
||||
-- returns Boolean from Standard
|
||||
|
||||
fields
|
||||
|
||||
|
||||
myComments: SequenceOfExtendedString from TColStd;
|
||||
|
||||
myPresentation: ExtendedString from TCollection;
|
||||
myValidPresentation: Boolean from Standard;
|
||||
|
||||
myFromReferences: ListOfReferences from CDM;
|
||||
myToReferences: ListOfReferences from CDM;
|
||||
myVersion: Integer from Standard;
|
||||
|
||||
myActualReferenceIdentifier: Integer from Standard;
|
||||
|
||||
myStorageVersion: Integer from Standard;
|
||||
myMetaData: MetaData from CDM;
|
||||
|
||||
myRequestedComment: ExtendedString from TCollection;
|
||||
|
||||
myRequestedFolder: ExtendedString from TCollection;
|
||||
myRequestedFolderIsDefined: Boolean from Standard;
|
||||
|
||||
myRequestedName: ExtendedString from TCollection;
|
||||
myRequestedNameIsDefined: Boolean from Standard;
|
||||
|
||||
myRequestedPreviousVersionIsDefined: Boolean from Standard;
|
||||
myRequestedPreviousVersion: ExtendedString from TCollection;
|
||||
|
||||
---Category: resources.
|
||||
myFileExtension,myDataType,myVersionDataType,myDescription,myDomain,myDefaultPresentation: ExtendedString from TCollection;
|
||||
|
||||
myFileExtensionWasFound,myDataTypeWasFound,myVersionDataTypeWasFound,myDescriptionWasFound,myDomainWasFound,myStoragePluginWasFound,myDefaultPresentationWasFound: Boolean from Standard;
|
||||
myResourcesAreLoaded: Boolean from Standard is protected;
|
||||
myStoragePlugin: GUID from Standard;
|
||||
myApplication: Application from CDM;
|
||||
|
||||
friends
|
||||
class Reference from CDM,
|
||||
class ReferenceIterator from CDM,
|
||||
class Application from CDM
|
||||
|
||||
end Document from CDM;
|
1380
src/CDM/CDM_Document.cxx
Executable file
1380
src/CDM/CDM_Document.cxx
Executable file
File diff suppressed because it is too large
Load Diff
14
src/CDM/CDM_MessageDriver.cdl
Executable file
14
src/CDM/CDM_MessageDriver.cdl
Executable file
@@ -0,0 +1,14 @@
|
||||
-- File: CDM_MessageDriver.cdl
|
||||
-- Created: Thu Oct 29 08:15:10 1998
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
deferred class MessageDriver from CDM inherits Transient from Standard
|
||||
|
||||
is
|
||||
|
||||
Write(me: mutable; aString: ExtString from Standard)
|
||||
is deferred;
|
||||
|
||||
end MessageDriver from CDM;
|
7
src/CDM/CDM_MessageDriver.cxx
Executable file
7
src/CDM/CDM_MessageDriver.cxx
Executable file
@@ -0,0 +1,7 @@
|
||||
// File: CDM_MessageDriver.cxx
|
||||
// Created: Thu Oct 29 08:17:41 1998
|
||||
// Author: Mister rmi
|
||||
// <rmi@frilox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <CDM_MessageDriver.ixx>
|
110
src/CDM/CDM_MetaData.cdl
Executable file
110
src/CDM/CDM_MetaData.cdl
Executable file
@@ -0,0 +1,110 @@
|
||||
-- File: CDM_MetaData.cdl
|
||||
-- Created: Wed Oct 22 14:54:38 1997
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
class MetaData from CDM inherits Transient from Standard
|
||||
|
||||
uses ExtendedString from TCollection,Document from CDM,MetaDataLookUpTable from CDM, DocumentPointer from CDM,
|
||||
Application from CDM
|
||||
raises NoSuchObject from Standard
|
||||
|
||||
is
|
||||
|
||||
Create(aFolder,aName, aPath: ExtendedString from TCollection;
|
||||
aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
|
||||
returns MetaData from CDM is private;
|
||||
|
||||
Create(aFolder,aName, aPath, aVersion: ExtendedString from TCollection;
|
||||
aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
|
||||
returns MetaData from CDM is private;
|
||||
|
||||
|
||||
|
||||
LookUp(myclass; aFolder,aName, aPath: ExtendedString from TCollection;
|
||||
aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
|
||||
returns MetaData from CDM;
|
||||
|
||||
LookUp(myclass; aFolder,aName, aPath, aVersion: ExtendedString from TCollection; aFileName: ExtendedString from TCollection; ReadOnly:Boolean from Standard)
|
||||
returns MetaData from CDM;
|
||||
|
||||
|
||||
|
||||
|
||||
IsRetrieved(me) returns Boolean from Standard;
|
||||
|
||||
Document(me) returns Document from CDM;
|
||||
|
||||
Folder(me) returns ExtendedString from TCollection;
|
||||
---Purpose: returns the folder in which the meta-data has to be created
|
||||
-- or has to be found.
|
||||
--
|
||||
Name(me) returns ExtendedString from TCollection;
|
||||
---Purpose: returns the name under which the meta-data has to be created
|
||||
-- or has to be found.
|
||||
--
|
||||
|
||||
Version(me) returns ExtendedString from TCollection
|
||||
---Purpose: returns the version under which the meta-data has to be found.
|
||||
-- Warning: raises NoSuchObject from Standard if no Version has been defined
|
||||
|
||||
raises NoSuchObject from Standard;
|
||||
|
||||
HasVersion(me) returns Boolean from Standard;
|
||||
---Purpose: indicates that the version has to be taken into account when
|
||||
-- searching the corresponding meta-data.
|
||||
|
||||
FileName(me) returns ExtendedString from TCollection;
|
||||
---Category: programming facility
|
||||
--
|
||||
Print(me; anOStream: in out OStream from Standard)
|
||||
returns OStream from Standard;
|
||||
---C++: return &
|
||||
---C++: alias "Standard_OStream& operator << (Standard_OStream& anOStream);"
|
||||
--
|
||||
|
||||
Path(me) returns ExtendedString from TCollection;
|
||||
|
||||
|
||||
---Category: methods to modify the metadata.
|
||||
--
|
||||
SetDocument(me: mutable; aDocument: Document from CDM)
|
||||
is private;
|
||||
|
||||
UnsetDocument(me: mutable);
|
||||
|
||||
LookUpTable(myclass) returns MetaDataLookUpTable from CDM
|
||||
is private;
|
||||
---C++: return const&
|
||||
--
|
||||
DocumentVersion(me: mutable; anApplication: Application from CDM) returns Integer from Standard
|
||||
is private;
|
||||
|
||||
IsReadOnly(me) returns Boolean from Standard;
|
||||
|
||||
SetIsReadOnly(me: mutable);
|
||||
|
||||
UnsetIsReadOnly(me: mutable);
|
||||
|
||||
fields
|
||||
myIsRetrieved: Boolean from Standard;
|
||||
myDocument: DocumentPointer from CDM;
|
||||
myFolder: ExtendedString from TCollection;
|
||||
myName: ExtendedString from TCollection;
|
||||
|
||||
myVersion: ExtendedString from TCollection;
|
||||
myHasVersion: Boolean from Standard;
|
||||
|
||||
myFileName: ExtendedString from TCollection;
|
||||
myPath: ExtendedString from TCollection;
|
||||
|
||||
|
||||
myDocumentVersion: Integer from Standard;
|
||||
|
||||
myIsReadOnly: Boolean from Standard;
|
||||
|
||||
friends SetMetaData from class Document from CDM(me: mutable; aMetaData: MetaData from CDM),
|
||||
class Reference from CDM,
|
||||
SetDocumentVersion from class Application from CDM(me; aDocument: Document from CDM; aMetaData: MetaData from CDM)
|
||||
end MetaData from CDM;
|
127
src/CDM/CDM_MetaData.cxx
Executable file
127
src/CDM/CDM_MetaData.cxx
Executable file
@@ -0,0 +1,127 @@
|
||||
// File: CDM_MetaData.cxx
|
||||
// Created: Wed Oct 22 16:47:49 1997
|
||||
// Author: Jean-Louis Frenkel
|
||||
// <rmi@frilox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <CDM_MetaData.ixx>
|
||||
#include <CDM_MetaDataLookUpTable.hxx>
|
||||
|
||||
static CDM_MetaDataLookUpTable& getLookUpTable(){
|
||||
static CDM_MetaDataLookUpTable theLookUpTable;
|
||||
return theLookUpTable;
|
||||
}
|
||||
CDM_MetaData::CDM_MetaData(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath,const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly):
|
||||
myIsRetrieved(Standard_False),
|
||||
myFolder(aFolder),
|
||||
myName(aName),
|
||||
myHasVersion(Standard_False),
|
||||
myFileName(aFileName),
|
||||
myPath(aPath),
|
||||
myDocumentVersion(0),
|
||||
myIsReadOnly(ReadOnly)
|
||||
{}
|
||||
|
||||
CDM_MetaData::CDM_MetaData(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath,const TCollection_ExtendedString& aVersion,const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly):
|
||||
myIsRetrieved(Standard_False),
|
||||
myFolder(aFolder),
|
||||
myName(aName),
|
||||
myVersion(aVersion),
|
||||
myHasVersion(Standard_True),
|
||||
myFileName(aFileName),
|
||||
myPath(aPath),
|
||||
myDocumentVersion(0),
|
||||
myIsReadOnly(ReadOnly)
|
||||
{}
|
||||
|
||||
Standard_Boolean CDM_MetaData::IsRetrieved() const {
|
||||
return myIsRetrieved;
|
||||
}
|
||||
|
||||
Handle(CDM_Document) CDM_MetaData::Document() const {
|
||||
return myDocument;
|
||||
}
|
||||
|
||||
void CDM_MetaData::SetDocument(const Handle(CDM_Document)& aDocument) {
|
||||
myIsRetrieved = Standard_True;
|
||||
myDocument = aDocument.operator->();
|
||||
}
|
||||
void CDM_MetaData::UnsetDocument() {
|
||||
myIsRetrieved = Standard_False;
|
||||
}
|
||||
Handle(CDM_MetaData) CDM_MetaData::LookUp(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath,const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly) {
|
||||
Handle(CDM_MetaData) theMetaData;
|
||||
TCollection_ExtendedString aConventionalPath=aPath;
|
||||
aConventionalPath.ChangeAll('\\','/');
|
||||
if(!getLookUpTable().IsBound(aConventionalPath)) {
|
||||
theMetaData = new CDM_MetaData(aFolder,aName,aPath,aFileName,ReadOnly);
|
||||
getLookUpTable().Bind(aConventionalPath,theMetaData);
|
||||
}
|
||||
else
|
||||
theMetaData = getLookUpTable()(aConventionalPath);
|
||||
|
||||
return theMetaData;
|
||||
}
|
||||
Handle(CDM_MetaData) CDM_MetaData::LookUp(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aPath, const TCollection_ExtendedString& aVersion, const TCollection_ExtendedString& aFileName,const Standard_Boolean ReadOnly) {
|
||||
Handle(CDM_MetaData) theMetaData;
|
||||
TCollection_ExtendedString aConventionalPath=aPath;
|
||||
aConventionalPath.ChangeAll('\\','/');
|
||||
if(!getLookUpTable().IsBound(aConventionalPath)) {
|
||||
theMetaData = new CDM_MetaData(aFolder,aName,aPath,aVersion,aFileName,ReadOnly);
|
||||
getLookUpTable().Bind(aConventionalPath,theMetaData);
|
||||
}
|
||||
else
|
||||
theMetaData = getLookUpTable()(aConventionalPath);
|
||||
|
||||
return theMetaData;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString CDM_MetaData::Folder() const {
|
||||
return myFolder;
|
||||
}
|
||||
TCollection_ExtendedString CDM_MetaData::Name() const {
|
||||
return myName;
|
||||
}
|
||||
TCollection_ExtendedString CDM_MetaData::Version() const {
|
||||
Standard_NoSuchObject_Raise_if(!myHasVersion,"Document has no version");
|
||||
return myVersion;
|
||||
}
|
||||
Standard_Boolean CDM_MetaData::HasVersion() const {
|
||||
return myHasVersion;
|
||||
}
|
||||
|
||||
TCollection_ExtendedString CDM_MetaData::FileName() const {
|
||||
return myFileName;
|
||||
}
|
||||
TCollection_ExtendedString CDM_MetaData::Path() const {
|
||||
return myPath;
|
||||
}
|
||||
Standard_OStream& CDM_MetaData::Print(Standard_OStream& anOStream) const {
|
||||
anOStream << "*CDM_MetaData*";
|
||||
anOStream << myFolder << "," << myName;
|
||||
if(HasVersion()) anOStream << "," << myVersion ;
|
||||
anOStream << "; Physical situation: ";
|
||||
anOStream << myFileName;
|
||||
anOStream << endl;
|
||||
return anOStream;
|
||||
}
|
||||
Standard_OStream& CDM_MetaData::operator << (Standard_OStream& anOStream) {
|
||||
return Print(anOStream);
|
||||
}
|
||||
const CDM_MetaDataLookUpTable& CDM_MetaData::LookUpTable() {
|
||||
return getLookUpTable();
|
||||
}
|
||||
Standard_Integer CDM_MetaData::DocumentVersion(const Handle(CDM_Application)& anApplication) {
|
||||
if(myDocumentVersion==0) myDocumentVersion=anApplication->DocumentVersion(this);
|
||||
return myDocumentVersion;
|
||||
}
|
||||
Standard_Boolean CDM_MetaData::IsReadOnly() const {
|
||||
return myIsReadOnly;
|
||||
}
|
||||
void CDM_MetaData::SetIsReadOnly() {
|
||||
myIsReadOnly=Standard_True;
|
||||
}
|
||||
|
||||
void CDM_MetaData::UnsetIsReadOnly() {
|
||||
myIsReadOnly=Standard_False;
|
||||
}
|
16
src/CDM/CDM_NullMessageDriver.cdl
Executable file
16
src/CDM/CDM_NullMessageDriver.cdl
Executable file
@@ -0,0 +1,16 @@
|
||||
-- File: CDM_LogFileDriver.cdl
|
||||
-- Created: Thu Oct 29 08:19:54 1998
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
class NullMessageDriver from CDM inherits MessageDriver from CDM
|
||||
|
||||
is
|
||||
Create returns mutable NullMessageDriver from CDM;
|
||||
|
||||
|
||||
Write(me: mutable; aString: ExtString from Standard);
|
||||
|
||||
|
||||
end NullMessageDriver from CDM;
|
12
src/CDM/CDM_NullMessageDriver.cxx
Executable file
12
src/CDM/CDM_NullMessageDriver.cxx
Executable file
@@ -0,0 +1,12 @@
|
||||
// File: CDM_NullMessageDriver.cxx
|
||||
// Created: Thu Oct 29 08:20:35 1998
|
||||
// Author: Mister rmi
|
||||
// <rmi@frilox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <CDM_NullMessageDriver.ixx>
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
CDM_NullMessageDriver::CDM_NullMessageDriver() {}
|
||||
|
||||
void CDM_NullMessageDriver::Write(const Standard_ExtString aString) {
|
||||
}
|
83
src/CDM/CDM_Reference.cdl
Executable file
83
src/CDM/CDM_Reference.cdl
Executable file
@@ -0,0 +1,83 @@
|
||||
-- File: CDM_Reference.cdl
|
||||
-- Created: Wed Oct 22 14:36:28 1997
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
private class Reference from CDM inherits Transient from Standard
|
||||
|
||||
uses Document from CDM, DocumentPointer from CDM, Application from CDM, MetaData from CDM
|
||||
|
||||
is
|
||||
|
||||
Create(aFromDocument: Document from CDM; aToDocument: Document from CDM; aReferenceIdentifier: Integer from Standard; aToDocumentVersion: Integer from Standard)
|
||||
returns mutable Reference from CDM
|
||||
is private;
|
||||
|
||||
Create(aFromDocument: Document from CDM; aMetaData: MetaData from CDM; aReferenceIdentifier: Integer from Standard; anApplication: Application from CDM; aToDocumentVersion: Integer from Standard; UseStorageConfiguration: Boolean from Standard)
|
||||
returns mutable Reference from CDM
|
||||
is private;
|
||||
|
||||
|
||||
|
||||
|
||||
FromDocument(me: mutable) returns Document from CDM;
|
||||
|
||||
ToDocument(me: mutable) returns Document from CDM;
|
||||
|
||||
ReferenceIdentifier(me: mutable) returns Integer from Standard;
|
||||
|
||||
|
||||
---Category: methods to modifiy the reference.
|
||||
|
||||
|
||||
Update(me: mutable; aMetaData: MetaData from CDM)
|
||||
is private;
|
||||
|
||||
IsUpToDate(me) returns Boolean from Standard
|
||||
is private;
|
||||
---Purpose: compares the actual document version with the
|
||||
-- document version at the creation of the reference
|
||||
SetIsUpToDate(me: mutable)
|
||||
is private;
|
||||
|
||||
UnsetToDocument(me: mutable; aMetaData: MetaData from CDM; anApplication: Application from CDM) is private;
|
||||
|
||||
IsOpened(me) returns Boolean from Standard is private;
|
||||
---Purpose: returns true if the ToDocument has been retrieved
|
||||
-- and opened.
|
||||
|
||||
DocumentVersion(me) returns Integer from Standard;
|
||||
|
||||
IsReadOnly(me) returns Boolean from Standard;
|
||||
|
||||
Document(me) returns Document from CDM
|
||||
is private;
|
||||
|
||||
MetaData(me) returns MetaData from CDM
|
||||
is private;
|
||||
|
||||
Application(me) returns Application from CDM
|
||||
is private;
|
||||
|
||||
UseStorageConfiguration(me) returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
IsInSession(me) returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
IsStored(me) returns Boolean from Standard
|
||||
is private;
|
||||
|
||||
fields
|
||||
|
||||
myToDocument: Document from CDM;
|
||||
myFromDocument: DocumentPointer from CDM;
|
||||
myReferenceIdentifier: Integer from Standard;
|
||||
|
||||
myApplication: Application from CDM;
|
||||
myMetaData: MetaData from CDM;
|
||||
myDocumentVersion: Integer from Standard;
|
||||
myUseStorageConfiguration: Boolean from Standard;
|
||||
friends class Document from CDM
|
||||
end Reference from CDM;
|
106
src/CDM/CDM_Reference.cxx
Executable file
106
src/CDM/CDM_Reference.cxx
Executable file
@@ -0,0 +1,106 @@
|
||||
// File: CDM_Reference.cxx
|
||||
// Created: Wed Oct 22 16:56:22 1997
|
||||
// Author: Jean-Louis Frenkel
|
||||
// <rmi@frilox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <CDM_Reference.ixx>
|
||||
|
||||
|
||||
CDM_Reference::CDM_Reference(const Handle(CDM_Document)& aFromDocument, const Handle(CDM_Document)& aToDocument, const Standard_Integer aReferenceIdentifier, const Standard_Integer aToDocumentVersion):
|
||||
myToDocument(aToDocument),
|
||||
myFromDocument(aFromDocument.operator->()),
|
||||
myReferenceIdentifier(aReferenceIdentifier),
|
||||
myDocumentVersion(aToDocumentVersion)
|
||||
{}
|
||||
|
||||
CDM_Reference::CDM_Reference(const Handle(CDM_Document)& aFromDocument, const Handle(CDM_MetaData)& aToDocument, const Standard_Integer aReferenceIdentifier, const Handle(CDM_Application)& anApplication, const Standard_Integer aToDocumentVersion, const Standard_Boolean UseStorageConfiguration):
|
||||
myFromDocument(aFromDocument.operator->()),
|
||||
myReferenceIdentifier(aReferenceIdentifier),
|
||||
myApplication(anApplication),
|
||||
myMetaData(aToDocument),
|
||||
myDocumentVersion(aToDocumentVersion),
|
||||
myUseStorageConfiguration(UseStorageConfiguration)
|
||||
{}
|
||||
|
||||
Handle(CDM_Document) CDM_Reference::FromDocument() {
|
||||
return myFromDocument;
|
||||
}
|
||||
|
||||
Handle(CDM_Document) CDM_Reference::ToDocument() {
|
||||
if(myToDocument.IsNull()) {
|
||||
myToDocument=myApplication->Retrieve(myMetaData,myUseStorageConfiguration);
|
||||
myApplication.Nullify();
|
||||
}
|
||||
return myToDocument;
|
||||
}
|
||||
Standard_Integer CDM_Reference::ReferenceIdentifier() {
|
||||
return myReferenceIdentifier;
|
||||
}
|
||||
|
||||
|
||||
void CDM_Reference::Update(const Handle(CDM_MetaData)& aMetaData) {
|
||||
if(myToDocument.IsNull()) {
|
||||
if(myMetaData == aMetaData) {
|
||||
myToDocument=myMetaData->Document();
|
||||
myToDocument->AddFromReference(this);
|
||||
myApplication.Nullify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Boolean CDM_Reference::IsUpToDate() const {
|
||||
Standard_Integer theActualDocumentVersion;
|
||||
if(myToDocument.IsNull())
|
||||
theActualDocumentVersion=myMetaData->DocumentVersion(myApplication);
|
||||
else
|
||||
theActualDocumentVersion=myToDocument->Modifications();
|
||||
|
||||
return myDocumentVersion==theActualDocumentVersion;
|
||||
}
|
||||
void CDM_Reference::SetIsUpToDate() {
|
||||
|
||||
Standard_Integer theActualDocumentVersion;
|
||||
if(myToDocument.IsNull())
|
||||
theActualDocumentVersion=myMetaData->DocumentVersion(myApplication);
|
||||
else
|
||||
theActualDocumentVersion=myToDocument->Modifications();
|
||||
|
||||
if(theActualDocumentVersion != -1) myDocumentVersion=theActualDocumentVersion;
|
||||
}
|
||||
void CDM_Reference::UnsetToDocument(const Handle(CDM_MetaData)& aMetaData, const Handle(CDM_Application)& anApplication) {
|
||||
myToDocument.Nullify();
|
||||
myApplication=anApplication;
|
||||
myMetaData=aMetaData;
|
||||
}
|
||||
|
||||
Standard_Integer CDM_Reference::DocumentVersion() const {
|
||||
return myDocumentVersion;
|
||||
}
|
||||
Standard_Boolean CDM_Reference::IsOpened() const {
|
||||
if(myToDocument.IsNull()) return Standard_False;
|
||||
return myToDocument->IsOpened();
|
||||
}
|
||||
Standard_Boolean CDM_Reference::IsReadOnly() const {
|
||||
if(myToDocument.IsNull()) return myMetaData->IsReadOnly();
|
||||
return myToDocument->IsReadOnly();
|
||||
}
|
||||
Handle(CDM_Document) CDM_Reference::Document() const {
|
||||
return myToDocument;
|
||||
}
|
||||
Handle(CDM_MetaData) CDM_Reference::MetaData() const {
|
||||
return myMetaData;
|
||||
}
|
||||
Handle(CDM_Application) CDM_Reference::Application() const {
|
||||
return myApplication;
|
||||
}
|
||||
|
||||
Standard_Boolean CDM_Reference::UseStorageConfiguration() const {
|
||||
return myUseStorageConfiguration;
|
||||
}
|
||||
Standard_Boolean CDM_Reference::IsInSession() const {
|
||||
return !myToDocument.IsNull();
|
||||
}
|
||||
Standard_Boolean CDM_Reference::IsStored() const {
|
||||
return !myMetaData.IsNull();
|
||||
}
|
33
src/CDM/CDM_ReferenceIterator.cdl
Executable file
33
src/CDM/CDM_ReferenceIterator.cdl
Executable file
@@ -0,0 +1,33 @@
|
||||
-- File: Document_ReferenceIterator.cdl
|
||||
-- Created: Mon Aug 4 17:06:07 1997
|
||||
-- Author: Jean-Louis Frenkel
|
||||
-- <rmi@frilox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
class ReferenceIterator from CDM
|
||||
|
||||
uses Document from CDM, ListIteratorOfListOfReferences from CDM
|
||||
is
|
||||
|
||||
Create(aDocument: Document from CDM);
|
||||
|
||||
|
||||
More(me) returns Boolean from Standard;
|
||||
|
||||
|
||||
Next(me: in out);
|
||||
|
||||
|
||||
Document(me) returns Document from CDM;
|
||||
|
||||
ReferenceIdentifier(me) returns Integer from Standard;
|
||||
|
||||
|
||||
DocumentVersion(me) returns Integer from Standard;
|
||||
---Purpose: returns the Document Version in the reference.
|
||||
|
||||
fields
|
||||
myIterator: ListIteratorOfListOfReferences from CDM;
|
||||
end ReferenceIterator from CDM;
|
||||
|
||||
|
32
src/CDM/CDM_ReferenceIterator.cxx
Executable file
32
src/CDM/CDM_ReferenceIterator.cxx
Executable file
@@ -0,0 +1,32 @@
|
||||
// File: CDM_ReferenceIterator.cxx
|
||||
// Created: Mon Aug 4 17:11:25 1997
|
||||
// Author: Jean-Louis Frenkel
|
||||
// <rmi@frilox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <CDM_ReferenceIterator.ixx>
|
||||
#include <CDM_Reference.hxx>
|
||||
#include <CDM_Document.hxx>
|
||||
|
||||
CDM_ReferenceIterator::CDM_ReferenceIterator(const Handle(CDM_Document)& aDocument):myIterator(aDocument->myToReferences){}
|
||||
|
||||
Standard_Boolean CDM_ReferenceIterator::More() const {
|
||||
return myIterator.More();
|
||||
}
|
||||
|
||||
void CDM_ReferenceIterator::Next() {
|
||||
myIterator.Next();
|
||||
}
|
||||
|
||||
Standard_Integer CDM_ReferenceIterator::ReferenceIdentifier() const{
|
||||
return myIterator.Value()->ReferenceIdentifier();
|
||||
}
|
||||
|
||||
Handle(CDM_Document) CDM_ReferenceIterator::Document() const {
|
||||
return myIterator.Value()->ToDocument();
|
||||
}
|
||||
|
||||
|
||||
Standard_Integer CDM_ReferenceIterator::DocumentVersion() const {
|
||||
return myIterator.Value()->DocumentVersion();
|
||||
}
|
Reference in New Issue
Block a user