1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0024002: Overall code and build procedure refactoring -- automatic

Automatic upgrade of OCCT code by command "occt_upgrade . -nocdl":
- WOK-generated header files from inc and sources from drv are moved to src
- CDL files removed
- All packages are converted to nocdlpack
This commit is contained in:
abv
2015-07-12 07:42:38 +03:00
parent 543a996496
commit 42cf5bc1ca
15354 changed files with 623957 additions and 509844 deletions

View File

@@ -1,39 +1,108 @@
TDF_LabelNode.hxx
TDF_LabelNode.cxx
TDF_AttributeIterator.hxx
TDF_AttributeIterator.cxx
TDF_HAllocator.hxx
TDF_IDList.hxx
TDF_ListIteratorOfIDList.hxx
TDF_AttributeList.hxx
TDF_ListIteratorOfAttributeList.hxx
TDF_LabelList.hxx
TDF_ListIteratorOfLabelList.hxx
TDF_AttributeDeltaList.hxx
TDF_ListIteratorOfAttributeDeltaList.hxx
TDF_DeltaList.hxx
TDF_ListIteratorOfDeltaList.hxx
TDF_AttributeSequence.hxx
TDF_LabelSequence.hxx
TDF.cxx
TDF.hxx
TDF_Attribute.cxx
TDF_Attribute.hxx
TDF_Attribute.lxx
TDF_AttributeArray1.hxx
TDF_HAttributeArray1.hxx
TDF_IDMap.hxx
TDF_MapIteratorOfIDMap.hxx
TDF_AttributeMap.hxx
TDF_MapIteratorOfAttributeMap.hxx
TDF_AttributeDataMap.hxx
TDF_DataMapIteratorOfAttributeDataMap.hxx
TDF_AttributeDelta.cxx
TDF_AttributeDelta.hxx
TDF_AttributeDeltaList.hxx
TDF_AttributeDoubleMap.hxx
TDF_DoubleMapIteratorOfAttributeDoubleMap.hxx
TDF_AttributeIndexedMap.hxx
TDF_LabelMap.hxx
TDF_MapIteratorOfLabelMap.hxx
TDF_LabelDataMap.hxx
TDF_AttributeIterator.cxx
TDF_AttributeIterator.hxx
TDF_AttributeList.hxx
TDF_AttributeMap.hxx
TDF_AttributeSequence.hxx
TDF_ChildIDIterator.cxx
TDF_ChildIDIterator.hxx
TDF_ChildIDIterator.lxx
TDF_ChildIterator.cxx
TDF_ChildIterator.hxx
TDF_ChildIterator.lxx
TDF_ClosureMode.cxx
TDF_ClosureMode.hxx
TDF_ClosureMode.lxx
TDF_ClosureTool.cxx
TDF_ClosureTool.hxx
TDF_ComparisonTool.cxx
TDF_ComparisonTool.hxx
TDF_CopyLabel.cxx
TDF_CopyLabel.hxx
TDF_CopyLabel.lxx
TDF_CopyTool.cxx
TDF_CopyTool.hxx
TDF_Data.cxx
TDF_Data.hxx
TDF_Data.lxx
TDF_DataMapIteratorOfAttributeDataMap.hxx
TDF_DataMapIteratorOfLabelDataMap.hxx
TDF_LabelDoubleMap.hxx
TDF_DataMapIteratorOfLabelIntegerMap.hxx
TDF_DataSet.cxx
TDF_DataSet.hxx
TDF_DataSet.lxx
TDF_DefaultDeltaOnModification.cxx
TDF_DefaultDeltaOnModification.hxx
TDF_DefaultDeltaOnRemoval.cxx
TDF_DefaultDeltaOnRemoval.hxx
TDF_Delta.cxx
TDF_Delta.hxx
TDF_Delta.lxx
TDF_DeltaList.hxx
TDF_DeltaOnAddition.cxx
TDF_DeltaOnAddition.hxx
TDF_DeltaOnForget.cxx
TDF_DeltaOnForget.hxx
TDF_DeltaOnModification.cxx
TDF_DeltaOnModification.hxx
TDF_DeltaOnRemoval.cxx
TDF_DeltaOnRemoval.hxx
TDF_DeltaOnResume.cxx
TDF_DeltaOnResume.hxx
TDF_DoubleMapIteratorOfAttributeDoubleMap.hxx
TDF_DoubleMapIteratorOfGUIDProgIDMap.hxx
TDF_DoubleMapIteratorOfLabelDoubleMap.hxx
TDF_GUIDProgIDMap.hxx
TDF_HAllocator.hxx
TDF_HAttributeArray1.hxx
TDF_IDFilter.cxx
TDF_IDFilter.hxx
TDF_IDFilter.lxx
TDF_IDList.hxx
TDF_IDMap.hxx
TDF_Label.cxx
TDF_Label.hxx
TDF_Label.lxx
TDF_LabelDataMap.hxx
TDF_LabelDoubleMap.hxx
TDF_LabelIndexedMap.hxx
TDF_LabelIntegerMap.hxx
TDF_DataMapIteratorOfLabelIntegerMap.hxx
TDF_GUIDProgIDMap.hxx
TDF_DoubleMapIteratorOfGUIDProgIDMap.hxx
TDF_LabelList.hxx
TDF_LabelMap.hxx
TDF_LabelMapHasher.cxx
TDF_LabelMapHasher.hxx
TDF_LabelMapHasher.lxx
TDF_LabelNode.cxx
TDF_LabelNode.hxx
TDF_LabelNodePtr.hxx
TDF_LabelSequence.hxx
TDF_ListIteratorOfAttributeDeltaList.hxx
TDF_ListIteratorOfAttributeList.hxx
TDF_ListIteratorOfDeltaList.hxx
TDF_ListIteratorOfIDList.hxx
TDF_ListIteratorOfLabelList.hxx
TDF_MapIteratorOfAttributeMap.hxx
TDF_MapIteratorOfIDMap.hxx
TDF_MapIteratorOfLabelMap.hxx
TDF_Reference.cxx
TDF_Reference.hxx
TDF_RelocationTable.cxx
TDF_RelocationTable.hxx
TDF_TagSource.cxx
TDF_TagSource.hxx
TDF_Tool.cxx
TDF_Tool.hxx
TDF_Transaction.cxx
TDF_Transaction.hxx
TDF_Transaction.lxx

View File

@@ -1,246 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- --------
---Version: 0.0
--Version Date Purpose
-- 0.0 Feb 5 1997 Creation
package TDF
---Purpose: This package provides data framework for binding
-- features and data structures.
--
-- The feature structure is a tree used to bind
-- semantic informations about each feature together.
--
-- The only one concrete attribute defined in this
-- package is the TagSource attribute.This attribute
-- is used for random creation of child labels under
-- a given label. Tags are randomly delivered.
---Category: GUID - AttributeID
-- 2a96b611-ec8b-11d0-bee7-080009dc3333 TDataStd_TagSource
uses
Standard,
MMgt,
TColStd,
TCollection
is
---Category: DF Structure Classes
-- ==============================================================
class Data;
class Label;
imported HAllocator;
imported LabelNode;
pointer LabelNodePtr to LabelNode from TDF;
deferred class Attribute;
class TagSource;
class Reference;
---Category: DF Copy algorithms
-- ==============================================================
class ClosureMode;
class ClosureTool;
class CopyTool;
class CopyLabel;
class ComparisonTool;
---Category: DF Transaction & Delta
-- ==============================================================
class Transaction;
class Delta;
deferred class AttributeDelta;
class DeltaOnAddition;
class DeltaOnForget;
class DeltaOnResume;
deferred class DeltaOnRemoval;
deferred class DeltaOnModification;
class DefaultDeltaOnRemoval;
class DefaultDeltaOnModification;
---Category: DF Basic Tools
-- ==============================================================
class ChildIterator;
class ChildIDIterator;
imported AttributeIterator;
---Category: DF Specific Tools
-- ==============================================================
class DataSet;
class RelocationTable;
class Tool;
class LabelMapHasher;
class IDFilter;
---Category: DF Classes Instantiations
-- ==============================================================
-- Lists
-- -----
imported IDList;
imported ListIteratorOfIDList;
imported AttributeList;
imported ListIteratorOfAttributeList;
imported LabelList;
imported ListIteratorOfLabelList;
imported AttributeDeltaList;
imported ListIteratorOfAttributeDeltaList;
imported DeltaList;
imported ListIteratorOfDeltaList;
-- Sequences
-- ---------
imported AttributeSequence;
imported LabelSequence;
-- Arrays
-- ------
imported AttributeArray1;
imported transient class HAttributeArray1;
-- Maps
-- ----
imported IDMap;
imported MapIteratorOfIDMap;
imported AttributeMap;
imported MapIteratorOfAttributeMap;
imported AttributeDataMap;
imported DataMapIteratorOfAttributeDataMap;
imported AttributeDoubleMap;
imported DoubleMapIteratorOfAttributeDoubleMap;
imported AttributeIndexedMap;
imported LabelMap;
imported MapIteratorOfLabelMap;
imported LabelDataMap;
imported DataMapIteratorOfLabelDataMap;
imported LabelDoubleMap;
imported DoubleMapIteratorOfLabelDoubleMap;
imported LabelIndexedMap;
imported LabelIntegerMap;
imported DataMapIteratorOfLabelIntegerMap;
imported GUIDProgIDMap;
imported DoubleMapIteratorOfGUIDProgIDMap;
---Category: Package methods
-- ==============================================================
LowestID returns GUID from Standard;
---Purpose: Returns ID "00000000-0000-0000-0000-000000000000",
-- sometimes used as null ID.
--
---C++: return const &
UppestID returns GUID from Standard;
---Purpose: Returns ID "ffffffff-ffff-ffff-ffff-ffffffffffff".
--
---C++: return const &
AddLinkGUIDToProgID( ID : GUID from Standard; ProgID : ExtendedString from TCollection );
---Purpose: Sets link between GUID and ProgID in hidden DataMap
GUIDFromProgID( ProgID : ExtendedString from TCollection; ID : in out GUID from Standard )
returns Boolean from Standard;
---Purpose: Returns True if there is GUID for given <ProgID> then GUID is returned in <ID>
ProgIDFromGUID( ID : GUID from Standard; ProgID : in out ExtendedString from TCollection )
returns Boolean from Standard;
---Purpose: Returns True if there is ProgID for given <ID> then ProgID is returned in <ProgID>
end TDF;

View File

@@ -14,14 +14,13 @@
// commercial license or contractual agreement.
// -------
// Version: 0.0
//Version Date Purpose
// 0.0 Nov 14 1997 Creation
#include <TDF.ixx>
#include <Standard_GUID.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TDF.hxx>
#include <TDF_GUIDProgIDMap.hxx>
static TDF_GUIDProgIDMap guidprogidmap;

138
src/TDF/TDF.hxx Normal file
View File

@@ -0,0 +1,138 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_HeaderFile
#define _TDF_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
class Standard_GUID;
class TCollection_ExtendedString;
class TDF_Data;
class TDF_Label;
class TDF_Attribute;
class TDF_TagSource;
class TDF_Reference;
class TDF_ClosureMode;
class TDF_ClosureTool;
class TDF_CopyTool;
class TDF_CopyLabel;
class TDF_ComparisonTool;
class TDF_Transaction;
class TDF_Delta;
class TDF_AttributeDelta;
class TDF_DeltaOnAddition;
class TDF_DeltaOnForget;
class TDF_DeltaOnResume;
class TDF_DeltaOnRemoval;
class TDF_DeltaOnModification;
class TDF_DefaultDeltaOnRemoval;
class TDF_DefaultDeltaOnModification;
class TDF_ChildIterator;
class TDF_ChildIDIterator;
class TDF_DataSet;
class TDF_RelocationTable;
class TDF_Tool;
class TDF_LabelMapHasher;
class TDF_IDFilter;
//! This package provides data framework for binding
//! features and data structures.
//!
//! The feature structure is a tree used to bind
//! semantic informations about each feature together.
//!
//! The only one concrete attribute defined in this
//! package is the TagSource attribute.This attribute
//! is used for random creation of child labels under
//! a given label. Tags are randomly delivered.
class TDF
{
public:
DEFINE_STANDARD_ALLOC
//! Returns ID "00000000-0000-0000-0000-000000000000",
//! sometimes used as null ID.
Standard_EXPORT static const Standard_GUID& LowestID();
//! Returns ID "ffffffff-ffff-ffff-ffff-ffffffffffff".
Standard_EXPORT static const Standard_GUID& UppestID();
//! Sets link between GUID and ProgID in hidden DataMap
Standard_EXPORT static void AddLinkGUIDToProgID (const Standard_GUID& ID, const TCollection_ExtendedString& ProgID);
//! Returns True if there is GUID for given <ProgID> then GUID is returned in <ID>
Standard_EXPORT static Standard_Boolean GUIDFromProgID (const TCollection_ExtendedString& ProgID, Standard_GUID& ID);
//! Returns True if there is ProgID for given <ID> then ProgID is returned in <ProgID>
Standard_EXPORT static Standard_Boolean ProgIDFromGUID (const Standard_GUID& ID, TCollection_ExtendedString& ProgID);
protected:
private:
friend class TDF_Data;
friend class TDF_Label;
friend class TDF_Attribute;
friend class TDF_TagSource;
friend class TDF_Reference;
friend class TDF_ClosureMode;
friend class TDF_ClosureTool;
friend class TDF_CopyTool;
friend class TDF_CopyLabel;
friend class TDF_ComparisonTool;
friend class TDF_Transaction;
friend class TDF_Delta;
friend class TDF_AttributeDelta;
friend class TDF_DeltaOnAddition;
friend class TDF_DeltaOnForget;
friend class TDF_DeltaOnResume;
friend class TDF_DeltaOnRemoval;
friend class TDF_DeltaOnModification;
friend class TDF_DefaultDeltaOnRemoval;
friend class TDF_DefaultDeltaOnModification;
friend class TDF_ChildIterator;
friend class TDF_ChildIDIterator;
friend class TDF_DataSet;
friend class TDF_RelocationTable;
friend class TDF_Tool;
friend class TDF_LabelMapHasher;
friend class TDF_IDFilter;
};
#endif // _TDF_HeaderFile

View File

@@ -1,525 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -----------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Feb 4 1997 Creation
deferred class Attribute from TDF
inherits TShared from MMgt
---Purpose: A class each application has to implement. It is
-- used to contain the application data.
-- This abstract class, alongwith Label,
-- is one of the cornerstones of Model Editor.
-- The groundwork is to define the root of
-- information. This information is to be
-- attached to a Label, and could be of any of
-- the following types:
-- - a feature
-- - a constraint
-- - a comment
--
-- Contents:
-- ---------
--
-- Each software component who'd like to attach its
-- own information to a label has to inherit from
-- this class and has to add its own information as
-- fields of this new class.
--
-- Identification:
-- ---------------
--
-- An attribute can be identified by its ID. Every
-- attributes used with the same meaning (for
-- exemple: Integer, String, Topology...) have the
-- same worldwide unique ID.
--
-- Addition:
-- ---------
--
-- An attribute can be added to a label only if there
-- is no attribute yet with the same ID. Call-back
-- methods are offered, called automatically before
-- and after the addition action.
--
-- Removal:
-- --------
--
-- An attribute can be removed from a label only if
-- there is an attribute yet with the same
-- ID. Call-back methods are offered, called
-- automatically before and after the removal
-- action. A removed attribute cannot be found
-- again. After a removal, only an addition of an
-- attribute with the sane ID is possible (no
-- backup...).
--
-- Modification & Transaction:
-- ---------------------------
--
-- An attribute can be backuped before a
-- modification. Only one backup attribute by
-- transaction is possible. The modification can be
-- forgotten (abort transaction) or validated (commit
-- transaction).
--
-- BackupCopy and restore are methods used by the backup or
-- abort transaction actions. BackupCopy is called by
-- Backup to generate an attribute with the same
-- contents as the current one. Restore is called
-- when aborting a transaction to transfer the
-- backuped contents into the current
-- attribute. These methods must be implemented by
-- end use inheriting classes.
--
-- A standard implementation of BackupCopy is provided, but
-- it is not necessary a good one for any use.
--
-- Copy use methods:
-- -----------------
--
-- Paste and NewEmpty methods are used by the copy
-- algorithms. The goal of "Paste" is to transfer an
-- attribute new contents into another attribute. The
-- goal of "NewEmpty" is to create an attribute
-- whithout contents, to be further filled with the
-- new contents of another one. These 2 methods must
-- be implemented by end use inheriting classes.
--
-- AttributeDelta:
-- ---------------
--
-- An AttributeDelta is the difference between to
-- attribute values states. These methods must be
-- implemented by end use inheriting classes, to
-- profit from the delta services.
uses
GUID from Standard,
AttributeIndexedMap from TDF,
DataSet from TDF,
AttributeDelta from TDF,
DeltaOnModification from TDF,
DeltaOnRemoval from TDF,
DeltaOnResume from TDF,
DeltaOnAddition from TDF,
DeltaOnForget from TDF,
IDFilter from TDF,
Label from TDF,
LabelNode from TDF,
LabelNodePtr from TDF,
RelocationTable from TDF
raises DomainError from Standard
is
Initialize
returns Attribute from TDF;
---Purpose: Initializes fields.
---Category: Information access.
-- ==============================================================
-- Implement such a method and use it to implement ID(me).
--
-- GetID (myclass)
-- -C++: return const &
-- returns GUID from Standard;
--
-- const Standard_GUID& MyClass::GetID() const
-- {
-- static Standard_GUID myID("12345678-1234-1234-1234-1234567890ab");
-- return myID;
-- }
ID(me)
returns GUID from Standard
is deferred;
---Purpose: Returns the ID of the attribute.
--
---C++: return const &
Label(me)
returns Label from TDF;
---Purpose: Returns the label to which the attribute is
-- attached. If the label is not included in a DF,
-- the label is null. See Label.
-- Warning
-- If the label is not included in a data
-- framework, it is null.
-- This function should not be redefined inline.
---C++: return const
Transaction(me)
returns Integer from Standard;
---Purpose: Returns the transaction index in which the
-- attribute has been created or modified.
--
---C++: inline
UntilTransaction(me)
returns Integer from Standard;
---Purpose: Returns the upper transaction index until which
-- the attribute is/was valid. This number may
-- vary. A removed attribute validity range is
-- reduced to its transaction index.
IsValid(me)
returns Boolean from Standard;
---Purpose: Returns true if the attribute is valid; i.e. not a
-- backuped or removed one.
--
---C++: inline
IsNew(me)
returns Boolean from Standard;
---Purpose: Returns true if the attribute has no backup
--
---C++: inline
IsForgotten(me)
returns Boolean from Standard;
---Purpose: Returns true if the attribute forgotten status is
-- set.
--
---C++: inline
---Purpose: ShortCut Methods concerning associated attributes
-- =================================================
IsAttribute (me; anID : GUID from Standard)
returns Boolean from Standard;
---Purpose: Returns true if it exists an associated attribute
-- of <me> with <anID> as ID.
FindAttribute (me; anID : GUID from Standard;
anAttribute : in out Attribute from TDF)
returns Boolean from Standard;
---Purpose: Finds an associated attribute of <me>, according
-- to <anID>. the returned <anAttribute> is a valid
-- one. The method returns True if found, False
-- otherwise. A removed attribute cannot be found using
-- this method.
AddAttribute (me; other : Attribute from TDF)
raises DomainError from Standard;
---Purpose: Adds an Attribute <other> to the label of
-- <me>.Raises if there is already one of the same
-- GUID fhan <other>.
ForgetAttribute (me; aguid : GUID from Standard)
returns Boolean from Standard;
---Purpose: Forgets the Attribute of GUID <aguid> associated
-- to the label of <me>. Be carefull that if <me> is
-- the attribute of <guid>, <me> will have a null label
-- after this call. If the attribute doesn't exist
-- returns False. Otherwise returns True.
ForgetAllAttributes (me; clearChildren : Boolean from Standard = Standard_True);
---Purpose: Forgets all the attributes attached to the label
-- of <me>. Does it on the sub-labels if
-- <clearChildren> is set to true. Of course, this
-- method is compatible with Transaction & Delta
-- mecanisms. Be carefull that if <me> will have a
-- null label after this call
---Category: Immediate callbacks
-- ==============================================================
AfterAddition(me: mutable)
is virtual;
---Purpose: Something to do after adding an Attribute to a label.
BeforeRemoval(me: mutable)
is virtual;
---Purpose: Something to do before removing an Attribute from
-- a label.
BeforeForget(me: mutable)
is virtual;
---Purpose: Something to do before forgetting an Attribute to a
-- label.
AfterResume(me: mutable)
is virtual;
---Purpose: Something to do after resuming an Attribute from
-- a label.
---Category: Retrieval callbacks
-- ==============================================================
-- The following method is called after a whole
-- Transient-Persistent translation.
AfterRetrieval(me: mutable;
forceIt : Boolean from Standard = Standard_False)
returns Boolean from Standard
is virtual;
---Purpose: Something to do AFTER creation of an attribute by
-- persistent-transient translation. The returned
-- status says if AfterUndo has been performed (true)
-- or if this callback must be called once again
-- further (false). If <forceIt> is set to true, the
-- method MUST perform and return true. Does nothing
-- by default and returns true.
---Category: Undo callbacks
-- ==============================================================
-- The following methods are called before/after a whole Delta is
-- applied. They are called for each concerned attribute.
BeforeUndo(me: mutable;
anAttDelta : AttributeDelta from TDF;
forceIt : Boolean from Standard = Standard_False)
returns Boolean from Standard
is virtual;
---Purpose: Something to do before applying <anAttDelta>. The
-- returned status says if AfterUndo has been
-- performed (true) or if this callback must be
-- called once again further (false). If <forceIt> is
-- set to true, the method MUST perform and return
-- true. Does nothing by default and returns true.
AfterUndo(me: mutable;
anAttDelta : AttributeDelta from TDF;
forceIt : Boolean from Standard = Standard_False)
returns Boolean from Standard
is virtual;
---Purpose: Something to do after applying <anAttDelta>. The
-- returned status says if AfterUndo has been
-- performed (true) or if this callback must be
-- called once again further (false). If <forceIt> is
-- set to true, the method MUST perform and return
-- true. Does nothing by default and returns true.
---Category: Modification & Transaction
-- ==============================================================
BeforeCommitTransaction(me : mutable)
---Purpose: A callback.
-- By default does nothing.
-- It is called by TDF_Data::CommitTransaction() method.
is virtual;
Backup(me : mutable);
---Purpose: Backups the attribute. The backuped attribute is
-- flagged "Backuped" and not "Valid".
--
-- The method does nothing:
--
-- 1) If the attribute transaction number is equal to
-- the current transaction number (the attribute has
-- already been backuped).
--
-- 2) If the attribute is not attached to a label.
IsBackuped(me)
returns Boolean from Standard;
---Purpose: Returns true if the attribute backup status is
-- set. This status is set/unset by the
-- Backup() method.
--
---C++: inline
BackupCopy(me) returns Attribute from TDF
is virtual;
---Purpose: Copies the attribute contents into a new other
-- attribute. It is used by Backup().
Restore(me: mutable;
anAttribute : Attribute from TDF)
is deferred;
---Purpose: Restores the backuped contents from <anAttribute>
-- into this one. It is used when aborting a
-- transaction.
---Category: Delta generation
-- ==============================================================
DeltaOnAddition(me)
returns DeltaOnAddition from TDF
---Purpose : Makes an AttributeDelta because <me>
-- appeared. The only known use of a redefinition of
-- this method is to return a null handle (no delta).
is virtual;
DeltaOnForget(me)
returns DeltaOnForget from TDF
---Purpose : Makes an AttributeDelta because <me> has been
-- forgotten.
is virtual;
DeltaOnResume(me)
returns DeltaOnResume from TDF
---Purpose : Makes an AttributeDelta because <me> has been
-- resumed.
is virtual;
DeltaOnModification(me; anOldAttribute : Attribute from TDF)
returns DeltaOnModification from TDF
---Purpose : Makes a DeltaOnModification between <me> and
-- <anOldAttribute.
is virtual;
DeltaOnModification(me : mutable; aDelta : DeltaOnModification from TDF)
is virtual;
---Purpose: Applies a DeltaOnModification to <me>.
DeltaOnRemoval(me)
returns DeltaOnRemoval from TDF
---Purpose : Makes a DeltaOnRemoval on <me> because <me> has
-- disappeared from the DS.
is virtual;
---Category: Copy
-- ==============================================================
NewEmpty(me)
returns Attribute from TDF
is deferred;
---Purpose: Returns an new empty attribute from the good end
-- type. It is used by the copy algorithm.
Paste(me;
intoAttribute : Attribute from TDF;
aRelocationTable : RelocationTable from TDF)
is deferred;
---Purpose: This method is different from the "Copy" one,
-- because it is used when copying an attribute from
-- a source structure into a target structure. This
-- method may paste the contents of <me> into
-- <intoAttribute>.
--
-- The given pasted attribute can be full or empty of
-- its contents. But don't make a NEW! Just set the
-- contents!
--
-- It is possible to use <aRelocationTable> to
-- get/set the relocation value of a source
-- attribute.
References(me; aDataSet : DataSet from TDF)
is virtual;
---Purpose: Adds the first level referenced attributes and labels
-- to <aDataSet>.
--
-- For this, use the AddLabel or AddAttribute of
-- DataSet.
--
-- If there is none, do not implement the method.
---Category: Dump
-- ==============================================================
Dump(me; anOS : in out OStream from Standard)
returns OStream from Standard
is virtual;
---Purpose: Dumps the minimum information about <me> on
-- <aStream>.
--
---C++: return &
---C++: alias operator<<
ExtendedDump(me;
anOS : in out OStream from Standard;
aFilter : IDFilter from TDF;
aMap : in out AttributeIndexedMap from TDF)
is virtual;
---Purpose: Dumps the attribute content on <aStream>, using
-- <aMap> like this: if an attribute is not in the
-- map, first put add it to the map and then dump it.
-- Use the map rank instead of dumping each attribute
-- field.
---Category: Miscelleaneous
-- ==============================================================
---Category: Private area...
-- ==============================================================
Validate(me: mutable; aStatus : Boolean from Standard)
is private;
---Purpose: Set the "Valid" status with <aStatus>.
--
---C++: inline
Forget(me: mutable; aTransaction : Integer from Standard);
---Purpose: Forgets the attribute. <aTransaction> is the
-- current transaction in which the forget is done. A
-- forgotten attribute is also flagged not "Valid".
--
-- A forgotten attribute is invisible. Set also the
-- "Valid" status to False. Obvioulsy, DF cannot
-- empty an attribute (this has a semantic
-- signification), but can remove it from the
-- structure. So, a forgotten attribute is NOT an empty
-- one, but a soon DEAD one.
--
-- Should be private.
Resume(me: mutable)
is private;
---Purpose: Resumes the attribute (undos Forget action).
Backup(me: mutable; aStatus : Boolean from Standard)
is private;
---Purpose: Set the "backuped" status with <aStatus>.
--
---C++: inline
RemoveBackup(me : mutable) is private;
---Purpose: Removes the last backup attribute, if it exists.
fields
myLabelNode : LabelNodePtr from TDF;
myTransaction : Integer from Standard;
mySavedTransaction : Integer from Standard;
myFlags : Integer from Standard;
myNext : Attribute from TDF;
myBackup : Attribute from TDF;
friends
class Data from TDF,
class Label from TDF,
class LabelNode from TDF,
class AttributeIterator from TDF,
class DeltaOnForget from TDF
end Attribute;

View File

@@ -14,28 +14,33 @@
// commercial license or contractual agreement.
// ------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Feb 7 1997 Creation
#include <TDF_Attribute.ixx>
#include <Standard_DomainError.hxx>
#include <Standard_GUID.hxx>
#include <Standard_ImmutableObject.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_Data.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_DefaultDeltaOnModification.hxx>
#include <TDF_DefaultDeltaOnRemoval.hxx>
#include <TDF_DeltaOnAddition.hxx>
#include <TDF_DeltaOnForget.hxx>
#include <TDF_DeltaOnModification.hxx>
#include <TDF_DeltaOnRemoval.hxx>
#include <TDF_DeltaOnResume.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelNode.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_ImmutableObject.hxx>
#undef TDF_DATA_COMMIT_OPTIMIZED
//=======================================================================

410
src/TDF/TDF_Attribute.hxx Normal file
View File

@@ -0,0 +1,410 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Attribute_HeaderFile
#define _TDF_Attribute_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_LabelNodePtr.hxx>
#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <TDF_AttributeIndexedMap.hxx>
class Standard_DomainError;
class TDF_Data;
class TDF_Label;
class TDF_LabelNode;
class TDF_AttributeIterator;
class TDF_DeltaOnForget;
class Standard_GUID;
class TDF_AttributeDelta;
class TDF_DeltaOnAddition;
class TDF_DeltaOnResume;
class TDF_DeltaOnModification;
class TDF_DeltaOnRemoval;
class TDF_RelocationTable;
class TDF_DataSet;
class TDF_IDFilter;
class TDF_Attribute;
DEFINE_STANDARD_HANDLE(TDF_Attribute, MMgt_TShared)
//! A class each application has to implement. It is
//! used to contain the application data.
//! This abstract class, alongwith Label,
//! is one of the cornerstones of Model Editor.
//! The groundwork is to define the root of
//! information. This information is to be
//! attached to a Label, and could be of any of
//! the following types:
//! - a feature
//! - a constraint
//! - a comment
//!
//! Contents:
//! ---------
//!
//! Each software component who'd like to attach its
//! own information to a label has to inherit from
//! this class and has to add its own information as
//! fields of this new class.
//!
//! Identification:
//! ---------------
//!
//! An attribute can be identified by its ID. Every
//! attributes used with the same meaning (for
//! exemple: Integer, String, Topology...) have the
//! same worldwide unique ID.
//!
//! Addition:
//! ---------
//!
//! An attribute can be added to a label only if there
//! is no attribute yet with the same ID. Call-back
//! methods are offered, called automatically before
//! and after the addition action.
//!
//! Removal:
//! --------
//!
//! An attribute can be removed from a label only if
//! there is an attribute yet with the same
//! ID. Call-back methods are offered, called
//! automatically before and after the removal
//! action. A removed attribute cannot be found
//! again. After a removal, only an addition of an
//! attribute with the sane ID is possible (no
//! backup...).
//!
//! Modification & Transaction:
//! ---------------------------
//!
//! An attribute can be backuped before a
//! modification. Only one backup attribute by
//! transaction is possible. The modification can be
//! forgotten (abort transaction) or validated (commit
//! transaction).
//!
//! BackupCopy and restore are methods used by the backup or
//! abort transaction actions. BackupCopy is called by
//! Backup to generate an attribute with the same
//! contents as the current one. Restore is called
//! when aborting a transaction to transfer the
//! backuped contents into the current
//! attribute. These methods must be implemented by
//! end use inheriting classes.
//!
//! A standard implementation of BackupCopy is provided, but
//! it is not necessary a good one for any use.
//!
//! Copy use methods:
//! -----------------
//!
//! Paste and NewEmpty methods are used by the copy
//! algorithms. The goal of "Paste" is to transfer an
//! attribute new contents into another attribute. The
//! goal of "NewEmpty" is to create an attribute
//! whithout contents, to be further filled with the
//! new contents of another one. These 2 methods must
//! be implemented by end use inheriting classes.
//!
//! AttributeDelta:
//! ---------------
//!
//! An AttributeDelta is the difference between to
//! attribute values states. These methods must be
//! implemented by end use inheriting classes, to
//! profit from the delta services.
class TDF_Attribute : public MMgt_TShared
{
public:
//! Returns the ID of the attribute.
Standard_EXPORT virtual const Standard_GUID& ID() const = 0;
//! Returns the label to which the attribute is
//! attached. If the label is not included in a DF,
//! the label is null. See Label.
//! Warning
//! If the label is not included in a data
//! framework, it is null.
//! This function should not be redefined inline.
Standard_EXPORT const TDF_Label Label() const;
//! Returns the transaction index in which the
//! attribute has been created or modified.
Standard_Integer Transaction() const;
//! Returns the upper transaction index until which
//! the attribute is/was valid. This number may
//! vary. A removed attribute validity range is
//! reduced to its transaction index.
Standard_EXPORT Standard_Integer UntilTransaction() const;
//! Returns true if the attribute is valid; i.e. not a
//! backuped or removed one.
Standard_Boolean IsValid() const;
//! Returns true if the attribute has no backup
Standard_Boolean IsNew() const;
//! Returns true if the attribute forgotten status is
//! set.
//!
//! ShortCut Methods concerning associated attributes
//! =================================================
Standard_Boolean IsForgotten() const;
//! Returns true if it exists an associated attribute
//! of <me> with <anID> as ID.
Standard_EXPORT Standard_Boolean IsAttribute (const Standard_GUID& anID) const;
//! Finds an associated attribute of <me>, according
//! to <anID>. the returned <anAttribute> is a valid
//! one. The method returns True if found, False
//! otherwise. A removed attribute cannot be found using
//! this method.
Standard_EXPORT Standard_Boolean FindAttribute (const Standard_GUID& anID, Handle(TDF_Attribute)& anAttribute) const;
//! Adds an Attribute <other> to the label of
//! <me>.Raises if there is already one of the same
//! GUID fhan <other>.
Standard_EXPORT void AddAttribute (const Handle(TDF_Attribute)& other) const;
//! Forgets the Attribute of GUID <aguid> associated
//! to the label of <me>. Be carefull that if <me> is
//! the attribute of <guid>, <me> will have a null label
//! after this call. If the attribute doesn't exist
//! returns False. Otherwise returns True.
Standard_EXPORT Standard_Boolean ForgetAttribute (const Standard_GUID& aguid) const;
//! Forgets all the attributes attached to the label
//! of <me>. Does it on the sub-labels if
//! <clearChildren> is set to true. Of course, this
//! method is compatible with Transaction & Delta
//! mecanisms. Be carefull that if <me> will have a
//! null label after this call
Standard_EXPORT void ForgetAllAttributes (const Standard_Boolean clearChildren = Standard_True) const;
//! Something to do after adding an Attribute to a label.
Standard_EXPORT virtual void AfterAddition();
//! Something to do before removing an Attribute from
//! a label.
Standard_EXPORT virtual void BeforeRemoval();
//! Something to do before forgetting an Attribute to a
//! label.
Standard_EXPORT virtual void BeforeForget();
//! Something to do after resuming an Attribute from
//! a label.
Standard_EXPORT virtual void AfterResume();
//! Something to do AFTER creation of an attribute by
//! persistent-transient translation. The returned
//! status says if AfterUndo has been performed (true)
//! or if this callback must be called once again
//! further (false). If <forceIt> is set to true, the
//! method MUST perform and return true. Does nothing
//! by default and returns true.
Standard_EXPORT virtual Standard_Boolean AfterRetrieval (const Standard_Boolean forceIt = Standard_False);
//! Something to do before applying <anAttDelta>. The
//! returned status says if AfterUndo has been
//! performed (true) or if this callback must be
//! called once again further (false). If <forceIt> is
//! set to true, the method MUST perform and return
//! true. Does nothing by default and returns true.
Standard_EXPORT virtual Standard_Boolean BeforeUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False);
//! Something to do after applying <anAttDelta>. The
//! returned status says if AfterUndo has been
//! performed (true) or if this callback must be
//! called once again further (false). If <forceIt> is
//! set to true, the method MUST perform and return
//! true. Does nothing by default and returns true.
Standard_EXPORT virtual Standard_Boolean AfterUndo (const Handle(TDF_AttributeDelta)& anAttDelta, const Standard_Boolean forceIt = Standard_False);
//! A callback.
//! By default does nothing.
//! It is called by TDF_Data::CommitTransaction() method.
Standard_EXPORT virtual void BeforeCommitTransaction();
//! Backups the attribute. The backuped attribute is
//! flagged "Backuped" and not "Valid".
//!
//! The method does nothing:
//!
//! 1) If the attribute transaction number is equal to
//! the current transaction number (the attribute has
//! already been backuped).
//!
//! 2) If the attribute is not attached to a label.
Standard_EXPORT void Backup();
//! Returns true if the attribute backup status is
//! set. This status is set/unset by the
//! Backup() method.
Standard_Boolean IsBackuped() const;
//! Copies the attribute contents into a new other
//! attribute. It is used by Backup().
Standard_EXPORT virtual Handle(TDF_Attribute) BackupCopy() const;
//! Restores the backuped contents from <anAttribute>
//! into this one. It is used when aborting a
//! transaction.
Standard_EXPORT virtual void Restore (const Handle(TDF_Attribute)& anAttribute) = 0;
//! Makes an AttributeDelta because <me>
//! appeared. The only known use of a redefinition of
//! this method is to return a null handle (no delta).
Standard_EXPORT virtual Handle(TDF_DeltaOnAddition) DeltaOnAddition() const;
//! Makes an AttributeDelta because <me> has been
//! forgotten.
Standard_EXPORT virtual Handle(TDF_DeltaOnForget) DeltaOnForget() const;
//! Makes an AttributeDelta because <me> has been
//! resumed.
Standard_EXPORT virtual Handle(TDF_DeltaOnResume) DeltaOnResume() const;
//! Makes a DeltaOnModification between <me> and
//! <anOldAttribute.
Standard_EXPORT virtual Handle(TDF_DeltaOnModification) DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const;
//! Applies a DeltaOnModification to <me>.
Standard_EXPORT virtual void DeltaOnModification (const Handle(TDF_DeltaOnModification)& aDelta);
//! Makes a DeltaOnRemoval on <me> because <me> has
//! disappeared from the DS.
Standard_EXPORT virtual Handle(TDF_DeltaOnRemoval) DeltaOnRemoval() const;
//! Returns an new empty attribute from the good end
//! type. It is used by the copy algorithm.
Standard_EXPORT virtual Handle(TDF_Attribute) NewEmpty() const = 0;
//! This method is different from the "Copy" one,
//! because it is used when copying an attribute from
//! a source structure into a target structure. This
//! method may paste the contents of <me> into
//! <intoAttribute>.
//!
//! The given pasted attribute can be full or empty of
//! its contents. But don't make a NEW! Just set the
//! contents!
//!
//! It is possible to use <aRelocationTable> to
//! get/set the relocation value of a source
//! attribute.
Standard_EXPORT virtual void Paste (const Handle(TDF_Attribute)& intoAttribute, const Handle(TDF_RelocationTable)& aRelocationTable) const = 0;
//! Adds the first level referenced attributes and labels
//! to <aDataSet>.
//!
//! For this, use the AddLabel or AddAttribute of
//! DataSet.
//!
//! If there is none, do not implement the method.
Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& aDataSet) const;
//! Dumps the minimum information about <me> on
//! <aStream>.
Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const;
Standard_OStream& operator<< (Standard_OStream& anOS) const
{
return Dump(anOS);
}
//! Dumps the attribute content on <aStream>, using
//! <aMap> like this: if an attribute is not in the
//! map, first put add it to the map and then dump it.
//! Use the map rank instead of dumping each attribute
//! field.
Standard_EXPORT virtual void ExtendedDump (Standard_OStream& anOS, const TDF_IDFilter& aFilter, TDF_AttributeIndexedMap& aMap) const;
//! Forgets the attribute. <aTransaction> is the
//! current transaction in which the forget is done. A
//! forgotten attribute is also flagged not "Valid".
//!
//! A forgotten attribute is invisible. Set also the
//! "Valid" status to False. Obvioulsy, DF cannot
//! empty an attribute (this has a semantic
//! signification), but can remove it from the
//! structure. So, a forgotten attribute is NOT an empty
//! one, but a soon DEAD one.
//!
//! Should be private.
Standard_EXPORT void Forget (const Standard_Integer aTransaction);
friend class TDF_Data;
friend class TDF_Label;
friend class TDF_LabelNode;
friend class TDF_AttributeIterator;
friend class TDF_DeltaOnForget;
DEFINE_STANDARD_RTTI(TDF_Attribute,MMgt_TShared)
protected:
//! Initializes fields.
Standard_EXPORT TDF_Attribute();
private:
//! Set the "Valid" status with <aStatus>.
void Validate (const Standard_Boolean aStatus);
//! Resumes the attribute (undos Forget action).
Standard_EXPORT void Resume();
//! Set the "backuped" status with <aStatus>.
void Backup (const Standard_Boolean aStatus);
//! Removes the last backup attribute, if it exists.
Standard_EXPORT void RemoveBackup();
TDF_LabelNodePtr myLabelNode;
Standard_Integer myTransaction;
Standard_Integer mySavedTransaction;
Standard_Integer myFlags;
Handle(TDF_Attribute) myNext;
Handle(TDF_Attribute) myBackup;
};
#include <TDF_Attribute.lxx>
#endif // _TDF_Attribute_HeaderFile

View File

@@ -1,87 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ----------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Sep 8 1997 Creation
deferred class AttributeDelta from TDF inherits TShared from MMgt
---Purpose: This class discribes the services we need to
-- implement Delta and Undo/Redo services.
--
-- AttributeDeltas are applied in an unpredictable
-- order. But by the redefinition of the method
-- IsNowApplicable, a condition can be verified
-- before application. If the AttributeDelta is not
-- yet applicable, it is put at the end of the
-- AttributeDelta list, to be treated later. If a
-- dead lock if found on the list, the
-- AttributeDeltas are forced to be applied in an
-- unpredictable order.
uses
Label from TDF,
Attribute from TDF
is
Initialize(anAttribute: Attribute from TDF);
Apply(me : mutable)
is deferred;
---Purpose: Applies the delta to the attribute.
Label(me)
returns Label from TDF;
---Purpose: Returns the label concerned by <me>.
Attribute(me)
returns Attribute from TDF;
---Purpose: Returns the reference attribute.
ID(me)
returns GUID from Standard;
---Purpose: Returns the ID of the attribute concerned by <me>.
---Category: Miscelleaneous
-- --------------------------------------------------------------
Dump(me; OS : in out OStream from Standard)
returns OStream from Standard
is virtual;
---Purpose: Dumps the contents.
--
---C++: return &
---C++: alias operator<<
fields
myAttribute : Attribute from TDF;
myLabel : Label from TDF;
end AttributeDelta;

View File

@@ -14,27 +14,22 @@
// commercial license or contractual agreement.
// ----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Sep 8 1997 Creation
#include <TDF_AttributeDelta.ixx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_Label.hxx>
#include <TDF_Tool.hxx>
#include <TCollection_AsciiString.hxx>
//=======================================================================
//function : TDF_AttributeDelta
//purpose :
//=======================================================================
TDF_AttributeDelta::TDF_AttributeDelta
(const Handle(TDF_Attribute)& anAttribute)
: myAttribute(anAttribute),

View File

@@ -0,0 +1,97 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_AttributeDelta_HeaderFile
#define _TDF_AttributeDelta_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_Label.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_OStream.hxx>
class TDF_Attribute;
class TDF_Label;
class Standard_GUID;
class TDF_AttributeDelta;
DEFINE_STANDARD_HANDLE(TDF_AttributeDelta, MMgt_TShared)
//! This class discribes the services we need to
//! implement Delta and Undo/Redo services.
//!
//! AttributeDeltas are applied in an unpredictable
//! order. But by the redefinition of the method
//! IsNowApplicable, a condition can be verified
//! before application. If the AttributeDelta is not
//! yet applicable, it is put at the end of the
//! AttributeDelta list, to be treated later. If a
//! dead lock if found on the list, the
//! AttributeDeltas are forced to be applied in an
//! unpredictable order.
class TDF_AttributeDelta : public MMgt_TShared
{
public:
//! Applies the delta to the attribute.
Standard_EXPORT virtual void Apply() = 0;
//! Returns the label concerned by <me>.
Standard_EXPORT TDF_Label Label() const;
//! Returns the reference attribute.
Standard_EXPORT Handle(TDF_Attribute) Attribute() const;
//! Returns the ID of the attribute concerned by <me>.
Standard_EXPORT Standard_GUID ID() const;
//! Dumps the contents.
Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& OS) const;
Standard_OStream& operator<< (Standard_OStream& OS) const
{
return Dump(OS);
}
DEFINE_STANDARD_RTTI(TDF_AttributeDelta,MMgt_TShared)
protected:
Standard_EXPORT TDF_AttributeDelta(const Handle(TDF_Attribute)& anAttribute);
private:
Handle(TDF_Attribute) myAttribute;
TDF_Label myLabel;
};
#endif // _TDF_AttributeDelta_HeaderFile

View File

@@ -1,85 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -----------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Nov 20 1997 Creation
class ChildIDIterator from TDF
---Purpose: Iterates on the children of a label, to find
-- attributes having ID as Attribute ID.
--
-- Level option works as TDF_ChildIterator.
uses
Attribute from TDF,
Label from TDF,
LabelNodePtr from TDF,
ChildIterator from TDF
is
Create
returns ChildIDIterator from TDF;
---Purpose: Creates an empty iterator.
Create(aLabel : Label from TDF;
anID : GUID from Standard;
allLevels : Boolean from Standard = Standard_False)
returns ChildIDIterator from TDF;
---Purpose: Iterates on the children of the given label. If
-- <allLevels> option is set to true, it explores not
-- only the first, but all the sub label levels.
Initialize(me : in out;
aLabel : Label from TDF;
anID : GUID from Standard;
allLevels : Boolean from Standard = Standard_False);
---Purpose: Initializes the iteration on the children of the
-- given label. If <allLevels> option is set to true,
-- it explores not only the first, but all the sub
-- label levels.
More(me) returns Boolean;
---Purpose: Returns True if there is a current Item in the
-- iteration.
--
---C++: inline
Next(me : in out);
---Purpose: Move to the next Item
NextBrother(me : in out);
---Purpose: Move to the next Brother. If there is none, go up
-- etc. This method is interesting only with
-- "allLevels" behavior, because it avoids to explore
-- the current label children.
Value(me) returns Attribute from TDF;
---Purpose: Returns the current item; a null handle if there is none.
--
---C++: inline
fields
myID : GUID from Standard;
myItr : ChildIterator from TDF;
myAtt : Attribute from TDF;
end ChildIDIterator;

View File

@@ -14,16 +14,14 @@
// commercial license or contractual agreement.
// -----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Nov 20 1997 Creation
#include <TDF_ChildIDIterator.ixx>
#include <TDF_ChildIterator.ixx>
#include <Standard_GUID.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelNode.hxx>
#include <TDF_LabelNodePtr.hxx>

View File

@@ -0,0 +1,99 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_ChildIDIterator_HeaderFile
#define _TDF_ChildIDIterator_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_GUID.hxx>
#include <TDF_ChildIterator.hxx>
#include <Standard_Boolean.hxx>
class TDF_Attribute;
class TDF_Label;
class Standard_GUID;
//! Iterates on the children of a label, to find
//! attributes having ID as Attribute ID.
//!
//! Level option works as TDF_ChildIterator.
class TDF_ChildIDIterator
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty iterator.
Standard_EXPORT TDF_ChildIDIterator();
//! Iterates on the children of the given label. If
//! <allLevels> option is set to true, it explores not
//! only the first, but all the sub label levels.
Standard_EXPORT TDF_ChildIDIterator(const TDF_Label& aLabel, const Standard_GUID& anID, const Standard_Boolean allLevels = Standard_False);
//! Initializes the iteration on the children of the
//! given label. If <allLevels> option is set to true,
//! it explores not only the first, but all the sub
//! label levels.
Standard_EXPORT void Initialize (const TDF_Label& aLabel, const Standard_GUID& anID, const Standard_Boolean allLevels = Standard_False);
//! Returns True if there is a current Item in the
//! iteration.
Standard_Boolean More() const;
//! Move to the next Item
Standard_EXPORT void Next();
//! Move to the next Brother. If there is none, go up
//! etc. This method is interesting only with
//! "allLevels" behavior, because it avoids to explore
//! the current label children.
Standard_EXPORT void NextBrother();
//! Returns the current item; a null handle if there is none.
Handle(TDF_Attribute) Value() const;
protected:
private:
Standard_GUID myID;
TDF_ChildIterator myItr;
Handle(TDF_Attribute) myAtt;
};
#include <TDF_ChildIDIterator.lxx>
#endif // _TDF_ChildIDIterator_HeaderFile

View File

@@ -1,112 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ------------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Feb 4 1997 Creation
class ChildIterator from TDF
---Purpose: Iterates on the children of a label, at the first
-- level only. It is possible to ask the iterator to
-- explore all the sub label levels of the given one,
-- with the option "allLevels".
uses
Label from TDF,
LabelNodePtr from TDF
is
Create
returns ChildIterator from TDF;
---Purpose: Creates an empty iterator object to
-- explore the children of a label.
Create(aLabel : Label from TDF;
allLevels : Boolean from Standard = Standard_False)
returns ChildIterator from TDF;
---Purpose: Constructs the iterator object defined by
-- the label aLabel. Iterates on the children of the given label. If
-- <allLevels> option is set to true, it explores not
-- only the first, but all the sub label levels.
Initialize(me : in out;
aLabel : Label from TDF;
allLevels : Boolean from Standard = Standard_False);
---Purpose: Initializes the iteration on the children of the
-- given label.
-- If <allLevels> option is set to true,
-- it explores not only the first, but all the sub
-- label levels.
-- If allLevels is false, only the first level of
-- child labels is explored.
-- In the example below, the label is iterated
-- using Initialize, More and Next and its
-- child labels dumped using TDF_Tool::Entry.
-- Example
-- void DumpChildren(const
-- TDF_Label& aLabel)
-- {
-- TDF_ChildIterator it;
-- TCollection_AsciiString es;
-- for
-- (it.Initialize(aLabel,Standard_True);
-- it.More(); it.Next()){
-- TDF_Tool::Entry(it.Value(),es);
-- cout << as.ToCString() << endl;
-- }
-- }
More(me) returns Boolean;
---Purpose: Returns true if a current label is found in the
-- iteration process.
--
---C++: inline
Next(me : in out);
---Purpose: Move the current iteration to the next Item.
NextBrother(me : in out);
---Purpose: Moves this iteration to the next brother
-- label. A brother label is one with the same
-- father as an initial label.
-- Use this function when the non-empty
-- constructor or Initialize has allLevels set to
-- true. The result is that the iteration does not
-- explore the children of the current label.
-- This method is interesting only with
-- "allLevels" behavior, because it avoids to explore
-- the current label children.
Value(me) returns Label from TDF;
---Purpose: Returns the current label; or, if there is
-- none, a null label.
--
---C++: return const
---C++: inline
fields
myNode : LabelNodePtr from TDF;
myFirstLevel : Integer from Standard;
end ChildIterator;

View File

@@ -14,15 +14,11 @@
// commercial license or contractual agreement.
// ----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Feb 7 1997 Creation
#include <TDF_ChildIterator.ixx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelNode.hxx>
#include <TDF_LabelNodePtr.hxx>

View File

@@ -0,0 +1,125 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_ChildIterator_HeaderFile
#define _TDF_ChildIterator_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TDF_LabelNodePtr.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_Label.hxx>
class TDF_Label;
//! Iterates on the children of a label, at the first
//! level only. It is possible to ask the iterator to
//! explore all the sub label levels of the given one,
//! with the option "allLevels".
class TDF_ChildIterator
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty iterator object to
//! explore the children of a label.
Standard_EXPORT TDF_ChildIterator();
//! Constructs the iterator object defined by
//! the label aLabel. Iterates on the children of the given label. If
//! <allLevels> option is set to true, it explores not
//! only the first, but all the sub label levels.
Standard_EXPORT TDF_ChildIterator(const TDF_Label& aLabel, const Standard_Boolean allLevels = Standard_False);
//! Initializes the iteration on the children of the
//! given label.
//! If <allLevels> option is set to true,
//! it explores not only the first, but all the sub
//! label levels.
//! If allLevels is false, only the first level of
//! child labels is explored.
//! In the example below, the label is iterated
//! using Initialize, More and Next and its
//! child labels dumped using TDF_Tool::Entry.
//! Example
//! void DumpChildren(const
//! TDF_Label& aLabel)
//! {
//! TDF_ChildIterator it;
//! TCollection_AsciiString es;
//! for
//! (it.Initialize(aLabel,Standard_True);
//! it.More(); it.Next()){
//! TDF_Tool::Entry(it.Value(),es);
//! cout << as.ToCString() << endl;
//! }
//! }
Standard_EXPORT void Initialize (const TDF_Label& aLabel, const Standard_Boolean allLevels = Standard_False);
//! Returns true if a current label is found in the
//! iteration process.
Standard_Boolean More() const;
//! Move the current iteration to the next Item.
Standard_EXPORT void Next();
//! Moves this iteration to the next brother
//! label. A brother label is one with the same
//! father as an initial label.
//! Use this function when the non-empty
//! constructor or Initialize has allLevels set to
//! true. The result is that the iteration does not
//! explore the children of the current label.
//! This method is interesting only with
//! "allLevels" behavior, because it avoids to explore
//! the current label children.
Standard_EXPORT void NextBrother();
//! Returns the current label; or, if there is
//! none, a null label.
const TDF_Label Value() const;
protected:
private:
TDF_LabelNodePtr myNode;
Standard_Integer myFirstLevel;
};
#include <TDF_ChildIterator.lxx>
#endif // _TDF_ChildIterator_HeaderFile

View File

@@ -1,77 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 May 26 1997 Creation
class ClosureMode from TDF
---Purpose: This class provides options closure management.
-- uses
-- raises
is
Create(aMode : Boolean from Standard = Standard_True)
returns ClosureMode from TDF;
---Purpose: Creates an objet with all modes set to <aMode>.
Descendants(me : in out; aStatus : Boolean from Standard);
---Purpose: Sets the mode "Descendants" to <aStatus>.
--
-- "Descendants" mode means we add to the data set
-- the children labels of each USER GIVEN label. We
-- do not do that with the labels found applying
-- UpToFirstLevel option.
--
---C++: inline
Descendants(me) returns Boolean from Standard;
---Purpose: Returns true if the mode "Descendants" is set.
--
---C++: inline
References(me : in out; aStatus : Boolean from Standard);
---Purpose: Sets the mode "References" to <aStatus>.
--
-- "References" mode means we add to the data set
-- the descendants of an attribute, by calling the
-- attribute method Descendants().
--
---C++: inline
References(me) returns Boolean from Standard;
---Purpose: Returns true if the mode "References" is set.
--
---C++: inline
fields
myFlags : Integer from Standard;
-- Bit Mask Use
-- 0 1 Descendants
-- 1 2 References
-- 2 4 Unused
end ClosureMode;

View File

@@ -14,21 +14,16 @@
// commercial license or contractual agreement.
// -------------------
// Version: 0.0
//Version Date Purpose
// 0.0 May 26 1997 Creation
#include <TDF_ClosureMode.ixx>
#include <TDF_ClosureMode.hxx>
//=======================================================================
//function : TDF_ClosureMode
//purpose :
//=======================================================================
TDF_ClosureMode::TDF_ClosureMode(const Standard_Boolean aMode) :
myFlags(aMode ? ~0 : 0)
{}

View File

@@ -0,0 +1,84 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_ClosureMode_HeaderFile
#define _TDF_ClosureMode_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
//! This class provides options closure management.
class TDF_ClosureMode
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an objet with all modes set to <aMode>.
Standard_EXPORT TDF_ClosureMode(const Standard_Boolean aMode = Standard_True);
//! Sets the mode "Descendants" to <aStatus>.
//!
//! "Descendants" mode means we add to the data set
//! the children labels of each USER GIVEN label. We
//! do not do that with the labels found applying
//! UpToFirstLevel option.
void Descendants (const Standard_Boolean aStatus);
//! Returns true if the mode "Descendants" is set.
Standard_Boolean Descendants() const;
//! Sets the mode "References" to <aStatus>.
//!
//! "References" mode means we add to the data set
//! the descendants of an attribute, by calling the
//! attribute method Descendants().
void References (const Standard_Boolean aStatus);
//! Returns true if the mode "References" is set.
Standard_Boolean References() const;
protected:
private:
Standard_Integer myFlags;
};
#include <TDF_ClosureMode.lxx>
#endif // _TDF_ClosureMode_HeaderFile

View File

@@ -1,93 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Sep 8 1998 Creation
class ClosureTool from TDF
---Purpose: This class provides services to build the closure
-- of an information set.
-- This class gives services around the transitive
-- enclosure of a set of information, starting from a
-- list of label.
-- You can set closure options by using IDFilter
-- (to select or exclude specific attribute IDs) and
-- CopyOption objects and by giving to Closure
-- method.
--
uses
Boolean from Standard,
Label from TDF,
Attribute from TDF,
DataSet from TDF,
RelocationTable from TDF,
AttributeMap from TDF,
LabelMap from TDF,
IDFilter from TDF,
ClosureMode from TDF
-- raises
is
Closure(myclass;
aDataSet : DataSet from TDF);
---Purpose: Builds the transitive closure of label and
-- attribute sets into <aDataSet>.
Closure(myclass;
aDataSet : DataSet from TDF;
aFilter : IDFilter from TDF;
aMode : ClosureMode from TDF);
---Purpose: Builds the transitive closure of label and
-- attribute sets into <aDataSet>. Uses <aFilter> to
-- determine if an attribute has to be taken in
-- account or not. Uses <aMode> for various way of
-- closing.
-- ----------------------------------------------------------------------
--
-- Private methods
--
-- ----------------------------------------------------------------------
Closure(myclass;
aLabel : Label from TDF;
aLabMap : in out LabelMap from TDF;
anAttMap : in out AttributeMap from TDF;
aFilter : IDFilter from TDF;
aMode : ClosureMode from TDF);
---Purpose: Builds the transitive closure of <aLabel>.
LabelAttributes(myclass;
aLabel : Label from TDF;
aLabMap : in out LabelMap from TDF;
anAttMap : in out AttributeMap from TDF;
aFilter : IDFilter from TDF;
aMode : ClosureMode from TDF)
is private;
---Purpose: Adds label attributes and dependences.
end ClosureTool;

View File

@@ -14,27 +14,26 @@
// commercial license or contractual agreement.
// -------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Sep 8 1998 Creation
#include <TDF_ClosureTool.ixx>
//#include <TDF_Reference.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_AttributeMap.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ClosureMode.hxx>
#include <TDF_ClosureTool.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <Standard_TypeMismatch.hxx>
//#include <TDF_Reference.hxx>
#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = Handle(T)::DownCast (V)
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V
#define SpeedCast(V,T,Vdown) Vdown = Handle(T)::DownCast (V)

View File

@@ -0,0 +1,87 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_ClosureTool_HeaderFile
#define _TDF_ClosureTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_AttributeMap.hxx>
class TDF_DataSet;
class TDF_IDFilter;
class TDF_ClosureMode;
class TDF_Label;
//! This class provides services to build the closure
//! of an information set.
//! This class gives services around the transitive
//! enclosure of a set of information, starting from a
//! list of label.
//! You can set closure options by using IDFilter
//! (to select or exclude specific attribute IDs) and
//! CopyOption objects and by giving to Closure
//! method.
class TDF_ClosureTool
{
public:
DEFINE_STANDARD_ALLOC
//! Builds the transitive closure of label and
//! attribute sets into <aDataSet>.
Standard_EXPORT static void Closure (const Handle(TDF_DataSet)& aDataSet);
//! Builds the transitive closure of label and
//! attribute sets into <aDataSet>. Uses <aFilter> to
//! determine if an attribute has to be taken in
//! account or not. Uses <aMode> for various way of
//! closing.
Standard_EXPORT static void Closure (const Handle(TDF_DataSet)& aDataSet, const TDF_IDFilter& aFilter, const TDF_ClosureMode& aMode);
//! Builds the transitive closure of <aLabel>.
Standard_EXPORT static void Closure (const TDF_Label& aLabel, TDF_LabelMap& aLabMap, TDF_AttributeMap& anAttMap, const TDF_IDFilter& aFilter, const TDF_ClosureMode& aMode);
protected:
private:
//! Adds label attributes and dependences.
Standard_EXPORT static void LabelAttributes (const TDF_Label& aLabel, TDF_LabelMap& aLabMap, TDF_AttributeMap& anAttMap, const TDF_IDFilter& aFilter, const TDF_ClosureMode& aMode);
};
#endif // _TDF_ClosureTool_HeaderFile

View File

@@ -1,148 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ----------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Sep 4 1997 Creation
class ComparisonTool from TDF
---Purpose: This class provides services to compare sets of
-- information. The use of this tool can works after
-- a copy, acted by a CopyTool.
--
-- * Compare(...) compares two DataSet and returns
-- the result.
--
-- * SourceUnbound(...) builds the difference between
-- a relocation dictionnary and a source set of
-- information.
--
-- * TargetUnbound(...) does the same between a
-- relocation dictionnary and a target set of
-- information.
--
-- * Cut(aDataSet, anLabel) removes a set of
-- attributes.
--
-- * IsSelfContained(...) returns true if all the
-- labels of the attributes of the given DataSet are
-- descendant of the given label.
uses
Boolean from Standard,
Label from TDF,
Attribute from TDF,
DataSet from TDF,
RelocationTable from TDF,
AttributeMap from TDF,
IDFilter from TDF
-- raises
is
Compare(myclass;
aSourceDataSet : DataSet from TDF;
aTargetDataSet : DataSet from TDF;
aFilter : IDFilter from TDF;
aRelocationTable : RelocationTable from TDF);
---Purpose: Compares <aSourceDataSet> with <aTargetDataSet>,
-- updating <aRelocationTable> with labels and
-- attributes found in both sets.
SourceUnbound(myclass;
aRefDataSet : DataSet from TDF;
aRelocationTable : RelocationTable from TDF;
aFilter : IDFilter from TDF;
aDiffDataSet : DataSet from TDF;
anOption : Integer from Standard = 2)
returns Boolean from Standard;
---Purpose: Finds from <aRefDataSet> all the keys not bound
-- into <aRelocationTable> and put them into
-- <aDiffDataSet>. Returns True if the difference
-- contains at least one key. (A key is a source
-- object).
--
-- <anOption> may take the following values:
-- 1 : labels treatment only;
-- 2 : attributes treatment only (default value);
-- 3 : both labels & attributes treatment.
TargetUnbound(myclass;
aRefDataSet : DataSet from TDF;
aRelocationTable : RelocationTable from TDF;
aFilter : IDFilter from TDF;
aDiffDataSet : DataSet from TDF;
anOption : Integer from Standard = 2)
returns Boolean from Standard;
---Purpose: Substracts from <aRefDataSet> all the items bound
-- into <aRelocationTable>. The result is put into
-- <aDiffDataSet>. Returns True if the difference
-- contains at least one item. (An item is a target
-- object).
--
-- <anOption> may take the following values:
-- 1 : labels treatment only;
-- 2 : attributes treatment only(default value);
-- 3 : both labels & attributes treatment.
Cut(myclass;
aDataSet : DataSet from TDF);
---Purpose: Removes attributes from <aDataSet>.
IsSelfContained(myclass;
aLabel : Label from TDF;
aDataSet : DataSet from TDF)
returns Boolean from Standard;
---Purpose: Returns true if all the labels of <aDataSet> are
-- descendant of <aLabel>.
-- ----------------------------------------------------------------------
--
-- Private methods
--
-- ----------------------------------------------------------------------
Compare(myclass;
aSrcLabel : Label from TDF;
aTrgLabel : Label from TDF;
aSourceDataSet : DataSet from TDF;
aTargetDataSet : DataSet from TDF;
aFilter : IDFilter from TDF;
aRelocationTable : RelocationTable from TDF)
is private;
---Purpose: Internal comparison method used by Compare(...).
Unbound(myclass;
aRefDataSet : DataSet from TDF;
aRelocationTable : RelocationTable from TDF;
aFilter : IDFilter from TDF;
aDiffDataSet : DataSet from TDF;
anOption : Integer from Standard;
theSource : Boolean from Standard)
returns Boolean from Standard
is private;
---Purpose: Internal function used by SourceUnbound() and
-- TargetUnbound().
end ComparisonTool;

View File

@@ -14,35 +14,32 @@
// commercial license or contractual agreement.
// ----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Sep 4 1997 Creation
#include <TDF_ComparisonTool.ixx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeDataMap.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_AttributeMap.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ComparisonTool.hxx>
#include <TDF_DataMapIteratorOfAttributeDataMap.hxx>
#include <TDF_DataMapIteratorOfLabelDataMap.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelDataMap.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_RelocationTable.hxx>
//=======================================================================
//function : Compare
//purpose : Comparison method between 2 DataSets.
//=======================================================================
void TDF_ComparisonTool::Compare
(const Handle(TDF_DataSet)& aSourceDataSet,
const Handle(TDF_DataSet)& aTargetDataSet,

View File

@@ -0,0 +1,125 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_ComparisonTool_HeaderFile
#define _TDF_ComparisonTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
class TDF_DataSet;
class TDF_IDFilter;
class TDF_RelocationTable;
class TDF_Label;
//! This class provides services to compare sets of
//! information. The use of this tool can works after
//! a copy, acted by a CopyTool.
//!
//! * Compare(...) compares two DataSet and returns
//! the result.
//!
//! * SourceUnbound(...) builds the difference between
//! a relocation dictionnary and a source set of
//! information.
//!
//! * TargetUnbound(...) does the same between a
//! relocation dictionnary and a target set of
//! information.
//!
//! * Cut(aDataSet, anLabel) removes a set of
//! attributes.
//!
//! * IsSelfContained(...) returns true if all the
//! labels of the attributes of the given DataSet are
//! descendant of the given label.
class TDF_ComparisonTool
{
public:
DEFINE_STANDARD_ALLOC
//! Compares <aSourceDataSet> with <aTargetDataSet>,
//! updating <aRelocationTable> with labels and
//! attributes found in both sets.
Standard_EXPORT static void Compare (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_DataSet)& aTargetDataSet, const TDF_IDFilter& aFilter, const Handle(TDF_RelocationTable)& aRelocationTable);
//! Finds from <aRefDataSet> all the keys not bound
//! into <aRelocationTable> and put them into
//! <aDiffDataSet>. Returns True if the difference
//! contains at least one key. (A key is a source
//! object).
//!
//! <anOption> may take the following values:
//! 1 : labels treatment only;
//! 2 : attributes treatment only (default value);
//! 3 : both labels & attributes treatment.
Standard_EXPORT static Standard_Boolean SourceUnbound (const Handle(TDF_DataSet)& aRefDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aFilter, const Handle(TDF_DataSet)& aDiffDataSet, const Standard_Integer anOption = 2);
//! Substracts from <aRefDataSet> all the items bound
//! into <aRelocationTable>. The result is put into
//! <aDiffDataSet>. Returns True if the difference
//! contains at least one item. (An item is a target
//! object).
//!
//! <anOption> may take the following values:
//! 1 : labels treatment only;
//! 2 : attributes treatment only(default value);
//! 3 : both labels & attributes treatment.
Standard_EXPORT static Standard_Boolean TargetUnbound (const Handle(TDF_DataSet)& aRefDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aFilter, const Handle(TDF_DataSet)& aDiffDataSet, const Standard_Integer anOption = 2);
//! Removes attributes from <aDataSet>.
Standard_EXPORT static void Cut (const Handle(TDF_DataSet)& aDataSet);
//! Returns true if all the labels of <aDataSet> are
//! descendant of <aLabel>.
Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel, const Handle(TDF_DataSet)& aDataSet);
protected:
private:
//! Internal comparison method used by Compare(...).
Standard_EXPORT static void Compare (const TDF_Label& aSrcLabel, const TDF_Label& aTrgLabel, const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_DataSet)& aTargetDataSet, const TDF_IDFilter& aFilter, const Handle(TDF_RelocationTable)& aRelocationTable);
//! Internal function used by SourceUnbound() and
//! TargetUnbound().
Standard_EXPORT static Standard_Boolean Unbound (const Handle(TDF_DataSet)& aRefDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aFilter, const Handle(TDF_DataSet)& aDiffDataSet, const Standard_Integer anOption, const Standard_Boolean theSource);
};
#endif // _TDF_ComparisonTool_HeaderFile

View File

@@ -1,81 +0,0 @@
-- Created on: 1999-06-24
-- Created by: Sergey ZARITCHNY
-- Copyright (c) 1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class CopyLabel from TDF
---Purpose: This class gives copy of source label hierarchy
uses
Boolean from Standard,
Label from TDF,
Attribute from TDF,
DataSet from TDF,
RelocationTable from TDF,
AttributeMap from TDF,
LabelMap from TDF,
IDFilter from TDF
is
Create returns CopyLabel from TDF;
---Purpose: Empty constructor
Create(aSource, aTarget : Label from TDF)
returns CopyLabel from TDF;
---Purpose: CopyTool
Load(me : in out; aSource, aTarget : Label from TDF);
---Purpose: Loads src and tgt labels
UseFilter(me : in out; aFilter : IDFilter from TDF);
---Purpose: Sets filter
ExternalReferences(myclass; Lab : Label from TDF;
aExternals:in out AttributeMap from TDF;
aFilter : IDFilter from TDF)
returns Boolean from Standard;
---Purpose: Check external references and if exist fills the aExternals Map
ExternalReferences(myclass; aRefLab, Lab : Label from TDF;
aExternals : in out AttributeMap from TDF;
aFilter : IDFilter from TDF;
aDataSet : in out DataSet from TDF) ;
---Purpose: Check external references and if exist fills the aExternals Map
Perform(me:in out);
---Purpose: performs algorithm of selfcontained copy
IsDone(me)
returns Boolean from Standard;
---C++: inline
RelocationTable(me)
returns RelocationTable from TDF;
---Purpose: returns relocation table
---C++: return const&
fields
myRT : RelocationTable from TDF;
mySL : Label from TDF; -- source label
myTL : Label from TDF; -- target label
myFilter : IDFilter from TDF;
myMapOfExt : AttributeMap from TDF; -- map of attribute with external reference
myIsDone : Boolean from Standard;
end CopyLabel;

View File

@@ -14,34 +14,33 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TDF_CopyLabel.ixx>
#include <TDF_Label.hxx>
#include <TDF_AttributeMap.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_AttributeMap.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_CopyTool.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ClosureMode.hxx>
#include <TDF_ClosureTool.hxx>
#include <TDF_Tool.hxx>
#include <TDF_CopyLabel.hxx>
#include <TDF_CopyTool.hxx>
#include <TDF_Data.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_Tool.hxx>
// The bug concerns the COPY operation of some attributes of a non-self-contained label.
// The attributes making the label non-self-contained are not involved by the operation.
// Therefore, these attributes shouldn't be considered by the COPY mechanism and
// the label should be considered as a self-contained.
// Correction of the bug consists of ignoring the attributes not involved by the COPY operation.
//=======================================================================
//function : TDF_CopyLabel
//purpose :
//=======================================================================
TDF_CopyLabel::TDF_CopyLabel()
:myFilter(Standard_False), myIsDone(Standard_False)
{

98
src/TDF/TDF_CopyLabel.hxx Normal file
View File

@@ -0,0 +1,98 @@
// Created on: 1999-06-24
// Created by: Sergey ZARITCHNY
// Copyright (c) 1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_CopyLabel_HeaderFile
#define _TDF_CopyLabel_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TDF_Label.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_AttributeMap.hxx>
#include <Standard_Boolean.hxx>
class TDF_RelocationTable;
class TDF_Label;
class TDF_IDFilter;
class TDF_DataSet;
//! This class gives copy of source label hierarchy
class TDF_CopyLabel
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
Standard_EXPORT TDF_CopyLabel();
//! CopyTool
Standard_EXPORT TDF_CopyLabel(const TDF_Label& aSource, const TDF_Label& aTarget);
//! Loads src and tgt labels
Standard_EXPORT void Load (const TDF_Label& aSource, const TDF_Label& aTarget);
//! Sets filter
Standard_EXPORT void UseFilter (const TDF_IDFilter& aFilter);
//! Check external references and if exist fills the aExternals Map
Standard_EXPORT static Standard_Boolean ExternalReferences (const TDF_Label& Lab, TDF_AttributeMap& aExternals, const TDF_IDFilter& aFilter);
//! Check external references and if exist fills the aExternals Map
Standard_EXPORT static void ExternalReferences (const TDF_Label& aRefLab, const TDF_Label& Lab, TDF_AttributeMap& aExternals, const TDF_IDFilter& aFilter, Handle(TDF_DataSet)& aDataSet);
//! performs algorithm of selfcontained copy
Standard_EXPORT void Perform();
Standard_Boolean IsDone() const;
//! returns relocation table
Standard_EXPORT const Handle(TDF_RelocationTable)& RelocationTable() const;
protected:
private:
Handle(TDF_RelocationTable) myRT;
TDF_Label mySL;
TDF_Label myTL;
TDF_IDFilter myFilter;
TDF_AttributeMap myMapOfExt;
Standard_Boolean myIsDone;
};
#include <TDF_CopyLabel.lxx>
#endif // _TDF_CopyLabel_HeaderFile

View File

@@ -1,146 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ----------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Mar 11 1997 Creation
class CopyTool from TDF
---Purpose: This class provides services to build, copy or
-- paste a set of information.
--
-- Copy methods:
-- -------------
--
-- * Copy(aSourceDataSet, aTargetLabel,
-- aRelocationTable) copies a source DataSet under
-- its target place (see below: IMPORTANT NOTICE 1).
--
-- * Copy(aSourceDataSet, anTargetLabel,
-- aRelocationTable, aFilter) does the same job as
-- the previous method. But <aFilter> gives a list of
-- IDs for which a target attribute prevails over a
-- source one. In this special case, the source
-- attribute will be copied only if there will be no
-- target attribute.
--
--
-- IMPORTANT NOTICE : Label pre-binding
-- ------------------
--
-- For it is possible to copy root labels in another
-- place in the same Data or in a different one with
-- other tags, it is necessary to inform the Copy
-- algorithm about the target place. To do so:
--
-- * first get or create new target root labels;
--
-- * then bind them with the source root labels using
-- the relocation table method:
-- SetRelocation(aSourceLabel, aTargetLabel);
--
-- * finally call Copy(...) with the relocation table
-- previously set. In this way, this method will take
-- these relocations in account.
uses
Boolean from Standard,
Label from TDF,
Attribute from TDF,
DataSet from TDF,
RelocationTable from TDF,
AttributeMap from TDF,
AttributeDataMap from TDF,
LabelDataMap from TDF,
LabelMap from TDF,
IDFilter from TDF,
ClosureMode from TDF
is
Copy(myclass;
aSourceDataSet : DataSet from TDF;
aRelocationTable : RelocationTable from TDF);
---Purpose: Copy <aSourceDataSet> with using and updating
-- <aRelocationTable>. This method ignores target
-- attributes privilege over source ones.
Copy(myclass;
aSourceDataSet : DataSet from TDF;
aRelocationTable : RelocationTable from TDF;
aPrivilegeFilter : IDFilter from TDF);
---Purpose: Copy <aSourceDataSet> using and updating
-- <aRelocationTable>. Use <aPrivilegeFilter> to give
-- a list of IDs for which the target attribute
-- prevails over the source one.
-- Copy method piloting self contained attitude.
-- ----------------------------------------------
Copy(myclass;
aSourceDataSet : DataSet from TDF;
aRelocationTable : RelocationTable from TDF;
aPrivilegeFilter : IDFilter from TDF;
aRefFilter : IDFilter from TDF;
setSelfContained : Boolean from Standard);
---Purpose: Copy <aSourceDataSet> using and updating
-- <aRelocationTable>. Use <aPrivilegeFilter> to give
-- a list of IDs for which the target attribute
-- prevails over the source one. If
-- <setSelfContained> is set to true, every
-- TDF_Reference will be replaced by the referenced
-- structure according to <aRefFilter>.
--
-- NB: <aRefFilter> is used only if
-- <setSelfContained> is true.
-- ----------------------------------------------------------------------
--
-- Private methods
--
-- ----------------------------------------------------------------------
---Purpose: Internal root label copy recursive method.
CopyLabels(myclass;
aSLabel : Label from TDF;
aTargetLabel : in out Label from TDF;
aLabMap : in out LabelDataMap from TDF;
aAttMap : in out AttributeDataMap from TDF;
aSrcLabelMap : LabelMap from TDF;
aSrcAttributeMap : AttributeMap from TDF)
is private;
---Purpose: Internal root label copy recursive method.
CopyAttributes(myclass;
aSLabel : Label from TDF;
aTargetLabel : in out Label from TDF;
aAttMap : in out AttributeDataMap from TDF;
aSrcAttributeMap : AttributeMap from TDF)
is private;
---Purpose: Internal attribute copy method.
end CopyTool;

View File

@@ -14,31 +14,29 @@
// commercial license or contractual agreement.
// ---------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Mar 11 1997 Creation
#include <TDF_CopyTool.ixx>
#include <TDF_ClosureTool.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeDataMap.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_AttributeMap.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ClosureTool.hxx>
#include <TDF_CopyTool.hxx>
#include <TDF_DataMapIteratorOfAttributeDataMap.hxx>
#include <TDF_DataMapIteratorOfLabelDataMap.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelDataMap.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <Standard_TypeMismatch.hxx>
#include <TDF_RelocationTable.hxx>
#define DeclareAndSpeedCast(V,T,Vdown) Handle(T) Vdown = Handle(T)::DownCast (V)
#define DeclareConstAndSpeedCast(V,T,Vdown) const Handle(T)& Vdown = (Handle(T)&) V

129
src/TDF/TDF_CopyTool.hxx Normal file
View File

@@ -0,0 +1,129 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_CopyTool_HeaderFile
#define _TDF_CopyTool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_LabelDataMap.hxx>
#include <TDF_AttributeDataMap.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_AttributeMap.hxx>
class TDF_DataSet;
class TDF_RelocationTable;
class TDF_IDFilter;
class TDF_Label;
//! This class provides services to build, copy or
//! paste a set of information.
//!
//! Copy methods:
//! -------------
//!
//! * Copy(aSourceDataSet, aTargetLabel,
//! aRelocationTable) copies a source DataSet under
//! its target place (see below: IMPORTANT NOTICE 1).
//!
//! * Copy(aSourceDataSet, anTargetLabel,
//! aRelocationTable, aFilter) does the same job as
//! the previous method. But <aFilter> gives a list of
//! IDs for which a target attribute prevails over a
//! source one. In this special case, the source
//! attribute will be copied only if there will be no
//! target attribute.
//!
//! IMPORTANT NOTICE : Label pre-binding
//! ------------------
//!
//! For it is possible to copy root labels in another
//! place in the same Data or in a different one with
//! other tags, it is necessary to inform the Copy
//! algorithm about the target place. To do so:
//!
//! * first get or create new target root labels;
//!
//! * then bind them with the source root labels using
//! the relocation table method:
//! SetRelocation(aSourceLabel, aTargetLabel);
//!
//! * finally call Copy(...) with the relocation table
//! previously set. In this way, this method will take
//! these relocations in account.
class TDF_CopyTool
{
public:
DEFINE_STANDARD_ALLOC
//! Copy <aSourceDataSet> with using and updating
//! <aRelocationTable>. This method ignores target
//! attributes privilege over source ones.
Standard_EXPORT static void Copy (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_RelocationTable)& aRelocationTable);
//! Copy <aSourceDataSet> using and updating
//! <aRelocationTable>. Use <aPrivilegeFilter> to give
//! a list of IDs for which the target attribute
//! prevails over the source one.
Standard_EXPORT static void Copy (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aPrivilegeFilter);
//! Copy <aSourceDataSet> using and updating
//! <aRelocationTable>. Use <aPrivilegeFilter> to give
//! a list of IDs for which the target attribute
//! prevails over the source one. If
//! <setSelfContained> is set to true, every
//! TDF_Reference will be replaced by the referenced
//! structure according to <aRefFilter>.
//!
//! NB: <aRefFilter> is used only if
//! <setSelfContained> is true.
//! Internal root label copy recursive method.
Standard_EXPORT static void Copy (const Handle(TDF_DataSet)& aSourceDataSet, const Handle(TDF_RelocationTable)& aRelocationTable, const TDF_IDFilter& aPrivilegeFilter, const TDF_IDFilter& aRefFilter, const Standard_Boolean setSelfContained);
protected:
private:
//! Internal root label copy recursive method.
Standard_EXPORT static void CopyLabels (const TDF_Label& aSLabel, TDF_Label& aTargetLabel, TDF_LabelDataMap& aLabMap, TDF_AttributeDataMap& aAttMap, const TDF_LabelMap& aSrcLabelMap, const TDF_AttributeMap& aSrcAttributeMap);
//! Internal attribute copy method.
Standard_EXPORT static void CopyAttributes (const TDF_Label& aSLabel, TDF_Label& aTargetLabel, TDF_AttributeDataMap& aAttMap, const TDF_AttributeMap& aSrcAttributeMap);
};
#endif // _TDF_CopyTool_HeaderFile

View File

@@ -1,239 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Feb 4 1997 Creation
class Data from TDF inherits TShared from MMgt
---Purpose: This class is used to manipulate a complete
-- independant, self sufficient data structure and
-- its services:
--
-- Access to the root label;
--
-- Opens, aborts, commits a transaction;
--
-- Generation and use of Delta, depending on the time.
-- This class uses a special allocator
-- (see LabelNodeAllocator() method)
-- for more efficient allocation of
-- objects in memory.
uses
Attribute from TDF,
Label from TDF,
LabelNodePtr from TDF,
Delta from TDF,
IDFilter from TDF,
ListOfInteger from TColStd,
HAllocator from TDF
raises
NoMoreObject from Standard
is
Create returns Data from TDF;
---Purpose: A new and empty Data structure.
-- -----------------------------------------------------------------------
Root(me) returns Label from TDF;
---Purpose: Returns the root label of the Data structure.
--
---C++: inline
---C++: return const
-- -----------------------------------------------------------------------
-- Important notice: For a more secure use of Open/Commit/Abort
-- transactions, see class Transaction from TDF.
Transaction(me) returns Integer;
---Purpose: Returns the current transaction number.
OpenTransaction(me : mutable) returns Integer
is private;
---Purpose: Increments the transaction number and returns it.
CommitTransaction(me : mutable;
withDelta : Boolean from Standard = Standard_False)
returns Delta from TDF
raises NoMoreObject from Standard
is private;
---Purpose: Decrements the transaction number and commits the
-- modifications.
--
-- Raises if there is no current transaction.
--
-- Optionnal <withDelta> set to True indiquates a
-- Delta must be generated.
CommitUntilTransaction(me : mutable;
untilTransaction : Integer from Standard;
withDelta : Boolean from Standard = Standard_False)
returns Delta from TDF
is private;
---Purpose: Decrements the transaction number and commits the
-- modifications until AND including the transaction
-- <untilTransaction>.
AbortTransaction(me : mutable)
raises NoMoreObject from Standard
is private;
---Purpose: Decrements the transaction number and forgets the
-- modifications.
--
-- Raises if there is no current transaction.
AbortUntilTransaction(me : mutable;
untilTransaction : Integer from Standard)
is private;
---Purpose: Decrements the transaction number and forgets the
-- modifications until AND including the transaction
-- <untilTransaction>.
-- -----------------------------------------------------------------------
Time(me) returns Integer from Standard;
---Purpose: Returns the current tick. It is incremented each Commit.
--
---C++: inline
IsApplicable (me;
aDelta : Delta from TDF)
returns Boolean from Standard;
---Purpose: Returns true if <aDelta> is applicable HERE and NOW.
Undo(me : mutable;
aDelta : Delta from TDF;
withDelta : Boolean from Standard = Standard_False)
returns Delta from TDF;
---Purpose: Apply <aDelta> to undo a set of attribute
-- modifications.
--
-- Optionnal <withDelta> set to True indiquates a
-- Delta Set must be generated. (See above)
-- -----------------------------------------------------------------------
Destroy(me : mutable);
---C++: alias ~
-- Private internal use methods ------------------------------------------
CommitTransaction(me : mutable;
aLabel : Label from TDF;
aDelta : Delta from TDF;
withDelta : Boolean from Standard)
returns Integer from Standard
is private;
---Purpose: Decrements the transaction number and commits the
-- modifications. Used to implement the recursif
-- commit process. The returned boolean says how many
-- attributes (new, modified or deleted) has been
-- committed from the previous transaction into the
-- current one.
-- Miscelleaneous
-- --------------
NotUndoMode(me) returns Boolean from Standard;
---Purpose: Returns the undo mode status.
--
---C++: inline
Dump(me; anOS : in out OStream from Standard)
returns OStream from Standard;
---Purpose: Dumps the Data on <aStream>.
--
---C++: return &
---C++: alias operator<<
-- methods for check modifications outside the transaction -----------
AllowModification(me: mutable; isAllowed : Boolean from Standard );
---Purpose: Sets modification mode.
--
---C++: inline
IsModificationAllowed(me) returns Boolean from Standard;
---Purpose: returns modification mode.
--
---C++: inline
LabelNodeAllocator(me) returns HAllocator from TDF;
---Purpose: Returns TDF_HAllocator, which is an
-- incremental allocator used by
-- TDF_LabelNode.
-- This allocator is used to
-- manage TDF_LabelNode objects,
-- but it can also be used for
-- allocating memory to
-- application-specific data (be
-- careful because this
-- allocator does not release
-- the memory).
-- The benefits of this
-- allocation scheme are
-- noticeable when dealing with
-- large OCAF documents, due to:
-- 1. Very quick allocation of
-- objects (memory heap is not
-- used, the algorithm that
-- replaces it is very simple).
-- 2. Very quick destruction of
-- objects (memory is released not
-- by destructors of TDF_LabelNode,
-- but rather by the destructor of
-- TDF_Data).
-- 3. TDF_LabelNode objects do not
-- fragmentize the memory; they are
-- kept compactly in a number of
-- arrays of 16K each.
-- 4. Swapping is reduced on large
-- data, because each document now
-- occupies a smaller number of
-- memory pages.
---C++: inline
---C++: return const &
fields
myRoot : LabelNodePtr from TDF;
myTransaction : Integer from Standard;
myNbTouchedAtt : Integer from Standard;
myNotUndoMode : Boolean from Standard;
myTime : Integer from Standard;
myTimes : ListOfInteger from TColStd;
myLabelNodeAllocator: HAllocator from TDF;
myAllowModification : Boolean from Standard;
friends
class Transaction from TDF,
class LabelNode from TDF
end Data;

View File

@@ -13,16 +13,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TDF_Data.ixx>
#include <NCollection_IncAllocator.hxx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_AttributeIndexedMap.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Delta.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_AttributeIndexedMap.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Data.hxx>
#include <TDF_Delta.hxx>
#include <TDF_DeltaOnAddition.hxx>
#include <TDF_DeltaOnForget.hxx>
#include <TDF_DeltaOnModification.hxx>
@@ -32,11 +35,7 @@
#include <TDF_LabelNode.hxx>
#include <TDF_LabelNodePtr.hxx>
#include <TDF_Tool.hxx>
#include <Standard_NoMoreObject.hxx>
#include <Standard_NullObject.hxx>
#include <NCollection_IncAllocator.hxx>
#include <TDF_Transaction.hxx>
#undef DEB_DELTA_CREATION
#undef TDF_DATA_COMMIT_OPTIMIZED

206
src/TDF/TDF_Data.hxx Normal file
View File

@@ -0,0 +1,206 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Data_HeaderFile
#define _TDF_Data_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_LabelNodePtr.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TDF_HAllocator.hxx>
#include <MMgt_TShared.hxx>
#include <TDF_Label.hxx>
#include <Standard_OStream.hxx>
class Standard_NoMoreObject;
class TDF_Transaction;
class TDF_LabelNode;
class TDF_Delta;
class TDF_Label;
class TDF_Data;
DEFINE_STANDARD_HANDLE(TDF_Data, MMgt_TShared)
//! This class is used to manipulate a complete
//! independant, self sufficient data structure and
//! its services:
//!
//! Access to the root label;
//!
//! Opens, aborts, commits a transaction;
//!
//! Generation and use of Delta, depending on the time.
//! This class uses a special allocator
//! (see LabelNodeAllocator() method)
//! for more efficient allocation of
//! objects in memory.
class TDF_Data : public MMgt_TShared
{
public:
//! A new and empty Data structure.
Standard_EXPORT TDF_Data();
//! Returns the root label of the Data structure.
const TDF_Label Root() const;
//! Returns the current transaction number.
Standard_EXPORT Standard_Integer Transaction() const;
//! Returns the current tick. It is incremented each Commit.
Standard_Integer Time() const;
//! Returns true if <aDelta> is applicable HERE and NOW.
Standard_EXPORT Standard_Boolean IsApplicable (const Handle(TDF_Delta)& aDelta) const;
//! Apply <aDelta> to undo a set of attribute
//! modifications.
//!
//! Optionnal <withDelta> set to True indiquates a
//! Delta Set must be generated. (See above)
Standard_EXPORT Handle(TDF_Delta) Undo (const Handle(TDF_Delta)& aDelta, const Standard_Boolean withDelta = Standard_False);
Standard_EXPORT void Destroy();
~TDF_Data()
{
Destroy();
}
//! Returns the undo mode status.
Standard_Boolean NotUndoMode() const;
//! Dumps the Data on <aStream>.
Standard_EXPORT Standard_OStream& Dump (Standard_OStream& anOS) const;
Standard_OStream& operator<< (Standard_OStream& anOS) const
{
return Dump(anOS);
}
//! Sets modification mode.
void AllowModification (const Standard_Boolean isAllowed);
//! returns modification mode.
Standard_Boolean IsModificationAllowed() const;
//! Returns TDF_HAllocator, which is an
//! incremental allocator used by
//! TDF_LabelNode.
//! This allocator is used to
//! manage TDF_LabelNode objects,
//! but it can also be used for
//! allocating memory to
//! application-specific data (be
//! careful because this
//! allocator does not release
//! the memory).
//! The benefits of this
//! allocation scheme are
//! noticeable when dealing with
//! large OCAF documents, due to:
//! 1. Very quick allocation of
//! objects (memory heap is not
//! used, the algorithm that
//! replaces it is very simple).
//! 2. Very quick destruction of
//! objects (memory is released not
//! by destructors of TDF_LabelNode,
//! but rather by the destructor of
//! TDF_Data).
//! 3. TDF_LabelNode objects do not
//! fragmentize the memory; they are
//! kept compactly in a number of
//! arrays of 16K each.
//! 4. Swapping is reduced on large
//! data, because each document now
//! occupies a smaller number of
//! memory pages.
const TDF_HAllocator& LabelNodeAllocator() const;
friend class TDF_Transaction;
friend class TDF_LabelNode;
DEFINE_STANDARD_RTTI(TDF_Data,MMgt_TShared)
protected:
private:
//! Increments the transaction number and returns it.
Standard_EXPORT Standard_Integer OpenTransaction();
//! Decrements the transaction number and commits the
//! modifications.
//!
//! Raises if there is no current transaction.
//!
//! Optionnal <withDelta> set to True indiquates a
//! Delta must be generated.
Standard_EXPORT Handle(TDF_Delta) CommitTransaction (const Standard_Boolean withDelta = Standard_False);
//! Decrements the transaction number and commits the
//! modifications until AND including the transaction
//! <untilTransaction>.
Standard_EXPORT Handle(TDF_Delta) CommitUntilTransaction (const Standard_Integer untilTransaction, const Standard_Boolean withDelta = Standard_False);
//! Decrements the transaction number and forgets the
//! modifications.
//!
//! Raises if there is no current transaction.
Standard_EXPORT void AbortTransaction();
//! Decrements the transaction number and forgets the
//! modifications until AND including the transaction
//! <untilTransaction>.
Standard_EXPORT void AbortUntilTransaction (const Standard_Integer untilTransaction);
//! Decrements the transaction number and commits the
//! modifications. Used to implement the recursif
//! commit process. The returned boolean says how many
//! attributes (new, modified or deleted) has been
//! committed from the previous transaction into the
//! current one.
Standard_EXPORT Standard_Integer CommitTransaction (const TDF_Label& aLabel, const Handle(TDF_Delta)& aDelta, const Standard_Boolean withDelta);
TDF_LabelNodePtr myRoot;
Standard_Integer myTransaction;
Standard_Integer myNbTouchedAtt;
Standard_Boolean myNotUndoMode;
Standard_Integer myTime;
TColStd_ListOfInteger myTimes;
TDF_HAllocator myLabelNodeAllocator;
Standard_Boolean myAllowModification;
};
#include <TDF_Data.lxx>
#endif // _TDF_Data_HeaderFile

View File

@@ -1,125 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ---------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Mar 11 1997 Creation
class DataSet from TDF
inherits TShared from MMgt
---Purpose: This class is a set of TDF informations like
-- labels and attributes.
uses
OStream from Standard,
Label from TDF,
Attribute from TDF,
LabelList from TDF,
LabelMap from TDF,
AttributeMap from TDF
-- raises
is
Create
returns DataSet from TDF;
---Purpose: Creates an empty DataSet object.
Clear(me : mutable);
---Purpose: Clears all information.
IsEmpty(me) returns Boolean from Standard;
---Purpose: Returns true if there is at least one label or one
-- attribute.
---C++: inline
-- Label set informations
AddLabel(me : mutable;
aLabel : Label from TDF);
---Purpose: Adds <aLabel> in the current data set.
---C++: inline
ContainsLabel(me; aLabel : Label from TDF)
returns Boolean from Standard;
---Purpose: Returns true if the label <alabel> is in the data set.
---C++: inline
Labels(me : mutable)
returns LabelMap from TDF;
---Purpose: Returns the map of labels in this data set.
-- This map can be used directly, or updated.
--
---C++: inline
---C++: return &
-- Attribute set informations
AddAttribute(me : mutable;
anAttribute : Attribute from TDF);
---Purpose: Adds <anAttribute> into the current data set.
---C++: inline
ContainsAttribute(me; anAttribute : Attribute from TDF)
returns Boolean from Standard;
---Purpose: Returns true if <anAttribute> is in the data set.
---C++: inline
Attributes(me : mutable)
returns AttributeMap from TDF;
---Purpose: Returns the map of attributes in the current data set.
-- This map can be used directly, or updated.
--
---C++: inline
---C++: return &
-- Root informations
AddRoot(me : mutable; aLabel : Label from TDF);
---Purpose: Adds a root label to <myRootLabels>.
--
---C++: inline
Roots(me : mutable)
returns LabelList from TDF;
---Purpose: Returns <myRootLabels> to be used or updated.
--
---C++: inline
---C++: return &
-- Miscellaneous
Dump(me; anOS : in out OStream from Standard)
returns OStream from Standard;
---Purpose: Dumps the minimum information about <me> on
-- <aStream>.
--
---C++: return &
---C++: alias operator<<
fields
myRootLabels : LabelList from TDF;
myLabelMap : LabelMap from TDF;
myAttributeMap : AttributeMap from TDF;
end DataSet;

View File

@@ -14,25 +14,22 @@
// commercial license or contractual agreement.
// ---------------
// Version: 0.0
//Version Date Purpose
// 0.0 Mar 11 1997 Creation
#include <TDF_DataSet.ixx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_Label.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
//=======================================================================
//function : TDF_DataSet
//purpose : Creates a DataSet.
//=======================================================================
TDF_DataSet::TDF_DataSet()
{}

114
src/TDF/TDF_DataSet.hxx Normal file
View File

@@ -0,0 +1,114 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DataSet_HeaderFile
#define _TDF_DataSet_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_LabelList.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_AttributeMap.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
class TDF_Label;
class TDF_Attribute;
class TDF_DataSet;
DEFINE_STANDARD_HANDLE(TDF_DataSet, MMgt_TShared)
//! This class is a set of TDF informations like
//! labels and attributes.
class TDF_DataSet : public MMgt_TShared
{
public:
//! Creates an empty DataSet object.
Standard_EXPORT TDF_DataSet();
//! Clears all information.
Standard_EXPORT void Clear();
//! Returns true if there is at least one label or one
//! attribute.
Standard_Boolean IsEmpty() const;
//! Adds <aLabel> in the current data set.
void AddLabel (const TDF_Label& aLabel);
//! Returns true if the label <alabel> is in the data set.
Standard_Boolean ContainsLabel (const TDF_Label& aLabel) const;
//! Returns the map of labels in this data set.
//! This map can be used directly, or updated.
TDF_LabelMap& Labels();
//! Adds <anAttribute> into the current data set.
void AddAttribute (const Handle(TDF_Attribute)& anAttribute);
//! Returns true if <anAttribute> is in the data set.
Standard_Boolean ContainsAttribute (const Handle(TDF_Attribute)& anAttribute) const;
//! Returns the map of attributes in the current data set.
//! This map can be used directly, or updated.
TDF_AttributeMap& Attributes();
//! Adds a root label to <myRootLabels>.
void AddRoot (const TDF_Label& aLabel);
//! Returns <myRootLabels> to be used or updated.
TDF_LabelList& Roots();
//! Dumps the minimum information about <me> on
//! <aStream>.
Standard_EXPORT Standard_OStream& Dump (Standard_OStream& anOS) const;
Standard_OStream& operator<< (Standard_OStream& anOS) const
{
return Dump(anOS);
}
DEFINE_STANDARD_RTTI(TDF_DataSet,MMgt_TShared)
protected:
private:
TDF_LabelList myRootLabels;
TDF_LabelMap myLabelMap;
TDF_AttributeMap myAttributeMap;
};
#include <TDF_DataSet.lxx>
#endif // _TDF_DataSet_HeaderFile

View File

@@ -1,46 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ----------------------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Oct 10 1997 Creation
class DefaultDeltaOnModification from TDF
inherits DeltaOnModification from TDF
---Purpose: This class provides a default implementation of a
-- TDF_DeltaOnModification.
uses
Label from TDF,
Attribute from TDF
-- raises
is
Create(anAttribute : Attribute from TDF);
---Purpose: Creates a TDF_DefaultDeltaOnModification.
-- <anAttribute> must be the backup copy.
Apply (me : mutable)
is redefined virtual;
---Purpose: Applies the delta to the attribute.
end DefaultDeltaOnModification;

View File

@@ -14,24 +14,20 @@
// commercial license or contractual agreement.
// ----------------------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Oct 10 1997 Creation
#include <TDF_DefaultDeltaOnModification.ixx>
#include <TDF_Label.hxx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DefaultDeltaOnModification.hxx>
#include <TDF_Label.hxx>
//=======================================================================
//function : TDF_DefaultDeltaOnModification
//purpose :
//=======================================================================
TDF_DefaultDeltaOnModification::TDF_DefaultDeltaOnModification
(const Handle(TDF_Attribute)& anAttribute)
: TDF_DeltaOnModification(anAttribute)

View File

@@ -0,0 +1,67 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DefaultDeltaOnModification_HeaderFile
#define _TDF_DefaultDeltaOnModification_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_DeltaOnModification.hxx>
class TDF_Attribute;
class TDF_DefaultDeltaOnModification;
DEFINE_STANDARD_HANDLE(TDF_DefaultDeltaOnModification, TDF_DeltaOnModification)
//! This class provides a default implementation of a
//! TDF_DeltaOnModification.
class TDF_DefaultDeltaOnModification : public TDF_DeltaOnModification
{
public:
//! Creates a TDF_DefaultDeltaOnModification.
//! <anAttribute> must be the backup copy.
Standard_EXPORT TDF_DefaultDeltaOnModification(const Handle(TDF_Attribute)& anAttribute);
//! Applies the delta to the attribute.
Standard_EXPORT virtual void Apply() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(TDF_DefaultDeltaOnModification,TDF_DeltaOnModification)
protected:
private:
};
#endif // _TDF_DefaultDeltaOnModification_HeaderFile

View File

@@ -1,45 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -----------------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Oct 10 1997 Creation
class DefaultDeltaOnRemoval from TDF
inherits DeltaOnRemoval from TDF
---Purpose: This class provides a default implementation of a
-- TDF_DeltaOnRemoval.
uses
Label from TDF,
Attribute from TDF
-- raises
is
Create(anAttribute : Attribute from TDF);
---Purpose: Creates a TDF_DefaultDeltaOnRemoval.
Apply (me : mutable)
is redefined virtual;
---Purpose: Applies the delta to the attribute.
end DefaultDeltaOnRemoval;

View File

@@ -14,22 +14,19 @@
// commercial license or contractual agreement.
// -----------------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Oct 10 1997 Creation
#include <TDF_DefaultDeltaOnRemoval.ixx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DefaultDeltaOnRemoval.hxx>
#include <TDF_Label.hxx>
//=======================================================================
//function : TDF_DefaultDeltaOnRemoval
//purpose :
//=======================================================================
TDF_DefaultDeltaOnRemoval::TDF_DefaultDeltaOnRemoval
(const Handle(TDF_Attribute)& anAttribute)
: TDF_DeltaOnRemoval(anAttribute)

View File

@@ -0,0 +1,66 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DefaultDeltaOnRemoval_HeaderFile
#define _TDF_DefaultDeltaOnRemoval_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_DeltaOnRemoval.hxx>
class TDF_Attribute;
class TDF_DefaultDeltaOnRemoval;
DEFINE_STANDARD_HANDLE(TDF_DefaultDeltaOnRemoval, TDF_DeltaOnRemoval)
//! This class provides a default implementation of a
//! TDF_DeltaOnRemoval.
class TDF_DefaultDeltaOnRemoval : public TDF_DeltaOnRemoval
{
public:
//! Creates a TDF_DefaultDeltaOnRemoval.
Standard_EXPORT TDF_DefaultDeltaOnRemoval(const Handle(TDF_Attribute)& anAttribute);
//! Applies the delta to the attribute.
Standard_EXPORT virtual void Apply() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(TDF_DefaultDeltaOnRemoval,TDF_DeltaOnRemoval)
protected:
private:
};
#endif // _TDF_DefaultDeltaOnRemoval_HeaderFile

View File

@@ -1,120 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Sep 8 1997 Creation
class Delta from TDF inherits TShared from MMgt
---Purpose: A set of AttributeDelta for a given transaction
-- number and reference time number.
-- A delta set is available at <aSourceTime>. If
-- applied, it restores the TDF_Data in the state it
-- was at <aTargetTime>.
uses
OStream from Standard,
ExtendedString from TCollection,
LabelList from TDF,
AttributeDelta from TDF,
AttributeDeltaList from TDF
raises
OutOfRange from Standard
is
Create;
---Purpose: Creates a delta.
Validity(me : mutable;
aBeginTime : Integer from Standard;
anEndTime : Integer from Standard)
is protected;
---Purpose: Validates <me> at <aBeginTime>. If applied, it
-- restores the TDF_Data in the state it was at
-- <anEndTime>. Reserved to TDF_Data.
AddAttributeDelta (me : mutable;
anAttributeDelta : AttributeDelta from TDF)
is protected;
---Purpose: Adds an AttributeDelta to the list. Reserved to
-- TDF_Data.
IsEmpty (me) returns Boolean from Standard;
---Purpose: Returns true if there is nothing to undo.
--
---C++: inline
BeforeOrAfterApply(me; before : Boolean from Standard) is private;
Apply (me : mutable) is private;
IsApplicable (me; aCurrentTime : Integer from Standard)
returns Boolean from Standard;
---Purpose: Returns true if the Undo action of <me> is
-- applicable at <aCurrentTime>.
--
---C++: inline
BeginTime (me) returns Integer;
---Purpose: Returns the field <myBeginTime>.
---C++: inline
EndTime (me) returns Integer;
---Purpose: Returns the field <myEndTime>.
---C++: inline
Labels(me; aLabelList : in out LabelList from TDF);
---Purpose: Adds in <aLabelList> the labels of the attribute deltas.
-- Caution: <aLabelList> is not cleared before use.
AttributeDeltas (me) returns AttributeDeltaList from TDF;
---Purpose: Returns the field <myAttDeltaList>.
---C++: inline
---C++: return const &
Name(me) returns ExtendedString from TCollection;
---Purpose: Returns a name associated with this delta.
---C++: inline
SetName(me : mutable; theName : ExtendedString from TCollection);
---Purpose: Associates a name <theName> with this delta
---C++: inline
Dump(me; OS : in out OStream from Standard);
fields
myBeginTime : Integer from Standard;
myEndTime : Integer from Standard;
myAttDeltaList : AttributeDeltaList from TDF;
myName : ExtendedString from TCollection;
friends
class Data from TDF
end Delta;

View File

@@ -14,15 +14,16 @@
// commercial license or contractual agreement.
// -------------
// Version: 0.0
//Version Date Purpose
// 0.0 Sep 8 1997 Creation
#include <TDF_Delta.ixx>
#include <Standard_OutOfRange.hxx>
#include <Standard_Type.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_Data.hxx>
#include <TDF_Delta.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>

122
src/TDF/TDF_Delta.hxx Normal file
View File

@@ -0,0 +1,122 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Delta_HeaderFile
#define _TDF_Delta_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <TDF_AttributeDeltaList.hxx>
#include <TCollection_ExtendedString.hxx>
#include <MMgt_TShared.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_LabelList.hxx>
#include <Standard_OStream.hxx>
class Standard_OutOfRange;
class TDF_Data;
class TDF_AttributeDelta;
class TCollection_ExtendedString;
class TDF_Delta;
DEFINE_STANDARD_HANDLE(TDF_Delta, MMgt_TShared)
//! A set of AttributeDelta for a given transaction
//! number and reference time number.
//! A delta set is available at <aSourceTime>. If
//! applied, it restores the TDF_Data in the state it
//! was at <aTargetTime>.
class TDF_Delta : public MMgt_TShared
{
public:
//! Creates a delta.
Standard_EXPORT TDF_Delta();
//! Returns true if there is nothing to undo.
Standard_Boolean IsEmpty() const;
//! Returns true if the Undo action of <me> is
//! applicable at <aCurrentTime>.
Standard_Boolean IsApplicable (const Standard_Integer aCurrentTime) const;
//! Returns the field <myBeginTime>.
Standard_Integer BeginTime() const;
//! Returns the field <myEndTime>.
Standard_Integer EndTime() const;
//! Adds in <aLabelList> the labels of the attribute deltas.
//! Caution: <aLabelList> is not cleared before use.
Standard_EXPORT void Labels (TDF_LabelList& aLabelList) const;
//! Returns the field <myAttDeltaList>.
const TDF_AttributeDeltaList& AttributeDeltas() const;
//! Returns a name associated with this delta.
TCollection_ExtendedString Name() const;
//! Associates a name <theName> with this delta
void SetName (const TCollection_ExtendedString& theName);
Standard_EXPORT void Dump (Standard_OStream& OS) const;
friend class TDF_Data;
DEFINE_STANDARD_RTTI(TDF_Delta,MMgt_TShared)
protected:
//! Validates <me> at <aBeginTime>. If applied, it
//! restores the TDF_Data in the state it was at
//! <anEndTime>. Reserved to TDF_Data.
Standard_EXPORT void Validity (const Standard_Integer aBeginTime, const Standard_Integer anEndTime);
//! Adds an AttributeDelta to the list. Reserved to
//! TDF_Data.
Standard_EXPORT void AddAttributeDelta (const Handle(TDF_AttributeDelta)& anAttributeDelta);
private:
Standard_EXPORT void BeforeOrAfterApply (const Standard_Boolean before) const;
Standard_EXPORT void Apply();
Standard_Integer myBeginTime;
Standard_Integer myEndTime;
TDF_AttributeDeltaList myAttDeltaList;
TCollection_ExtendedString myName;
};
#include <TDF_Delta.lxx>
#endif // _TDF_Delta_HeaderFile

View File

@@ -1,47 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -----------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Oct 10 1997 Creation
class DeltaOnAddition from TDF inherits AttributeDelta from TDF
---Purpose: This class provides default services for an
-- AttributeDelta on an ADDITION action.
--
-- Applying this AttributeDelta means REMOVING its
-- attribute.
uses
Attribute from TDF
-- raises
is
Create(anAtt : Attribute from TDF)
returns DeltaOnAddition from TDF;
---Purpose: Creates a TDF_DeltaOnAddition.
Apply (me : mutable)
is redefined static;
---Purpose: Applies the delta to the attribute.
end DeltaOnAddition;

View File

@@ -14,24 +14,20 @@
// commercial license or contractual agreement.
// -----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Oct 10 1997 Creation
#include <TDF_DeltaOnAddition.ixx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DeltaOnAddition.hxx>
#include <TDF_Label.hxx>
//=======================================================================
//function : TDF_DeltaOnAddition
//purpose :
//=======================================================================
TDF_DeltaOnAddition::TDF_DeltaOnAddition
(const Handle(TDF_Attribute)& anAtt)
: TDF_AttributeDelta(anAtt)

View File

@@ -0,0 +1,69 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DeltaOnAddition_HeaderFile
#define _TDF_DeltaOnAddition_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_AttributeDelta.hxx>
class TDF_Attribute;
class TDF_DeltaOnAddition;
DEFINE_STANDARD_HANDLE(TDF_DeltaOnAddition, TDF_AttributeDelta)
//! This class provides default services for an
//! AttributeDelta on an ADDITION action.
//!
//! Applying this AttributeDelta means REMOVING its
//! attribute.
class TDF_DeltaOnAddition : public TDF_AttributeDelta
{
public:
//! Creates a TDF_DeltaOnAddition.
Standard_EXPORT TDF_DeltaOnAddition(const Handle(TDF_Attribute)& anAtt);
//! Applies the delta to the attribute.
Standard_EXPORT void Apply() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(TDF_DeltaOnAddition,TDF_AttributeDelta)
protected:
private:
};
#endif // _TDF_DeltaOnAddition_HeaderFile

View File

@@ -1,45 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ---------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Nov 3 1997 Creation
-- 1.0 Jul 6 1998 Separation Forget/Resume
class DeltaOnForget from TDF inherits AttributeDelta from TDF
---Purpose: This class provides default services for an
-- AttributeDelta on an Forget action.
--
-- Applying this AttributeDelta means RESUMING its
-- attribute.
uses
Attribute from TDF
is
Create(anAtt : Attribute from TDF)
returns DeltaOnForget from TDF;
---Purpose: Creates a TDF_DeltaOnForget.
Apply (me : mutable)
is redefined static;
---Purpose: Applies the delta to the attribute.
end DeltaOnForget;

View File

@@ -14,22 +14,19 @@
// commercial license or contractual agreement.
// ---------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Nov 3 1997 Creation
#include <TDF_DeltaOnForget.ixx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DeltaOnForget.hxx>
#include <TDF_Label.hxx>
//=======================================================================
//function : TDF_DeltaOnForget
//purpose :
//=======================================================================
TDF_DeltaOnForget::TDF_DeltaOnForget
(const Handle(TDF_Attribute)& anAtt)
: TDF_AttributeDelta(anAtt)

View File

@@ -0,0 +1,69 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DeltaOnForget_HeaderFile
#define _TDF_DeltaOnForget_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_AttributeDelta.hxx>
class TDF_Attribute;
class TDF_DeltaOnForget;
DEFINE_STANDARD_HANDLE(TDF_DeltaOnForget, TDF_AttributeDelta)
//! This class provides default services for an
//! AttributeDelta on an Forget action.
//!
//! Applying this AttributeDelta means RESUMING its
//! attribute.
class TDF_DeltaOnForget : public TDF_AttributeDelta
{
public:
//! Creates a TDF_DeltaOnForget.
Standard_EXPORT TDF_DeltaOnForget(const Handle(TDF_Attribute)& anAtt);
//! Applies the delta to the attribute.
Standard_EXPORT void Apply() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(TDF_DeltaOnForget,TDF_AttributeDelta)
protected:
private:
};
#endif // _TDF_DeltaOnForget_HeaderFile

View File

@@ -1,48 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ---------------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Oct 10 1997 Creation
deferred class DeltaOnModification from TDF
inherits AttributeDelta from TDF
---Purpose: This class provides default services for an
-- AttributeDelta on a MODIFICATION action.
--
-- Applying this AttributeDelta means GOING BACK to
-- the attribute previously registered state.
uses
Attribute from TDF
-- raises
is
Initialize(anAttribute: Attribute from TDF)
returns DeltaOnModification from TDF;
---Purpose: Initializes a TDF_DeltaOnModification.
Apply (me : mutable)
is redefined virtual;
---Purpose: Applies the delta to the attribute.
end DeltaOnModification;

View File

@@ -14,21 +14,18 @@
// commercial license or contractual agreement.
// ---------------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Oct 10 1997 Creation
#include <TDF_DeltaOnModification.ixx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DeltaOnModification.hxx>
//=======================================================================
//function : TDF_DeltaOnModification
//purpose :
//=======================================================================
TDF_DeltaOnModification::TDF_DeltaOnModification
(const Handle(TDF_Attribute)& anAttribute)
: TDF_AttributeDelta(anAttribute)

View File

@@ -0,0 +1,69 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DeltaOnModification_HeaderFile
#define _TDF_DeltaOnModification_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_AttributeDelta.hxx>
class TDF_Attribute;
class TDF_DeltaOnModification;
DEFINE_STANDARD_HANDLE(TDF_DeltaOnModification, TDF_AttributeDelta)
//! This class provides default services for an
//! AttributeDelta on a MODIFICATION action.
//!
//! Applying this AttributeDelta means GOING BACK to
//! the attribute previously registered state.
class TDF_DeltaOnModification : public TDF_AttributeDelta
{
public:
//! Applies the delta to the attribute.
Standard_EXPORT virtual void Apply() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(TDF_DeltaOnModification,TDF_AttributeDelta)
protected:
//! Initializes a TDF_DeltaOnModification.
Standard_EXPORT TDF_DeltaOnModification(const Handle(TDF_Attribute)& anAttribute);
private:
};
#endif // _TDF_DeltaOnModification_HeaderFile

View File

@@ -1,43 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- --------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Oct 10 1997 Creation
deferred class DeltaOnRemoval from TDF
inherits AttributeDelta from TDF
---Purpose: This class provides default services for an
-- AttributeDelta on a REMOVAL action.
--
-- Applying this AttributeDelta means ADDING its
-- attribute.
uses
Attribute from TDF
-- raises
is
Initialize(anAtt : Attribute from TDF);
---Purpose: Initializes a TDF_DeltaOnRemoval.
end DeltaOnRemoval;

View File

@@ -14,21 +14,18 @@
// commercial license or contractual agreement.
// ----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Oct 10 1997 Creation
#include <TDF_DeltaOnRemoval.ixx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DeltaOnRemoval.hxx>
//=======================================================================
//function : TDF_DeltaOnRemoval
//purpose :
//=======================================================================
TDF_DeltaOnRemoval::TDF_DeltaOnRemoval(const Handle(TDF_Attribute)& anAtt)
: TDF_AttributeDelta(anAtt)
{}

View File

@@ -0,0 +1,66 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DeltaOnRemoval_HeaderFile
#define _TDF_DeltaOnRemoval_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_AttributeDelta.hxx>
class TDF_Attribute;
class TDF_DeltaOnRemoval;
DEFINE_STANDARD_HANDLE(TDF_DeltaOnRemoval, TDF_AttributeDelta)
//! This class provides default services for an
//! AttributeDelta on a REMOVAL action.
//!
//! Applying this AttributeDelta means ADDING its
//! attribute.
class TDF_DeltaOnRemoval : public TDF_AttributeDelta
{
public:
DEFINE_STANDARD_RTTI(TDF_DeltaOnRemoval,TDF_AttributeDelta)
protected:
//! Initializes a TDF_DeltaOnRemoval.
Standard_EXPORT TDF_DeltaOnRemoval(const Handle(TDF_Attribute)& anAtt);
private:
};
#endif // _TDF_DeltaOnRemoval_HeaderFile

View File

@@ -1,45 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1998-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ---------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Jul 6 1998 Creation
-- 1.0 Jul 6 1998 Separation Forget/Resume
class DeltaOnResume from TDF inherits AttributeDelta from TDF
---Purpose: This class provides default services for an
-- AttributeDelta on an Resume action.
--
-- Applying this AttributeDelta means FORGETTING its
-- attribute.
uses
Attribute from TDF
is
Create(anAtt : Attribute from TDF)
returns DeltaOnResume from TDF;
---Purpose: Creates a TDF_DeltaOnResume.
Apply (me : mutable)
is redefined static;
---Purpose: Applies the delta to the attribute.
end DeltaOnResume;

View File

@@ -14,22 +14,19 @@
// commercial license or contractual agreement.
// ---------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Jul 6 1998 Creation
#include <TDF_DeltaOnResume.ixx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DeltaOnResume.hxx>
#include <TDF_Label.hxx>
//=======================================================================
//function : TDF_DeltaOnResume
//purpose :
//=======================================================================
TDF_DeltaOnResume::TDF_DeltaOnResume
(const Handle(TDF_Attribute)& anAtt)
: TDF_AttributeDelta(anAtt)

View File

@@ -0,0 +1,69 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_DeltaOnResume_HeaderFile
#define _TDF_DeltaOnResume_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_AttributeDelta.hxx>
class TDF_Attribute;
class TDF_DeltaOnResume;
DEFINE_STANDARD_HANDLE(TDF_DeltaOnResume, TDF_AttributeDelta)
//! This class provides default services for an
//! AttributeDelta on an Resume action.
//!
//! Applying this AttributeDelta means FORGETTING its
//! attribute.
class TDF_DeltaOnResume : public TDF_AttributeDelta
{
public:
//! Creates a TDF_DeltaOnResume.
Standard_EXPORT TDF_DeltaOnResume(const Handle(TDF_Attribute)& anAtt);
//! Applies the delta to the attribute.
Standard_EXPORT void Apply() Standard_OVERRIDE;
DEFINE_STANDARD_RTTI(TDF_DeltaOnResume,TDF_AttributeDelta)
protected:
private:
};
#endif // _TDF_DeltaOnResume_HeaderFile

View File

@@ -1,140 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ----------------
---Version: 0.0
--Version Date Purpose
-- 0.0 May 26 1997 Creation
class IDFilter from TDF
---Purpose: This class offers filtering services around an ID list.
uses
GUID from Standard,
IDList from TDF,
IDMap from TDF,
Attribute from TDF
-- raises
is
Create(ignoreMode : Boolean from Standard = Standard_True)
returns IDFilter from TDF;
---Purpose: Creates an ID/attribute filter based on an ID
-- list. The default mode is "ignore all but...".
--
-- This filter has 2 working mode: keep and ignore.
--
-- Ignore/Exclusive mode: all IDs are ignored except
-- these set to be kept, using Keep(). Of course, it
-- is possible set an kept ID to be ignored using
-- Ignore().
--
-- Keep/Inclusive mode: all IDs are kept except these
-- set to be ignored, using Ignore(). Of course, it
-- is possible set an ignored ID to be kept using
-- Keep().
Create(aFilter : IDFilter from TDF)
returns IDFilter from TDF
is private;
---Purpose: Private, to forbid implicit or hidden accesses to
-- the copy constructor.
-- Mode methods.
IgnoreAll(me : in out; ignore : Boolean from Standard);
---Purpose: The list of ID is cleared and the filter mode is
-- set to ignore mode if <keep> is true; false
-- otherwise.
IgnoreAll(me) returns Boolean from Standard;
---Purpose: Returns true is the mode is set to "ignore all
-- but...".
--
---C++: inline
-- Keep/Ignore methods.
Keep(me : in out; anID : GUID from Standard);
---Purpose: An attribute with <anID> as ID is to be kept and
-- the filter will answer true to the question
-- IsKept(<anID>).
Keep(me : in out; anIDList : IDList from TDF);
---Purpose: Attributes with ID owned by <anIDList> are to be kept and
-- the filter will answer true to the question
-- IsKept(<anID>) with ID from <anIDList>.
Ignore(me : in out; anID : GUID from Standard);
---Purpose: An attribute with <anID> as ID is to be ignored and
-- the filter will answer false to the question
-- IsKept(<anID>).
Ignore(me : in out; anIDList : IDList from TDF);
---Purpose: Attributes with ID owned by <anIDList> are to be
-- ignored and the filter will answer false to the
-- question IsKept(<anID>) with ID from <anIDList>.
-- Question methods.
IsKept(me; anID : GUID from Standard) returns Boolean from Standard;
---Purpose: Returns true if the ID is to be kept.
--
---C++: inline
IsKept(me; anAtt : Attribute from TDF) returns Boolean from Standard;
---Purpose: Returns true if the attribute is to be kept.
--
---C++: inline
IsIgnored(me; anID : GUID from Standard) returns Boolean from Standard;
---Purpose: Returns true if the ID is to be ignored.
--
---C++: inline
IsIgnored(me; anAtt : Attribute from TDF) returns Boolean from Standard;
---Purpose: Returns true if the attribute is to be ignored.
--
---C++: inline
-- Miscelleaneous
IDList(me; anIDList : in out IDList from TDF);
---Purpose: Copies the list of ID to be kept or ignored in
-- <anIDList>. <anIDList> is cleared before use.
Copy(me : in out; fromFilter : IDFilter from TDF);
---Purpose: Copies into <me> the contents of
-- <fromFilter>. <me> is cleared before copy.
Dump(me; anOS : in out OStream from Standard);
---Purpose: Writes the contents of <me> to <OS>.
fields
myIgnore : Boolean from Standard;
myIDMap : IDMap from TDF;
end IDFilter;

View File

@@ -14,15 +14,13 @@
// commercial license or contractual agreement.
// ---------------------
// Version: 0.0
//Version Date Purpose
// 0.0 May 26 1997 Creation
#include <TDF_IDFilter.ixx>
#include <Standard_GUID.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_IDList.hxx>
#include <TDF_ListIteratorOfIDList.hxx>
#include <TDF_MapIteratorOfIDMap.hxx>

137
src/TDF/TDF_IDFilter.hxx Normal file
View File

@@ -0,0 +1,137 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_IDFilter_HeaderFile
#define _TDF_IDFilter_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_IDMap.hxx>
#include <TDF_IDList.hxx>
#include <Standard_OStream.hxx>
class Standard_GUID;
class TDF_Attribute;
//! This class offers filtering services around an ID list.
class TDF_IDFilter
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an ID/attribute filter based on an ID
//! list. The default mode is "ignore all but...".
//!
//! This filter has 2 working mode: keep and ignore.
//!
//! Ignore/Exclusive mode: all IDs are ignored except
//! these set to be kept, using Keep(). Of course, it
//! is possible set an kept ID to be ignored using
//! Ignore().
//!
//! Keep/Inclusive mode: all IDs are kept except these
//! set to be ignored, using Ignore(). Of course, it
//! is possible set an ignored ID to be kept using
//! Keep().
Standard_EXPORT TDF_IDFilter(const Standard_Boolean ignoreMode = Standard_True);
//! The list of ID is cleared and the filter mode is
//! set to ignore mode if <keep> is true; false
//! otherwise.
Standard_EXPORT void IgnoreAll (const Standard_Boolean ignore);
//! Returns true is the mode is set to "ignore all
//! but...".
Standard_Boolean IgnoreAll() const;
//! An attribute with <anID> as ID is to be kept and
//! the filter will answer true to the question
//! IsKept(<anID>).
Standard_EXPORT void Keep (const Standard_GUID& anID);
//! Attributes with ID owned by <anIDList> are to be kept and
//! the filter will answer true to the question
//! IsKept(<anID>) with ID from <anIDList>.
Standard_EXPORT void Keep (const TDF_IDList& anIDList);
//! An attribute with <anID> as ID is to be ignored and
//! the filter will answer false to the question
//! IsKept(<anID>).
Standard_EXPORT void Ignore (const Standard_GUID& anID);
//! Attributes with ID owned by <anIDList> are to be
//! ignored and the filter will answer false to the
//! question IsKept(<anID>) with ID from <anIDList>.
Standard_EXPORT void Ignore (const TDF_IDList& anIDList);
//! Returns true if the ID is to be kept.
Standard_Boolean IsKept (const Standard_GUID& anID) const;
//! Returns true if the attribute is to be kept.
Standard_Boolean IsKept (const Handle(TDF_Attribute)& anAtt) const;
//! Returns true if the ID is to be ignored.
Standard_Boolean IsIgnored (const Standard_GUID& anID) const;
//! Returns true if the attribute is to be ignored.
Standard_Boolean IsIgnored (const Handle(TDF_Attribute)& anAtt) const;
//! Copies the list of ID to be kept or ignored in
//! <anIDList>. <anIDList> is cleared before use.
Standard_EXPORT void IDList (TDF_IDList& anIDList) const;
//! Copies into <me> the contents of
//! <fromFilter>. <me> is cleared before copy.
Standard_EXPORT void Copy (const TDF_IDFilter& fromFilter);
//! Writes the contents of <me> to <OS>.
Standard_EXPORT void Dump (Standard_OStream& anOS) const;
protected:
private:
//! Private, to forbid implicit or hidden accesses to
//! the copy constructor.
Standard_EXPORT TDF_IDFilter(const TDF_IDFilter& aFilter);
Standard_Boolean myIgnore;
TDF_IDMap myIDMap;
};
#include <TDF_IDFilter.lxx>
#endif // _TDF_IDFilter_HeaderFile

View File

@@ -1,380 +0,0 @@
-- Created on: 1997-02-04
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
---Version: 0.0
--Version Date Purpose
-- 0.0 Feb 4 1997 Creation
class Label from TDF
---Purpose: This class provides basic operations to define
-- a label in a data structure.
-- A label is a feature in the feature hierarchy. A
-- label is always connected to a Data from TDF.
-- To a label is attached attributes containing the
-- software components information.
--
-- Label information:
--
-- It is possible to know the tag, the father, the
-- depth in the tree of the label, if the label is
-- root, null or equal to another label.
--
-- Comfort methods:
-- Some methods useful on a label.
--
-- Attributes:
--
-- It is possible to get an attribute in accordance
-- to an ID, or the yougest previous version of a
-- current attribute.
uses
GUID from Standard,
LabelNodePtr from TDF,
Data from TDF,
Attribute from TDF,
IDFilter from TDF,
AttributeIndexedMap from TDF
raises
DomainError from Standard,
OutOfRange from Standard,
NullObject from Standard
is
Create returns Label from TDF;
---Purpose: Constructs an empty label object.
---C++: inline
Create(aNode : LabelNodePtr from TDF) returns Label from TDF
is private;
---Purpose: Reserved to the friends.
---C++: inline
Nullify(me : in out);
---Purpose: Nullifies the label.
--
---C++: inline
---Category:Label information
-- ==========================
Data(me) returns Data from TDF;
---Purpose: Returns the Data owning <me>.
--
---C++: inline
Tag(me) returns Integer;
---Purpose: Returns the tag of the label.
-- This is the integer assigned randomly to a label
-- in a data framework. This integer is used to
-- identify this label in an entry.
--
---C++: inline
Father(me) returns Label from TDF;
---Purpose: Returns the label father. This label may be null
-- if the label is root.
--
---C++: inline
---C++: return const
IsNull(me) returns Boolean from Standard;
---Purpose: Returns True if the <aLabel> is null, i.e. it has
-- not been included in the data framework.
--
---C++: inline
Imported(me; aStatus : Boolean from Standard);
---Purpose: Sets or unsets <me> and all its descendants as
-- imported label, according to <aStatus>.
IsImported(me) returns Boolean from Standard;
---Purpose: Returns True if the <aLabel> is imported.
--
---C++: inline
IsEqual(me; aLabel : Label from TDF) returns Boolean from Standard;
---Purpose: Returns True if the <aLabel> is equal to me (same
-- LabelNode*).
---C++: inline
---C++: alias operator ==
IsDifferent(me; aLabel : Label from TDF) returns Boolean from Standard;
---Puprpose: Returns True if the <aLabel> is different than me
-- (not same LabelNode*).
--
---C++: inline
---C++: alias operator !=
IsRoot(me) returns Boolean from Standard;
---Puprpose: Returns True if the label is root.
---C++: inline
---Category: Attribute methods
-- ===========================
---Warning: : becomes obsolete week 10
-- IsA (me; anID : GUID from Standard) returns Boolean from Standard;
-- Resume (me; anAttribute : Attribute from TDF) raises DomainError from Standard;
-- Add (me; anAttribute : Attribute from TDF) raises DomainError from Standard;
-- Forget (me; anAttribute : Attribute from TDF) raises DomainError from Standard;
-- Forget (me; aguid : GUID from Standard) returns Boolean from Standard;
-- ForgetAll (me; clearChildren : Boolean from Standard = Standard_True);
IsAttribute (me; anID : GUID from Standard) returns Boolean from Standard;
---Purpose: Returns true if <me> owns an attribute with <anID> as ID.
AddAttribute (me; anAttribute : Attribute from TDF)
---Purpose: Adds an Attribute to the current label. Raises if
-- there is already one.
raises DomainError from Standard;
ForgetAttribute (me; anAttribute : Attribute from TDF)
---Purpose: Forgets an Attribute from the current label,
-- setting its forgotten status true and its valid
-- status false. Raises if the attribute is not in
-- the structure.
raises DomainError from Standard;
ForgetAttribute (me; aguid : GUID from Standard)
---Purpose: Forgets the Attribute of GUID <aguid> from the
-- current label . If the attribute doesn't exist
-- returns False. Otherwise returns True.
returns Boolean from Standard;
ForgetAllAttributes (me; clearChildren : Boolean from Standard = Standard_True);
---Purpose: Forgets all the attributes. Does it on also on the
-- sub-labels if <clearChildren> is set to true. Of
-- course, this method is compatible with Transaction
-- & Delta mecanisms.
ResumeAttribute (me; anAttribute : Attribute from TDF)
---Purpose: Undo Forget action, setting its forgotten status
-- false and its valid status true. Raises if the
-- attribute is not in the structure.
raises DomainError from Standard;
FindAttribute (me;
anID : GUID from Standard;
anAttribute : in out Attribute from TDF)
returns Boolean from Standard;
---Purpose: Finds an attribute of the current label, according
-- to <anID>.
-- If anAttribute is not a valid one, false is returned.
--
-- The method returns True if found, False otherwise.
--
-- A removed attribute cannot be found.
FindAttribute (me;
anID : GUID from Standard;
aTransaction : Integer from Standard;
anAttribute : in out Attribute from TDF)
returns Boolean from Standard;
---Purpose: Finds an attribute of the current label, according
-- to <anID> and <aTransaction>. This attribute
-- has/had to be a valid one for the given
-- transaction index . So, this attribute is not
-- necessary a valid one.
--
-- The method returns True if found, False otherwise.
--
-- A removed attribute cannot be found nor a backuped
-- attribute of a removed one.
MayBeModified(me)
returns Boolean from Standard;
---Purpose: Returns true if <me> or a DESCENDANT of <me> owns
-- attributes not yet available in transaction 0. It
-- means at least one of their attributes is new,
-- modified or deleted.
--
---C++: inline
AttributesModified(me)
returns Boolean from Standard;
---Purpose: Returns true if <me> owns attributes not yet
-- available in transaction 0. It means at least one
-- attribute is new, modified or deleted.
--
---C++: inline
HasAttribute(me) returns Boolean from Standard;
---Purpose: Returns true if this label has at least one attribute.
NbAttributes(me) returns Integer;
---Purpose: Returns the number of attributes.
---Category: Label comfort methods
--================================
Depth(me) returns Integer from Standard;
---Purpose: Returns the depth of the label in the data framework.
-- This corresponds to the number of fathers which
-- this label has, and is used in determining
-- whether a label is root, null or equivalent to another label.
-- Exceptions:
-- Standard_NullObject if this label is null. This is
-- because a null object can have no depth.
IsDescendant(me; aLabel : Label from TDF) returns Boolean from Standard;
---Purpose: Returns True if <me> is a descendant of
-- <aLabel>. Attention: every label is its own
-- descendant.
Root(me) returns Label from TDF;
---Purpose: Returns the root label Root of the data structure.
-- This has a depth of 0.
-- Exceptions:
-- Standard_NullObject if this label is null. This is
-- because a null object can have no depth.
---C++: return const
HasChild(me) returns Boolean from Standard;
---Purpose: Returns true if this label has at least one child.
---C++: inline
NbChildren(me) returns Integer;
---Purpose: Returns the number of children.
FindChild(me; aTag : Integer from Standard;
create : Boolean from Standard = Standard_True)
returns Label from TDF
raises NullObject, DomainError, OutOfRange from Standard;
---Purpose: Finds a child label having <aTag> as tag. Creates
-- The tag aTag identifies the label which will be the parent.
-- If create is true and no child label is found, a new one is created.
-- Example:
-- //creating a label with tag 10 at Root
-- TDF_Label lab1 = aDF->Root().FindChild(10);
-- //creating labels 7 and 2 on label 10
-- TDF_Label lab2 = lab1.FindChild(7);
-- TDF_Label lab3 = lab1.FindChild(2);
NewChild (me)
returns Label from TDF
raises NullObject, DomainError, OutOfRange from Standard;
---Purpose: Create a new child label of me using autoamtic
-- delivery tags provided by TagSource.
---C++: inline
---Category: Miscelleaneous
-- ========================
Transaction(me) returns Integer from Standard;
---Purpose: Returns the current transaction index.
HasLowerNode(me; otherLabel : Label from TDF)
returns Boolean from Standard;
---Purpose: Returns true if node address of <me> is lower than
-- <otherLabel> one. Used to quickly sort labels (not
-- on entry criterion).
--
-- -C++: inline
HasGreaterNode(me; otherLabel : Label from TDF)
returns Boolean from Standard;
---Purpose: Returns true if node address of <me> is greater
-- than <otherLabel> one. Used to quickly sort labels
-- (not on entry criterion).
--
-- -C++: inline
Dump(me; anOS : in out OStream from Standard)
returns OStream from Standard;
---Purpose: Dumps the minimum information about <me> on
-- <aStream>.
--
---C++: return &
---C++: alias operator<<
ExtendedDump(me;
anOS : in out OStream from Standard;
aFilter : IDFilter from TDF;
aMap : in out AttributeIndexedMap from TDF);
---Purpose: Dumps the label on <aStream> and its attributes
-- rank in <aMap> if their IDs are kept by <IDFilter>.
EntryDump(me; anOS : in out OStream from Standard);
---Purpose: Dumps the label entry.
---Category: Private methods
-- =========================
AddToNode(me; toNode : LabelNodePtr from TDF;
anAttribute : Attribute from TDF)
raises DomainError from Standard
is private;
---Purpose: Adds an Attribute to <toNode>. Raises if there is
-- already one.
ForgetFromNode(me; fromNode : LabelNodePtr from TDF;
anAttribute : Attribute from TDF)
raises DomainError from Standard
is private;
---Purpose: Forgets an Attribute from <fromNode>. Raises if
-- the attribute is not in the structure.
ResumeToNode (me; fromNode : LabelNodePtr from TDF;
anAttribute : Attribute from TDF)
raises DomainError, NullObject from Standard
is private;
---Purpose: Resumes a forgotten Attribute to <toNode>. Raises
-- if the attribute is not in the structure.
FindOrAddChild(me; aTag : Integer from Standard;
create : Boolean from Standard)
returns LabelNodePtr from TDF
is private;
InternalDump(me; anOS : in out OStream from Standard;
aFilter : IDFilter from TDF;
aMap : in out AttributeIndexedMap from TDF;
extended : Boolean from Standard)
is private;
fields
myLabelNode : LabelNodePtr from TDF;
friends
class ChildIterator from TDF,
class Attribute from TDF,
class AttributeIterator from TDF,
class Data from TDF,
class LabelMapHasher from TDF
end Label;

View File

@@ -13,27 +13,29 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TDF_Label.ixx>
#include <Standard_DomainError.hxx>
#include <Standard_GUID.hxx>
#include <Standard_ImmutableObject.hxx>
#include <Standard_NullObject.hxx>
#include <Standard_OutOfRange.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Data.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelMapHasher.hxx>
#include <TDF_LabelNode.hxx>
#include <TDF_LabelNodePtr.hxx>
#include <TDF_Tool.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_ImmutableObject.hxx>
// Attribute methods ++++++++++++++++++++++++++++++++++++++++++++++++++++
//=======================================================================
//function : Imported
//purpose : Sets imported and all its descendants.
//=======================================================================
void TDF_Label::Imported(const Standard_Boolean aStatus) const
{
if (IsNull()) Standard_NullObject::Raise("A null Label has no status.");

305
src/TDF/TDF_Label.hxx Normal file
View File

@@ -0,0 +1,305 @@
// Created on: 1997-02-04
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Label_HeaderFile
#define _TDF_Label_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <TDF_LabelNodePtr.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_OStream.hxx>
#include <TDF_AttributeIndexedMap.hxx>
class Standard_DomainError;
class Standard_OutOfRange;
class Standard_NullObject;
class TDF_ChildIterator;
class TDF_Attribute;
class TDF_AttributeIterator;
class TDF_Data;
class TDF_LabelMapHasher;
class Standard_GUID;
class TDF_IDFilter;
//! This class provides basic operations to define
//! a label in a data structure.
//! A label is a feature in the feature hierarchy. A
//! label is always connected to a Data from TDF.
//! To a label is attached attributes containing the
//! software components information.
//!
//! Label information:
//!
//! It is possible to know the tag, the father, the
//! depth in the tree of the label, if the label is
//! root, null or equal to another label.
//!
//! Comfort methods:
//! Some methods useful on a label.
//!
//! Attributes:
//!
//! It is possible to get an attribute in accordance
//! to an ID, or the yougest previous version of a
//! current attribute.
class TDF_Label
{
public:
DEFINE_STANDARD_ALLOC
//! Constructs an empty label object.
TDF_Label();
//! Nullifies the label.
void Nullify();
//! Returns the Data owning <me>.
Handle(TDF_Data) Data() const;
//! Returns the tag of the label.
//! This is the integer assigned randomly to a label
//! in a data framework. This integer is used to
//! identify this label in an entry.
Standard_Integer Tag() const;
//! Returns the label father. This label may be null
//! if the label is root.
const TDF_Label Father() const;
//! Returns True if the <aLabel> is null, i.e. it has
//! not been included in the data framework.
Standard_Boolean IsNull() const;
//! Sets or unsets <me> and all its descendants as
//! imported label, according to <aStatus>.
Standard_EXPORT void Imported (const Standard_Boolean aStatus) const;
//! Returns True if the <aLabel> is imported.
Standard_Boolean IsImported() const;
//! Returns True if the <aLabel> is equal to me (same
//! LabelNode*).
Standard_Boolean IsEqual (const TDF_Label& aLabel) const;
Standard_Boolean operator == (const TDF_Label& aLabel) const
{
return IsEqual(aLabel);
}
Standard_Boolean IsDifferent (const TDF_Label& aLabel) const;
Standard_Boolean operator != (const TDF_Label& aLabel) const
{
return IsDifferent(aLabel);
}
Standard_Boolean IsRoot() const;
//! Returns true if <me> owns an attribute with <anID> as ID.
Standard_EXPORT Standard_Boolean IsAttribute (const Standard_GUID& anID) const;
//! Adds an Attribute to the current label. Raises if
//! there is already one.
Standard_EXPORT void AddAttribute (const Handle(TDF_Attribute)& anAttribute) const;
//! Forgets an Attribute from the current label,
//! setting its forgotten status true and its valid
//! status false. Raises if the attribute is not in
//! the structure.
Standard_EXPORT void ForgetAttribute (const Handle(TDF_Attribute)& anAttribute) const;
//! Forgets the Attribute of GUID <aguid> from the
//! current label . If the attribute doesn't exist
//! returns False. Otherwise returns True.
Standard_EXPORT Standard_Boolean ForgetAttribute (const Standard_GUID& aguid) const;
//! Forgets all the attributes. Does it on also on the
//! sub-labels if <clearChildren> is set to true. Of
//! course, this method is compatible with Transaction
//! & Delta mecanisms.
Standard_EXPORT void ForgetAllAttributes (const Standard_Boolean clearChildren = Standard_True) const;
//! Undo Forget action, setting its forgotten status
//! false and its valid status true. Raises if the
//! attribute is not in the structure.
Standard_EXPORT void ResumeAttribute (const Handle(TDF_Attribute)& anAttribute) const;
//! Finds an attribute of the current label, according
//! to <anID>.
//! If anAttribute is not a valid one, false is returned.
//!
//! The method returns True if found, False otherwise.
//!
//! A removed attribute cannot be found.
Standard_EXPORT Standard_Boolean FindAttribute (const Standard_GUID& anID, Handle(TDF_Attribute)& anAttribute) const;
//! Finds an attribute of the current label, according
//! to <anID> and <aTransaction>. This attribute
//! has/had to be a valid one for the given
//! transaction index . So, this attribute is not
//! necessary a valid one.
//!
//! The method returns True if found, False otherwise.
//!
//! A removed attribute cannot be found nor a backuped
//! attribute of a removed one.
Standard_EXPORT Standard_Boolean FindAttribute (const Standard_GUID& anID, const Standard_Integer aTransaction, Handle(TDF_Attribute)& anAttribute) const;
//! Returns true if <me> or a DESCENDANT of <me> owns
//! attributes not yet available in transaction 0. It
//! means at least one of their attributes is new,
//! modified or deleted.
Standard_Boolean MayBeModified() const;
//! Returns true if <me> owns attributes not yet
//! available in transaction 0. It means at least one
//! attribute is new, modified or deleted.
Standard_Boolean AttributesModified() const;
//! Returns true if this label has at least one attribute.
Standard_EXPORT Standard_Boolean HasAttribute() const;
//! Returns the number of attributes.
Standard_EXPORT Standard_Integer NbAttributes() const;
//! Returns the depth of the label in the data framework.
//! This corresponds to the number of fathers which
//! this label has, and is used in determining
//! whether a label is root, null or equivalent to another label.
//! Exceptions:
//! Standard_NullObject if this label is null. This is
//! because a null object can have no depth.
Standard_EXPORT Standard_Integer Depth() const;
//! Returns True if <me> is a descendant of
//! <aLabel>. Attention: every label is its own
//! descendant.
Standard_EXPORT Standard_Boolean IsDescendant (const TDF_Label& aLabel) const;
//! Returns the root label Root of the data structure.
//! This has a depth of 0.
//! Exceptions:
//! Standard_NullObject if this label is null. This is
//! because a null object can have no depth.
Standard_EXPORT const TDF_Label Root() const;
//! Returns true if this label has at least one child.
Standard_Boolean HasChild() const;
//! Returns the number of children.
Standard_EXPORT Standard_Integer NbChildren() const;
//! Finds a child label having <aTag> as tag. Creates
//! The tag aTag identifies the label which will be the parent.
//! If create is true and no child label is found, a new one is created.
//! Example:
//! //creating a label with tag 10 at Root
//! TDF_Label lab1 = aDF->Root().FindChild(10);
//! //creating labels 7 and 2 on label 10
//! TDF_Label lab2 = lab1.FindChild(7);
//! TDF_Label lab3 = lab1.FindChild(2);
Standard_EXPORT TDF_Label FindChild (const Standard_Integer aTag, const Standard_Boolean create = Standard_True) const;
//! Create a new child label of me using autoamtic
//! delivery tags provided by TagSource.
TDF_Label NewChild() const;
//! Returns the current transaction index.
Standard_EXPORT Standard_Integer Transaction() const;
//! Returns true if node address of <me> is lower than
//! <otherLabel> one. Used to quickly sort labels (not
//! on entry criterion).
//!
//! -C++: inline
Standard_EXPORT Standard_Boolean HasLowerNode (const TDF_Label& otherLabel) const;
//! Returns true if node address of <me> is greater
//! than <otherLabel> one. Used to quickly sort labels
//! (not on entry criterion).
//!
//! -C++: inline
Standard_EXPORT Standard_Boolean HasGreaterNode (const TDF_Label& otherLabel) const;
//! Dumps the minimum information about <me> on
//! <aStream>.
Standard_EXPORT Standard_OStream& Dump (Standard_OStream& anOS) const;
Standard_OStream& operator<< (Standard_OStream& anOS) const
{
return Dump(anOS);
}
//! Dumps the label on <aStream> and its attributes
//! rank in <aMap> if their IDs are kept by <IDFilter>.
Standard_EXPORT void ExtendedDump (Standard_OStream& anOS, const TDF_IDFilter& aFilter, TDF_AttributeIndexedMap& aMap) const;
//! Dumps the label entry.
Standard_EXPORT void EntryDump (Standard_OStream& anOS) const;
friend class TDF_ChildIterator;
friend class TDF_Attribute;
friend class TDF_AttributeIterator;
friend class TDF_Data;
friend class TDF_LabelMapHasher;
protected:
private:
//! Reserved to the friends.
TDF_Label(const TDF_LabelNodePtr& aNode);
//! Adds an Attribute to <toNode>. Raises if there is
//! already one.
Standard_EXPORT void AddToNode (const TDF_LabelNodePtr& toNode, const Handle(TDF_Attribute)& anAttribute) const;
//! Forgets an Attribute from <fromNode>. Raises if
//! the attribute is not in the structure.
Standard_EXPORT void ForgetFromNode (const TDF_LabelNodePtr& fromNode, const Handle(TDF_Attribute)& anAttribute) const;
//! Resumes a forgotten Attribute to <toNode>. Raises
//! if the attribute is not in the structure.
Standard_EXPORT void ResumeToNode (const TDF_LabelNodePtr& fromNode, const Handle(TDF_Attribute)& anAttribute) const;
Standard_EXPORT TDF_LabelNodePtr FindOrAddChild (const Standard_Integer aTag, const Standard_Boolean create) const;
Standard_EXPORT void InternalDump (Standard_OStream& anOS, const TDF_IDFilter& aFilter, TDF_AttributeIndexedMap& aMap, const Standard_Boolean extended) const;
TDF_LabelNodePtr myLabelNode;
};
#include <TDF_Label.lxx>
#endif // _TDF_Label_HeaderFile

View File

@@ -1,44 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ----------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Feb 13 1997 Creation
class LabelMapHasher from TDF
---Purpose: A label hasher for label maps.
uses
Label from TDF
is
HashCode(myclass; aLab : Label from TDF; Upper : Integer) returns Integer;
---Purpose: Returns a HasCode value for the Key <K> in the
-- range 0..Upper.
--
---C++: inline
IsEqual(myclass; aLab1, aLab2 : Label from TDF) returns Boolean;
---Purpose: Returns True when the two keys are the same. Two
-- same keys must have the same hashcode, the
-- contrary is not necessary.
--
---C++: inline
end LabelMapHasher;

View File

@@ -14,11 +14,9 @@
// commercial license or contractual agreement.
// ----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Feb 13 1997 Creation
#include <TDF_LabelMapHasher.ixx>
#include <TDF_Label.hxx>
#include <TDF_LabelMapHasher.hxx>

View File

@@ -0,0 +1,69 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_LabelMapHasher_HeaderFile
#define _TDF_LabelMapHasher_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
class TDF_Label;
//! A label hasher for label maps.
class TDF_LabelMapHasher
{
public:
DEFINE_STANDARD_ALLOC
//! Returns a HasCode value for the Key <K> in the
//! range 0..Upper.
static Standard_Integer HashCode (const TDF_Label& aLab, const Standard_Integer Upper);
//! Returns True when the two keys are the same. Two
//! same keys must have the same hashcode, the
//! contrary is not necessary.
static Standard_Boolean IsEqual (const TDF_Label& aLab1, const TDF_Label& aLab2);
protected:
private:
};
#include <TDF_LabelMapHasher.lxx>
#endif // _TDF_LabelMapHasher_HeaderFile

View File

@@ -0,0 +1,22 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_LabelNodePtr_HeaderFile
#define _TDF_LabelNodePtr_HeaderFile
class TDF_LabelNode;
typedef TDF_LabelNode* TDF_LabelNodePtr;
#endif // _TDF_LabelNodePtr_HeaderFile

View File

@@ -1,75 +0,0 @@
-- Created on: 2000-03-01
-- Created by: Denis PASCAL
-- Copyright (c) 2000-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class Reference from TDF inherits Attribute from TDF
---Purpose: This attribute is used to store in the framework a
-- reference to an other label.
uses Attribute from TDF,
Label from TDF,
GUID from Standard,
DataSet from TDF,
RelocationTable from TDF
is
GetID (myclass)
---C++: return const &
returns GUID from Standard;
Set (myclass; I : Label from TDF; Origin : Label from TDF)
returns Reference from TDF;
Set (me : mutable; Origin : Label from TDF);
Get (me)
returns Label from TDF;
---Category: TDF_Attribute methods
-- =====================
ID (me)
---C++: return const &
returns GUID from Standard;
Restore (me: mutable; With : Attribute from TDF);
NewEmpty (me)
returns Attribute from TDF;
Paste (me; Into : Attribute from TDF;
RT : RelocationTable from TDF);
References (me; DS : DataSet from TDF) is redefined;
Dump(me; anOS : in out OStream from Standard)
returns OStream from Standard
is redefined;
---C++: return &
Create
returns Reference from TDF;
fields
myOrigin : Label from TDF;
end Reference;

View File

@@ -13,15 +13,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TDF_Reference.ixx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_Label.hxx>
#include <TDF_Reference.hxx>
#include <TDF_RelocationTable.hxx>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& TDF_Reference::GetID ()
{
static Standard_GUID TDF_ReferenceID("2a96b610-ec8b-11d0-bee7-080009dc3333");

89
src/TDF/TDF_Reference.hxx Normal file
View File

@@ -0,0 +1,89 @@
// Created on: 2000-03-01
// Created by: Denis PASCAL
// Copyright (c) 2000-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Reference_HeaderFile
#define _TDF_Reference_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <TDF_Label.hxx>
#include <TDF_Attribute.hxx>
#include <Standard_OStream.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
class TDF_RelocationTable;
class TDF_DataSet;
class TDF_Reference;
DEFINE_STANDARD_HANDLE(TDF_Reference, TDF_Attribute)
//! This attribute is used to store in the framework a
//! reference to an other label.
class TDF_Reference : public TDF_Attribute
{
public:
Standard_EXPORT static const Standard_GUID& GetID();
Standard_EXPORT static Handle(TDF_Reference) Set (const TDF_Label& I, const TDF_Label& Origin);
Standard_EXPORT void Set (const TDF_Label& Origin);
Standard_EXPORT TDF_Label Get() const;
Standard_EXPORT const Standard_GUID& ID() const;
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const;
Standard_EXPORT virtual void References (const Handle(TDF_DataSet)& DS) const Standard_OVERRIDE;
Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
Standard_EXPORT TDF_Reference();
DEFINE_STANDARD_RTTI(TDF_Reference,TDF_Attribute)
protected:
private:
TDF_Label myOrigin;
};
#endif // _TDF_Reference_HeaderFile

View File

@@ -1,207 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -----------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Mar 6 1997 Creation
-- 1.0 Sep 23 1998 DoubleMaps->DataMap
class RelocationTable from TDF
inherits TShared from MMgt
---Purpose: This is a relocation dictionnary between source
-- and target labels, attributes or any
-- transient(useful for copy or paste actions).
-- Note that one target value may be the
-- relocation value of more than one source object.
--
-- Common behaviour: it returns true and the found
-- relocation value as target object; false
-- otherwise.
--
-- Look at SelfRelocate method for more explanation
-- about self relocation behavior of this class.
uses
Attribute from TDF,
Data from TDF,
Label from TDF,
LabelMap from TDF,
LabelDataMap from TDF,
AttributeMap from TDF,
AttributeDataMap from TDF,
IndexedDataMapOfTransientTransient from TColStd
-- raises
is
Create(selfRelocate : Boolean from Standard = Standard_False)
-- Create(selfRelocate : Boolean from Standard = Standard_False;afterRelocate :Boolean from Standard = Standard_False)
returns RelocationTable from TDF;
---Purpose: Creates an relocation table. <selfRelocate> says
-- if a value without explicit relocation is its own
-- relocation.
---Category: Self relocation methods.
-- -------------------------
SelfRelocate(me : mutable; selfRelocate : Boolean from Standard);
---Purpose: Sets <mySelfRelocate> to <selfRelocate>.
--
-- This flag affects the HasRelocation method
-- behavior like this:
--
-- <mySelfRelocate> == False:
--
-- If no relocation object is found in the map, a
-- null object is returned
--
-- <mySelfRelocate> == True:
--
-- If no relocation object is found in the map, the
-- method assumes the source object is relocation
-- value; so the source object is returned as target
-- object.
SelfRelocate(me) returns Boolean from Standard;
---Purpose: Returns <mySelfRelocate>.
AfterRelocate(me : mutable; afterRelocate : Boolean from Standard);
AfterRelocate(me) returns Boolean from Standard;
---Purpose: Returns <myAfterRelocate>.
---Category: Label relocation methods.
-- -------------------------
SetRelocation(me : mutable;
aSourceLabel : Label from TDF;
aTargetLabel : Label from TDF);
---Purpose: Sets the relocation value of <aSourceLabel> to
-- <aTargetLabel>.
HasRelocation(me;
aSourceLabel : Label from TDF;
aTargetLabel : in out Label from TDF)
returns Boolean from Standard;
---Purpose: Finds the relocation value of <aSourceLabel>
-- and returns it into <aTargetLabel>.
--
-- (See above SelfRelocate method for more
-- explanation about the method behavior)
---Category: Attribute relocation methods.
-- -----------------------------
SetRelocation(me : mutable;
aSourceAttribute : Attribute from TDF;
aTargetAttribute : Attribute from TDF);
---Purpose: Sets the relocation value of <aSourceAttribute> to
-- <aTargetAttribute>.
HasRelocation(me;
aSourceAttribute : Attribute from TDF;
aTargetAttribute : in out Attribute from TDF)
returns Boolean from Standard;
---Purpose: Finds the relocation value of <aSourceAttribute>
-- and returns it into <aTargetAttribute>.
--
-- (See above SelfRelocate method for more
-- explanation about the method behavior)
---Category: Transient other types object relocation methods.
-- ------------------------------------------------
SetTransientRelocation(me : mutable;
aSourceTransient : Transient from Standard;
aTargetTransient : Transient from Standard);
---Purpose: Sets the relocation value of <aSourceTransient> to
-- <aTargetTransient>.
HasTransientRelocation
(me;
aSourceTransient : Transient from Standard;
aTargetTransient : in out Transient from Standard)
returns Boolean from Standard;
---Purpose: Finds the relocation value of <aSourceTransient>
-- and returns it into <aTargetTransient>.
--
-- (See above SelfRelocate method for more
-- explanation about the method behavior)
---Category: Miscelleaneous
-- --------------
Clear(me : mutable);
---Purpose: Clears the relocation dictionnary, but lets the
-- self relocation flag to its current value.
TargetLabelMap(me; aLabelMap : in out LabelMap from TDF);
---Purpose: Fills <aLabelMap> with target relocation
-- labels. <aLabelMap> is not cleared before use.
TargetAttributeMap(me; anAttributeMap : in out AttributeMap from TDF);
---Purpose: Fills <anAttributeMap> with target relocation
-- attributes. <anAttributeMap> is not cleared before
-- use.
-- Try not to use the following methods, for they are very
-- implementation dependent.
LabelTable(me : mutable)
returns LabelDataMap from TDF;
---Purpose: Returns <myLabelTable> to be used or updated.
--
---C++: return &
AttributeTable(me : mutable)
returns AttributeDataMap from TDF;
---Purpose: Returns <myAttributeTable> to be used or updated.
--
---C++: return &
TransientTable(me : mutable)
returns IndexedDataMapOfTransientTransient from TColStd;
---Purpose: Returns <myTransientTable> to be used or updated.
--
---C++: return &
Dump(me;
dumpLabels, dumpAttributes, dumpTransients : Boolean from Standard;
anOS : in out OStream from Standard)
returns OStream from Standard;
---Purpose: Dumps the relocation table.
--
---C++: return &
fields
mySelfRelocate : Boolean from Standard;
myAfterRelocate : Boolean from Standard;
myLabelTable : LabelDataMap from TDF;
myAttributeTable : AttributeDataMap from TDF;
myTransientTable : IndexedDataMapOfTransientTransient from TColStd;
-- Indexed... because there is no other type available in TColStd.
end RelocationTable from TDF;

View File

@@ -14,24 +14,22 @@
// commercial license or contractual agreement.
// -----------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Mar 7 1997 Creation
#include <TDF_RelocationTable.ixx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_DataMapIteratorOfAttributeDataMap.hxx>
#include <TDF_DataMapIteratorOfLabelDataMap.hxx>
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
//=======================================================================
//function : TDF_RelocationTable
//purpose :
//=======================================================================
TDF_RelocationTable::TDF_RelocationTable(const Standard_Boolean selfRelocate)
: mySelfRelocate(selfRelocate),myAfterRelocate(Standard_False)
{}

View File

@@ -0,0 +1,173 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_RelocationTable_HeaderFile
#define _TDF_RelocationTable_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_LabelDataMap.hxx>
#include <TDF_AttributeDataMap.hxx>
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <MMgt_TShared.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_AttributeMap.hxx>
#include <Standard_OStream.hxx>
class TDF_Label;
class TDF_Attribute;
class Standard_Transient;
class TDF_RelocationTable;
DEFINE_STANDARD_HANDLE(TDF_RelocationTable, MMgt_TShared)
//! This is a relocation dictionnary between source
//! and target labels, attributes or any
//! transient(useful for copy or paste actions).
//! Note that one target value may be the
//! relocation value of more than one source object.
//!
//! Common behaviour: it returns true and the found
//! relocation value as target object; false
//! otherwise.
//!
//! Look at SelfRelocate method for more explanation
//! about self relocation behavior of this class.
class TDF_RelocationTable : public MMgt_TShared
{
public:
//! Creates an relocation table. <selfRelocate> says
//! if a value without explicit relocation is its own
//! relocation.
Standard_EXPORT TDF_RelocationTable(const Standard_Boolean selfRelocate = Standard_False);
//! Sets <mySelfRelocate> to <selfRelocate>.
//!
//! This flag affects the HasRelocation method
//! behavior like this:
//!
//! <mySelfRelocate> == False:
//!
//! If no relocation object is found in the map, a
//! null object is returned
//!
//! <mySelfRelocate> == True:
//!
//! If no relocation object is found in the map, the
//! method assumes the source object is relocation
//! value; so the source object is returned as target
//! object.
Standard_EXPORT void SelfRelocate (const Standard_Boolean selfRelocate);
//! Returns <mySelfRelocate>.
Standard_EXPORT Standard_Boolean SelfRelocate() const;
Standard_EXPORT void AfterRelocate (const Standard_Boolean afterRelocate);
//! Returns <myAfterRelocate>.
Standard_EXPORT Standard_Boolean AfterRelocate() const;
//! Sets the relocation value of <aSourceLabel> to
//! <aTargetLabel>.
Standard_EXPORT void SetRelocation (const TDF_Label& aSourceLabel, const TDF_Label& aTargetLabel);
//! Finds the relocation value of <aSourceLabel>
//! and returns it into <aTargetLabel>.
//!
//! (See above SelfRelocate method for more
//! explanation about the method behavior)
Standard_EXPORT Standard_Boolean HasRelocation (const TDF_Label& aSourceLabel, TDF_Label& aTargetLabel) const;
//! Sets the relocation value of <aSourceAttribute> to
//! <aTargetAttribute>.
Standard_EXPORT void SetRelocation (const Handle(TDF_Attribute)& aSourceAttribute, const Handle(TDF_Attribute)& aTargetAttribute);
//! Finds the relocation value of <aSourceAttribute>
//! and returns it into <aTargetAttribute>.
//!
//! (See above SelfRelocate method for more
//! explanation about the method behavior)
Standard_EXPORT Standard_Boolean HasRelocation (const Handle(TDF_Attribute)& aSourceAttribute, Handle(TDF_Attribute)& aTargetAttribute) const;
//! Sets the relocation value of <aSourceTransient> to
//! <aTargetTransient>.
Standard_EXPORT void SetTransientRelocation (const Handle(Standard_Transient)& aSourceTransient, const Handle(Standard_Transient)& aTargetTransient);
//! Finds the relocation value of <aSourceTransient>
//! and returns it into <aTargetTransient>.
//!
//! (See above SelfRelocate method for more
//! explanation about the method behavior)
Standard_EXPORT Standard_Boolean HasTransientRelocation (const Handle(Standard_Transient)& aSourceTransient, Handle(Standard_Transient)& aTargetTransient) const;
//! Clears the relocation dictionnary, but lets the
//! self relocation flag to its current value.
Standard_EXPORT void Clear();
//! Fills <aLabelMap> with target relocation
//! labels. <aLabelMap> is not cleared before use.
Standard_EXPORT void TargetLabelMap (TDF_LabelMap& aLabelMap) const;
//! Fills <anAttributeMap> with target relocation
//! attributes. <anAttributeMap> is not cleared before
//! use.
Standard_EXPORT void TargetAttributeMap (TDF_AttributeMap& anAttributeMap) const;
//! Returns <myLabelTable> to be used or updated.
Standard_EXPORT TDF_LabelDataMap& LabelTable();
//! Returns <myAttributeTable> to be used or updated.
Standard_EXPORT TDF_AttributeDataMap& AttributeTable();
//! Returns <myTransientTable> to be used or updated.
Standard_EXPORT TColStd_IndexedDataMapOfTransientTransient& TransientTable();
//! Dumps the relocation table.
Standard_EXPORT Standard_OStream& Dump (const Standard_Boolean dumpLabels, const Standard_Boolean dumpAttributes, const Standard_Boolean dumpTransients, Standard_OStream& anOS) const;
DEFINE_STANDARD_RTTI(TDF_RelocationTable,MMgt_TShared)
protected:
private:
Standard_Boolean mySelfRelocate;
Standard_Boolean myAfterRelocate;
TDF_LabelDataMap myLabelTable;
TDF_AttributeDataMap myAttributeTable;
TColStd_IndexedDataMapOfTransientTransient myTransientTable;
};
#endif // _TDF_RelocationTable_HeaderFile

View File

@@ -1,86 +0,0 @@
-- Created on: 1997-08-04
-- Created by: VAUTHIER Jean-Claude
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
class TagSource from TDF inherits Attribute from TDF
---Purpose: This attribute manage a tag provider to create
-- child labels of a given one.
uses GUID from Standard,
Attribute from TDF,
Label from TDF,
RelocationTable from TDF
is
---Purpose: class methods
-- =============
GetID (myclass)
---C++: return const &
returns GUID from Standard;
Set (myclass; label : Label from TDF)
---Purpose: Find, or create, a TagSource attribute. the TagSource
-- attribute is returned.
returns TagSource from TDF;
NewChild (myclass; L : Label from TDF)
---Purpose: Find (or create) a tagSource attribute located at <L>
-- and make a new child label.
returns Label from TDF;
---Purpose: TagSource methods
-- =================
Create
returns TagSource from TDF;
NewTag (me : mutable)
returns Integer from Standard;
NewChild (me : mutable)
returns Label from TDF;
Get (me) returns Integer from Standard;
Set (me : mutable; T : Integer from Standard);
---Purpose: TDF_Attribute methods
-- =====================
ID (me)
---C++: return const &
returns GUID from Standard;
Restore (me: mutable; with : Attribute from TDF);
NewEmpty (me)
returns Attribute from TDF;
Paste (me; Into : Attribute from TDF;
RT : RelocationTable from TDF);
fields
myTag : Integer from Standard;
end TagSource;

View File

@@ -14,15 +14,18 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <TDF_TagSource.ixx>
#include <Standard_GUID.hxx>
#include <Standard_GUID.hxx>
#include <Standard_Type.hxx>
#include <TDF_Attribute.hxx>
#include <TDF_Label.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_TagSource.hxx>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& TDF_TagSource::GetID () {
static Standard_GUID TDF_TagSourceID("2a96b611-ec8b-11d0-bee7-080009dc3333");

100
src/TDF/TDF_TagSource.hxx Normal file
View File

@@ -0,0 +1,100 @@
// Created on: 1997-08-04
// Created by: VAUTHIER Jean-Claude
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_TagSource_HeaderFile
#define _TDF_TagSource_HeaderFile
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Integer.hxx>
#include <TDF_Attribute.hxx>
class Standard_GUID;
class TDF_Label;
class TDF_Attribute;
class TDF_RelocationTable;
class TDF_TagSource;
DEFINE_STANDARD_HANDLE(TDF_TagSource, TDF_Attribute)
//! This attribute manage a tag provider to create
//! child labels of a given one.
class TDF_TagSource : public TDF_Attribute
{
public:
//! class methods
//! =============
Standard_EXPORT static const Standard_GUID& GetID();
//! Find, or create, a TagSource attribute. the TagSource
//! attribute is returned.
Standard_EXPORT static Handle(TDF_TagSource) Set (const TDF_Label& label);
//! Find (or create) a tagSource attribute located at <L>
//! and make a new child label.
//! TagSource methods
//! =================
Standard_EXPORT static TDF_Label NewChild (const TDF_Label& L);
Standard_EXPORT TDF_TagSource();
Standard_EXPORT Standard_Integer NewTag();
Standard_EXPORT TDF_Label NewChild();
Standard_EXPORT Standard_Integer Get() const;
//! TDF_Attribute methods
//! =====================
Standard_EXPORT void Set (const Standard_Integer T);
Standard_EXPORT const Standard_GUID& ID() const;
Standard_EXPORT void Restore (const Handle(TDF_Attribute)& with);
Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const;
Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const;
DEFINE_STANDARD_RTTI(TDF_TagSource,TDF_Attribute)
protected:
private:
Standard_Integer myTag;
};
#endif // _TDF_TagSource_HeaderFile

View File

@@ -1,237 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- ------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Mar 13 1997 Creation
class Tool from TDF
---Purpose: This class provides general services for a data framework.
uses
Data from TDF,
Label from TDF,
LabelList from TDF,
LabelIntegerMap from TDF,
IDFilter from TDF,
AttributeList from TDF,
AttributeMap from TDF,
AttributeIndexedMap from TDF,
AsciiString from TCollection,
ListOfInteger from TColStd,
OStream from Standard
is
-- Objects counting ---------------------------------------------------
NbLabels(myclass;
aLabel : Label from TDF)
returns Integer from Standard;
---Purpose: Returns the number of labels of the tree,
-- including <aLabel>. aLabel is also included in this figure.
-- This information is useful in setting the size of an array.
NbAttributes(myclass;
aLabel : Label from TDF)
returns Integer from Standard;
---Purpose: Returns the total number of attributes attached
-- to the labels dependent on the label aLabel.
-- The attributes of aLabel are also included in this figure.
-- This information is useful in setting the size of an array.
NbAttributes(myclass;
aLabel : Label from TDF;
aFilter : IDFilter from TDF)
returns Integer from Standard;
---Purpose: Returns the number of attributes of the tree,
-- selected by a<Filter>, including those of
-- <aLabel>.
-- Self Contained Label -----------------------------------------------
IsSelfContained(myclass;
aLabel : Label from TDF)
returns Boolean from Standard;
---Purpose: Returns true if <aLabel> and its descendants
-- reference only attributes or labels attached to
-- themselves.
IsSelfContained(myclass;
aLabel : Label from TDF;
aFilter : IDFilter from TDF)
returns Boolean from Standard;
---Purpose: Returns true if <aLabel> and its descendants
-- reference only attributes or labels attached to
-- themselves and kept by <aFilter>.
OutReferers(myclass;
theLabel : Label from TDF;
theAtts : in out AttributeMap from TDF);
---Purpose: Returns in <theAtts> the attributes having out
-- references.
--
-- Caution: <theAtts> is not cleared before use!
OutReferers(myclass;
aLabel : Label from TDF;
aFilterForReferers : IDFilter from TDF;
aFilterForReferences : IDFilter from TDF;
atts : in out AttributeMap from TDF);
---Purpose: Returns in <atts> the attributes having out
-- references and kept by <aFilterForReferers>.
-- It considers only the references kept by <aFilterForReferences>.
-- Caution: <atts> is not cleared before use!
OutReferences(myclass;
aLabel : Label from TDF;
atts : in out AttributeMap from TDF);
---Purpose: Returns in <atts> the referenced attributes.
-- Caution: <atts> is not cleared before use!
OutReferences(myclass;
aLabel : Label from TDF;
aFilterForReferers : IDFilter from TDF;
aFilterForReferences : IDFilter from TDF;
atts : in out AttributeMap from TDF);
---Purpose: Returns in <atts> the referenced attributes and kept by <aFilterForReferences>.
-- It considers only the referers kept by <aFilterForReferers>.
-- Caution: <atts> is not cleared before use!
-- Label Relocation ---------------------------------------------------
RelocateLabel(myclass;
aSourceLabel, fromRoot, toRoot : Label from TDF;
aTargetLabel : in out Label from TDF;
create : Boolean from Standard = Standard_False);
---Purpose: Returns the label having the same sub-entry as
-- <aLabel> but located as descendant as <toRoot>
-- instead of <fromRoot>.
--
-- Exemple :
--
-- aLabel = 0:3:24:7:2:7
-- fromRoot = 0:3:24
-- toRoot = 0:5
-- returned label = 0:5:7:2:7
-- Label -> Entry -----------------------------------------------------
Entry(myclass;
aLabel : Label from TDF;
anEntry : in out AsciiString from TCollection);
---Purpose: Returns the entry for the label aLabel in the form
-- of the ASCII character string anEntry containing
-- the tag list for aLabel.
TagList(myclass;
aLabel : Label from TDF;
aTagList : in out ListOfInteger from TColStd);
---Purpose: Returns the entry of <aLabel> as list of integers
-- in <aTagList>.
TagList(myclass;
anEntry : AsciiString from TCollection;
aTagList : in out ListOfInteger from TColStd);
---Purpose: Returns the entry expressed by <anEntry> as list
-- of integers in <aTagList>.
-- Entry -> Label -----------------------------------------------------
Label(myclass;
aDF : Data from TDF;
anEntry : AsciiString from TCollection;
aLabel : in out Label from TDF;
create : Boolean from Standard = Standard_False);
---Purpose: Returns the label expressed by <anEntry>; creates
-- the label if it does not exist and if <create> is
-- true.
Label(myclass;
aDF : Data from TDF;
anEntry : CString from Standard;
aLabel : in out Label from TDF;
create : Boolean from Standard = Standard_False);
---Purpose: Returns the label expressed by <anEntry>; creates
-- the label if it does not exist and if <create> is
-- true.
Label(myclass;
aDF : Data from TDF;
aTagList : ListOfInteger from TColStd;
aLabel : in out Label from TDF;
create : Boolean from Standard = Standard_False);
---Purpose: Returns the label expressed by <anEntry>; creates
-- the label if it does not exist and if <create> is
-- true.
-- Label count --------------------------------------------------------
CountLabels(myclass;
aLabelList : in out LabelList from TDF;
aLabelMap : in out LabelIntegerMap from TDF);
---Purpose: Adds the labels of <aLabelList> to <aLabelMap> if
-- they are unbound, or increases their reference
-- counters. At the end of the process, <aLabelList>
-- contains only the ADDED labels.
DeductLabels(myclass;
aLabelList : in out LabelList from TDF;
aLabelMap : in out LabelIntegerMap from TDF);
---Purpose: Decreases the reference counters of the labels of
-- <aLabelList> to <aLabelMap>, and removes labels
-- with null counter. At the end of the process,
-- <aLabelList> contains only the SUPPRESSED labels.
-- Dump ---------------------------------------------------------------
DeepDump(myclass;
anOS : in out OStream from Standard;
aDF : Data from TDF);
---Purpose: Dumps <aDF> and its labels and their attributes.
ExtendedDeepDump(myclass;
anOS : in out OStream from Standard;
aDF : Data from TDF;
aFilter : IDFilter from TDF);
---Purpose: Dumps <aDF> and its labels and their attributes,
-- if their IDs are kept by <aFilter>. Dumps also the
-- attributes content.
DeepDump(myclass;
anOS : in out OStream from Standard;
aLabel : Label from TDF);
---Purpose: Dumps <aLabel>, its chilren and their attributes.
ExtendedDeepDump(myclass;
anOS : in out OStream from Standard;
aLabel : Label from TDF;
aFilter : IDFilter from TDF);
---Purpose: Dumps <aLabel>, its chilren and their attributes,
-- if their IDs are kept by <aFilter>. Dumps also the
-- attributes content.
end Tool;

View File

@@ -14,25 +14,24 @@
// commercial license or contractual agreement.
// ------------
// Version: 0.0
//Version Date Purpose
// 0.0 Mar 13 1997 Creation
#include <TDF_Tool.ixx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_AttributeIndexedMap.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TDF_AttributeIndexedMap.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_Data.hxx>
#include <TDF_DataSet.hxx>
#include <TDF_IDFilter.hxx>
#include <TDF_Label.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_MapIteratorOfAttributeMap.hxx>
#include <TDF_MapIteratorOfLabelMap.hxx>
#include <TDF_Tool.hxx>
#define TDF_TagSeparator ':'

183
src/TDF/TDF_Tool.hxx Normal file
View File

@@ -0,0 +1,183 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Tool_HeaderFile
#define _TDF_Tool_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <TDF_AttributeMap.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <Standard_CString.hxx>
#include <TDF_LabelList.hxx>
#include <TDF_LabelIntegerMap.hxx>
#include <Standard_OStream.hxx>
class TDF_Label;
class TDF_IDFilter;
class TCollection_AsciiString;
class TDF_Data;
//! This class provides general services for a data framework.
class TDF_Tool
{
public:
DEFINE_STANDARD_ALLOC
//! Returns the number of labels of the tree,
//! including <aLabel>. aLabel is also included in this figure.
//! This information is useful in setting the size of an array.
Standard_EXPORT static Standard_Integer NbLabels (const TDF_Label& aLabel);
//! Returns the total number of attributes attached
//! to the labels dependent on the label aLabel.
//! The attributes of aLabel are also included in this figure.
//! This information is useful in setting the size of an array.
Standard_EXPORT static Standard_Integer NbAttributes (const TDF_Label& aLabel);
//! Returns the number of attributes of the tree,
//! selected by a<Filter>, including those of
//! <aLabel>.
Standard_EXPORT static Standard_Integer NbAttributes (const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
//! Returns true if <aLabel> and its descendants
//! reference only attributes or labels attached to
//! themselves.
Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel);
//! Returns true if <aLabel> and its descendants
//! reference only attributes or labels attached to
//! themselves and kept by <aFilter>.
Standard_EXPORT static Standard_Boolean IsSelfContained (const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
//! Returns in <theAtts> the attributes having out
//! references.
//!
//! Caution: <theAtts> is not cleared before use!
Standard_EXPORT static void OutReferers (const TDF_Label& theLabel, TDF_AttributeMap& theAtts);
//! Returns in <atts> the attributes having out
//! references and kept by <aFilterForReferers>.
//! It considers only the references kept by <aFilterForReferences>.
//! Caution: <atts> is not cleared before use!
Standard_EXPORT static void OutReferers (const TDF_Label& aLabel, const TDF_IDFilter& aFilterForReferers, const TDF_IDFilter& aFilterForReferences, TDF_AttributeMap& atts);
//! Returns in <atts> the referenced attributes.
//! Caution: <atts> is not cleared before use!
Standard_EXPORT static void OutReferences (const TDF_Label& aLabel, TDF_AttributeMap& atts);
//! Returns in <atts> the referenced attributes and kept by <aFilterForReferences>.
//! It considers only the referers kept by <aFilterForReferers>.
//! Caution: <atts> is not cleared before use!
Standard_EXPORT static void OutReferences (const TDF_Label& aLabel, const TDF_IDFilter& aFilterForReferers, const TDF_IDFilter& aFilterForReferences, TDF_AttributeMap& atts);
//! Returns the label having the same sub-entry as
//! <aLabel> but located as descendant as <toRoot>
//! instead of <fromRoot>.
//!
//! Exemple :
//!
//! aLabel = 0:3:24:7:2:7
//! fromRoot = 0:3:24
//! toRoot = 0:5
//! returned label = 0:5:7:2:7
Standard_EXPORT static void RelocateLabel (const TDF_Label& aSourceLabel, const TDF_Label& fromRoot, const TDF_Label& toRoot, TDF_Label& aTargetLabel, const Standard_Boolean create = Standard_False);
//! Returns the entry for the label aLabel in the form
//! of the ASCII character string anEntry containing
//! the tag list for aLabel.
Standard_EXPORT static void Entry (const TDF_Label& aLabel, TCollection_AsciiString& anEntry);
//! Returns the entry of <aLabel> as list of integers
//! in <aTagList>.
Standard_EXPORT static void TagList (const TDF_Label& aLabel, TColStd_ListOfInteger& aTagList);
//! Returns the entry expressed by <anEntry> as list
//! of integers in <aTagList>.
Standard_EXPORT static void TagList (const TCollection_AsciiString& anEntry, TColStd_ListOfInteger& aTagList);
//! Returns the label expressed by <anEntry>; creates
//! the label if it does not exist and if <create> is
//! true.
Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const TCollection_AsciiString& anEntry, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
//! Returns the label expressed by <anEntry>; creates
//! the label if it does not exist and if <create> is
//! true.
Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const Standard_CString anEntry, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
//! Returns the label expressed by <anEntry>; creates
//! the label if it does not exist and if <create> is
//! true.
Standard_EXPORT static void Label (const Handle(TDF_Data)& aDF, const TColStd_ListOfInteger& aTagList, TDF_Label& aLabel, const Standard_Boolean create = Standard_False);
//! Adds the labels of <aLabelList> to <aLabelMap> if
//! they are unbound, or increases their reference
//! counters. At the end of the process, <aLabelList>
//! contains only the ADDED labels.
Standard_EXPORT static void CountLabels (TDF_LabelList& aLabelList, TDF_LabelIntegerMap& aLabelMap);
//! Decreases the reference counters of the labels of
//! <aLabelList> to <aLabelMap>, and removes labels
//! with null counter. At the end of the process,
//! <aLabelList> contains only the SUPPRESSED labels.
Standard_EXPORT static void DeductLabels (TDF_LabelList& aLabelList, TDF_LabelIntegerMap& aLabelMap);
//! Dumps <aDF> and its labels and their attributes.
Standard_EXPORT static void DeepDump (Standard_OStream& anOS, const Handle(TDF_Data)& aDF);
//! Dumps <aDF> and its labels and their attributes,
//! if their IDs are kept by <aFilter>. Dumps also the
//! attributes content.
Standard_EXPORT static void ExtendedDeepDump (Standard_OStream& anOS, const Handle(TDF_Data)& aDF, const TDF_IDFilter& aFilter);
//! Dumps <aLabel>, its chilren and their attributes.
Standard_EXPORT static void DeepDump (Standard_OStream& anOS, const TDF_Label& aLabel);
//! Dumps <aLabel>, its chilren and their attributes,
//! if their IDs are kept by <aFilter>. Dumps also the
//! attributes content.
Standard_EXPORT static void ExtendedDeepDump (Standard_OStream& anOS, const TDF_Label& aLabel, const TDF_IDFilter& aFilter);
protected:
private:
};
#endif // _TDF_Tool_HeaderFile

View File

@@ -1,120 +0,0 @@
-- Created by: DAUTRY Philippe
-- Copyright (c) 1997-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
-- -------------------
---Version: 0.0
--Version Date Purpose
-- 0.0 Oct 1 1997 Creation
class Transaction from TDF
---Purpose: This class offers services to open, commit or
-- abort a transaction in a more secure way than
-- using Data from TDF. If you forget to close a
-- transaction, it will be automaticaly aborted at
-- the destruction of this object, at the closure of
-- its scope.
--
-- In case of catching errors, the effect will be the
-- same: aborting transactions until the good current
-- one.
uses
Data from TDF,
Delta from TDF,
AsciiString from TCollection
raises
DomainError, NullObject from Standard
is
Create(aName : AsciiString from TCollection = "")
returns Transaction from TDF;
---Purpose: Creates an empty transaction context, unable to be
-- opened.
Create(aTrans : Transaction from TDF)
returns Transaction from TDF
is private;
---Purpose: Private to avoid copy.
Create(aDF : Data from TDF;
aName : AsciiString from TCollection = "")
returns Transaction from TDF;
---Purpose: Creates a transaction context on <aDF>, ready to
-- be opened.
Initialize(me : in out; aDF : Data from TDF);
---Purpose: Aborts all the transactions on <myDF> and sets
-- <aDF> to build a transaction context on <aDF>,
-- ready to be opened.
Open(me : in out)
returns Integer from Standard
raises DomainError, NullObject from Standard;
---Purpose: If not yet done, opens a new transaction on
-- <myDF>. Returns the index of the just opened
-- transaction.
--
-- It raises DomainError if the transaction is
-- already open, and NullObject if there is no
-- current Data framework.
Commit(me : in out;
withDelta : Boolean from Standard = Standard_False)
returns Delta from TDF;
---Purpose: Commits the transactions until AND including the
-- current opened one.
Abort(me : in out);
---Purpose: Aborts the transactions until AND including the
-- current opened one.
--
---C++: alias ~
Data(me) returns Data from TDF;
---Purpose: Returns the Data from TDF.
--
---C++: inline
Transaction(me) returns Integer from Standard;
---Purpose: Returns the number of the transaction opened by <me>.
--
---C++: inline
Name(me) returns AsciiString from TCollection;
---Purpose: Returns the transaction name.
--
---C++: return const &
IsOpen(me)
returns Boolean from Standard;
---Purpose: Returns true if the transaction is open.
--
---C++: inline
fields
myDF : Data from TDF;
myUntilTransaction : Integer from Standard;
myName : AsciiString from TCollection;
end Transaction;

View File

@@ -14,14 +14,16 @@
// commercial license or contractual agreement.
// -------------------
// Version: 0.0
//Version Date Purpose
// 0.0 Oct 1 1997 Creation
#include <TDF_Transaction.ixx>
#include <Standard_DomainError.hxx>
#include <Standard_NullObject.hxx>
#include <TCollection_AsciiString.hxx>
#include <TDF_Data.hxx>
#include <TDF_Delta.hxx>
#include <TDF_Transaction.hxx>
#undef DEB_TRANSACTION
#ifdef OCCT_DEBUG

126
src/TDF/TDF_Transaction.hxx Normal file
View File

@@ -0,0 +1,126 @@
// Created by: DAUTRY Philippe
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _TDF_Transaction_HeaderFile
#define _TDF_Transaction_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Integer.hxx>
#include <TCollection_AsciiString.hxx>
#include <Standard_Boolean.hxx>
class TDF_Data;
class Standard_DomainError;
class Standard_NullObject;
class TDF_Delta;
class TCollection_AsciiString;
//! This class offers services to open, commit or
//! abort a transaction in a more secure way than
//! using Data from TDF. If you forget to close a
//! transaction, it will be automaticaly aborted at
//! the destruction of this object, at the closure of
//! its scope.
//!
//! In case of catching errors, the effect will be the
//! same: aborting transactions until the good current
//! one.
class TDF_Transaction
{
public:
DEFINE_STANDARD_ALLOC
//! Creates an empty transaction context, unable to be
//! opened.
Standard_EXPORT TDF_Transaction(const TCollection_AsciiString& aName = "");
//! Creates a transaction context on <aDF>, ready to
//! be opened.
Standard_EXPORT TDF_Transaction(const Handle(TDF_Data)& aDF, const TCollection_AsciiString& aName = "");
//! Aborts all the transactions on <myDF> and sets
//! <aDF> to build a transaction context on <aDF>,
//! ready to be opened.
Standard_EXPORT void Initialize (const Handle(TDF_Data)& aDF);
//! If not yet done, opens a new transaction on
//! <myDF>. Returns the index of the just opened
//! transaction.
//!
//! It raises DomainError if the transaction is
//! already open, and NullObject if there is no
//! current Data framework.
Standard_EXPORT Standard_Integer Open();
//! Commits the transactions until AND including the
//! current opened one.
Standard_EXPORT Handle(TDF_Delta) Commit (const Standard_Boolean withDelta = Standard_False);
//! Aborts the transactions until AND including the
//! current opened one.
Standard_EXPORT void Abort();
~TDF_Transaction()
{
Abort();
}
//! Returns the Data from TDF.
Handle(TDF_Data) Data() const;
//! Returns the number of the transaction opened by <me>.
Standard_Integer Transaction() const;
//! Returns the transaction name.
Standard_EXPORT const TCollection_AsciiString& Name() const;
//! Returns true if the transaction is open.
Standard_Boolean IsOpen() const;
protected:
private:
//! Private to avoid copy.
Standard_EXPORT TDF_Transaction(const TDF_Transaction& aTrans);
Handle(TDF_Data) myDF;
Standard_Integer myUntilTransaction;
TCollection_AsciiString myName;
};
#include <TDF_Transaction.lxx>
#endif // _TDF_Transaction_HeaderFile