mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
202
src/TDataStd/TDataStd.cdl
Executable file
202
src/TDataStd/TDataStd.cdl
Executable file
@@ -0,0 +1,202 @@
|
||||
-- File: TDataStd.cdl
|
||||
-- Created: Wed May 10 10:48:16 1995
|
||||
-- Author: Denis PASCAL
|
||||
---Copyright: Matra Datavision 1995
|
||||
|
||||
|
||||
|
||||
package TDataStd
|
||||
|
||||
---Purpose: This package defines standard attributes for
|
||||
-- modelling.
|
||||
-- These allow you to create and modify labels
|
||||
-- and attributes for many basic data types.
|
||||
-- Standard topological and visualization
|
||||
-- attributes have also been created.
|
||||
-- To find an attribute attached to a specific label,
|
||||
-- you use the GUID of the type of attribute you
|
||||
-- are looking for. To do this, first find this
|
||||
-- information using the method GetID as follows: Standard_GUID anID =
|
||||
-- MyAttributeClass::GetID();
|
||||
-- Then, use the method Find for the label as follows:
|
||||
-- Standard_Boolean HasAttribute
|
||||
-- =
|
||||
-- aLabel.Find(anID,anAttribute);
|
||||
-- Note
|
||||
-- For information on the relations between this
|
||||
-- component of OCAF and the others, refer to the OCAF User's Guide.
|
||||
|
||||
--- Category: GUID - AttributeID
|
||||
-- 2a96b606-ec8b-11d0-bee7-080009dc3333 TDataStd_Integer
|
||||
|
||||
-- 2a96b608-ec8b-11d0-bee7-080009dc3333 TDataStd_Name
|
||||
-- 2a96b60f-ec8b-11d0-bee7-080009dc3333 TDataStd_Real
|
||||
-- 2a96b610-ec8b-11d0-bee7-080009dc3333 TDataStd_Reference
|
||||
-- 2a96b616-ec8b-11d0-bee7-080009dc3333 TDataStd_Comment
|
||||
-- 2a96b61c-ec8b-11d0-bee7-080009dc3333 TDataStd_UAttribute
|
||||
-- 2a96b61d-ec8b-11d0-bee7-080009dc3333 TDataStd_IntegerArray
|
||||
-- 2a96b61e-ec8b-11d0-bee7-080009dc3333 TDataStd_RealArray
|
||||
-- 2a96b624-ec8b-11d0-bee7-080009dc3333 TDataStd_ExtStringArray
|
||||
-- 2a96b609-ec8b-11d0-bee7-080009dc3333 TDataStd_NoteBook
|
||||
-- 2a96b61f-ec8b-11d0-bee7-080009dc3333 TDataStd_Directory
|
||||
|
||||
|
||||
|
||||
|
||||
uses Standard,
|
||||
MMgt,
|
||||
TCollection,
|
||||
TColStd,
|
||||
TDF
|
||||
|
||||
|
||||
is
|
||||
enumeration RealEnum is
|
||||
---Purpose:
|
||||
-- The terms of this enumeration define the
|
||||
-- semantics of a real number value.
|
||||
SCALAR,
|
||||
LENGTH,
|
||||
ANGULAR
|
||||
end RealEnum;
|
||||
|
||||
---Category: Basic attributes
|
||||
-- ===================
|
||||
|
||||
|
||||
class Current;
|
||||
|
||||
class Name;
|
||||
|
||||
class Comment;
|
||||
|
||||
class Integer;
|
||||
|
||||
class IntegerArray;
|
||||
|
||||
class Real;
|
||||
|
||||
class RealArray;
|
||||
|
||||
class ExtStringArray;
|
||||
|
||||
class UAttribute;
|
||||
|
||||
|
||||
---Purpose: Attributes for organization
|
||||
-- ============================
|
||||
|
||||
class TreeNode;
|
||||
pointer PtrTreeNode to TreeNode from TDataStd;
|
||||
class ChildNodeIterator;
|
||||
|
||||
class Directory;
|
||||
|
||||
|
||||
---Category: Other attributes
|
||||
-- ================
|
||||
|
||||
class NoteBook;
|
||||
|
||||
class Expression;
|
||||
|
||||
class Relation;
|
||||
|
||||
class Variable;
|
||||
|
||||
class DeltaOnModificationOfIntArray;
|
||||
|
||||
class DeltaOnModificationOfRealArray;
|
||||
|
||||
class DeltaOnModificationOfExtStringArray;
|
||||
|
||||
class DeltaOnModificationOfIntPackedMap;
|
||||
|
||||
class DeltaOnModificationOfByteArray;
|
||||
|
||||
|
||||
-- Extension
|
||||
class Tick;
|
||||
|
||||
class AsciiString;
|
||||
|
||||
class IntPackedMap;
|
||||
|
||||
|
||||
-- Lists:
|
||||
class IntegerList;
|
||||
|
||||
class RealList;
|
||||
|
||||
class ExtStringList;
|
||||
|
||||
class BooleanList;
|
||||
|
||||
class ReferenceList;
|
||||
|
||||
|
||||
-- Arrays:
|
||||
class BooleanArray;
|
||||
|
||||
class ReferenceArray;
|
||||
|
||||
class ByteArray;
|
||||
|
||||
class NamedData;
|
||||
|
||||
class ListOfExtendedString instantiates List from TCollection ( ExtendedString from TCollection );
|
||||
|
||||
|
||||
-- Extension
|
||||
class ListOfByte instantiates List from TCollection(Byte from Standard);
|
||||
|
||||
class LabelArray1 instantiates Array1 from TCollection(Label from TDF);
|
||||
|
||||
class HLabelArray1 instantiates HArray1 from TCollection(Label from TDF, LabelArray1 from TDataStd);
|
||||
|
||||
class DataMapOfStringReal instantiates DataMap from TCollection(ExtendedString from TCollection,
|
||||
Real from Standard,
|
||||
ExtendedString from TCollection);
|
||||
class DataMapOfStringString instantiates DataMap from TCollection(ExtendedString from TCollection,
|
||||
ExtendedString from TCollection,
|
||||
ExtendedString from TCollection);
|
||||
class DataMapOfStringByte instantiates DataMap from TCollection(ExtendedString from TCollection,
|
||||
Byte from Standard,
|
||||
ExtendedString from TCollection);
|
||||
class DataMapOfStringHArray1OfInteger instantiates DataMap from TCollection(ExtendedString from TCollection,
|
||||
HArray1OfInteger from TColStd,
|
||||
ExtendedString from TCollection);
|
||||
class DataMapOfStringHArray1OfReal instantiates DataMap from TCollection(ExtendedString from TCollection,
|
||||
HArray1OfReal from TColStd,
|
||||
ExtendedString from TCollection);
|
||||
|
||||
class HDataMapOfStringInteger;
|
||||
|
||||
class HDataMapOfStringReal;
|
||||
|
||||
class HDataMapOfStringString;
|
||||
|
||||
class HDataMapOfStringByte;
|
||||
|
||||
class HDataMapOfStringHArray1OfInteger;
|
||||
|
||||
class HDataMapOfStringHArray1OfReal;
|
||||
|
||||
|
||||
IDList (anIDList : in out IDList from TDF);
|
||||
---Purpose: Appends to <anIDList> the list of the attributes
|
||||
-- IDs of this package. CAUTION: <anIDList> is NOT
|
||||
-- cleared before use.
|
||||
|
||||
|
||||
|
||||
Print (DIM : RealEnum from TDataStd; S : in out OStream)
|
||||
---Purpose: Prints the name of the real dimension <DIM> as a String on
|
||||
-- the Stream <S> and returns <S>.
|
||||
---C++: return &
|
||||
returns OStream;
|
||||
|
||||
end TDataStd;
|
||||
|
||||
|
||||
|
77
src/TDataStd/TDataStd.cxx
Executable file
77
src/TDataStd/TDataStd.cxx
Executable file
@@ -0,0 +1,77 @@
|
||||
// File: TDataStd.cxx
|
||||
// Created: Wed Jul 30 15:57:49 1997
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd.ixx>
|
||||
|
||||
#include <TDF_AttributeIterator.hxx>
|
||||
#include <TDF_AttributeList.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <TDF_Reference.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
#include <TDF_ListIteratorOfLabelList.hxx>
|
||||
#include <TDF_MapIteratorOfLabelMap.hxx>
|
||||
#include <TDF_DataSet.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <TDataStd_UAttribute.hxx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
|
||||
#include <Standard_GUID.hxx>
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IDList
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd::IDList(TDF_IDList& anIDList)
|
||||
{
|
||||
anIDList.Append(TDF_TagSource::GetID());
|
||||
anIDList.Append(TDF_Reference::GetID());
|
||||
anIDList.Append(TDataStd_Integer::GetID());
|
||||
anIDList.Append(TDataStd_Name::GetID());
|
||||
anIDList.Append(TDataStd_Real::GetID());
|
||||
anIDList.Append(TDataStd_IntegerArray::GetID());
|
||||
anIDList.Append(TDataStd_RealArray::GetID());
|
||||
anIDList.Append(TDataStd_ExtStringArray::GetID());
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose : print the name of the real dimension
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd::Print(const TDataStd_RealEnum C, Standard_OStream& s)
|
||||
{
|
||||
switch (C) {
|
||||
case TDataStd_SCALAR :
|
||||
{
|
||||
s << "SCALAR"; break;
|
||||
}
|
||||
case TDataStd_LENGTH :
|
||||
{
|
||||
s << "LENGTH"; break;
|
||||
}
|
||||
case TDataStd_ANGULAR :
|
||||
{
|
||||
s << "ANGULAR"; break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
s << "UNKNOWN"; break;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
79
src/TDataStd/TDataStd_AsciiString.cdl
Executable file
79
src/TDataStd/TDataStd_AsciiString.cdl
Executable file
@@ -0,0 +1,79 @@
|
||||
-- File: TDataStd_AsciiString.cdl
|
||||
-- Created: Tue Jul 31 12:16:55 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CASCADE SA 2007
|
||||
|
||||
|
||||
class AsciiString from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Used to define an AsciiString attribute containing a TCollection_AsciiString
|
||||
|
||||
uses
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
AsciiString from TCollection,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID of the attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF; string : AsciiString from TCollection)
|
||||
---Purpose: Finds, or creates an AsciiString attribute and sets the string.
|
||||
-- the AsciiString attribute is returned.
|
||||
returns AsciiString from TDataStd;
|
||||
|
||||
---Purpose: AsciiString methods
|
||||
-- ===================
|
||||
|
||||
Create
|
||||
returns mutable AsciiString from TDataStd;
|
||||
-- Constructor
|
||||
|
||||
Set (me : mutable; S : AsciiString from TCollection);
|
||||
-- Sets the ascii string <S>
|
||||
|
||||
Get (me)
|
||||
returns AsciiString from TCollection;
|
||||
-- Returns the AsciiString <myString>
|
||||
---C++: return const &
|
||||
|
||||
IsEmpty(me)
|
||||
returns Boolean from Standard;
|
||||
-- Returns True if the string of <me> contains zero characters.
|
||||
|
||||
---Category: TDF_Attribute methods
|
||||
-- =====================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
-- Restores the backuped content from <with> into this one.
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
-- Returns an new empty AsciiString attribute.
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
-- This method is used when copying an attribute from a source structure
|
||||
-- into a target structure.
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
-- This method dumps the attribute value into the stream
|
||||
fields
|
||||
myString : AsciiString from TCollection;
|
||||
|
||||
end AsciiString;
|
133
src/TDataStd/TDataStd_AsciiString.cxx
Executable file
133
src/TDataStd/TDataStd_AsciiString.cxx
Executable file
@@ -0,0 +1,133 @@
|
||||
// File: TDataStd_AsciiString.cxx
|
||||
// Created: Tue Jul 31 12:39:17 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TDataStd_AsciiString.ixx>
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_AsciiString
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_AsciiString::TDataStd_AsciiString()
|
||||
{
|
||||
myString.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_AsciiString::GetID()
|
||||
{
|
||||
static Standard_GUID theGUID ("3bbefc60-e618-11d4-ba38-0060b0ee18ea");
|
||||
return theGUID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_AsciiString::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_AsciiString) TDataStd_AsciiString::Set (
|
||||
const TDF_Label& theLabel,
|
||||
const TCollection_AsciiString& theAsciiString)
|
||||
{
|
||||
Handle(TDataStd_AsciiString) A;
|
||||
if (!theLabel.FindAttribute(TDataStd_AsciiString::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_AsciiString;
|
||||
theLabel.AddAttribute(A);
|
||||
}
|
||||
A->Set(theAsciiString);
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_AsciiString::Set (const TCollection_AsciiString& theAsciiString)
|
||||
{
|
||||
Backup();
|
||||
myString = theAsciiString;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TCollection_AsciiString& TDataStd_AsciiString::Get () const
|
||||
{
|
||||
return myString;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_AsciiString::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_AsciiString();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_AsciiString::Restore (const Handle(TDF_Attribute)& theWith)
|
||||
{
|
||||
Handle(TDataStd_AsciiString) R = Handle(TDataStd_AsciiString)::DownCast(theWith);
|
||||
myString = R->Get();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_AsciiString::Paste (const Handle(TDF_Attribute)& theInto,
|
||||
const Handle(TDF_RelocationTable)& /* RT */) const
|
||||
{
|
||||
Handle(TDataStd_AsciiString) R = Handle(TDataStd_AsciiString)::DownCast (theInto);
|
||||
R->Set(myString);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_AsciiString::IsEmpty () const
|
||||
{
|
||||
return myString.IsEmpty();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_AsciiString::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
Standard_OStream& anOS = TDF_Attribute::Dump( theOS );
|
||||
anOS << myString;
|
||||
return anOS;
|
||||
}
|
110
src/TDataStd/TDataStd_BooleanArray.cdl
Executable file
110
src/TDataStd/TDataStd_BooleanArray.cdl
Executable file
@@ -0,0 +1,110 @@
|
||||
-- File: TDataStd_BooleanArray.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class BooleanArray from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: An array of boolean values.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
HArray1OfByte from TColStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns an ID for array.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass;
|
||||
label : Label from TDF;
|
||||
lower, upper : Integer from Standard)
|
||||
---Purpose: Finds or creates an attribute with the array.
|
||||
returns BooleanArray from TDataStd;
|
||||
|
||||
|
||||
---Category: BooleanArray methods
|
||||
-- ====================
|
||||
|
||||
Init (me : mutable;
|
||||
lower, upper : Integer from Standard);
|
||||
---Purpose: Initialize the inner array with bounds from <lower> to <upper>
|
||||
|
||||
SetValue (me : mutable;
|
||||
index :Integer from Standard;
|
||||
value : Boolean from Standard);
|
||||
---Purpose: Sets the <Index>th element of the array to <Value>
|
||||
|
||||
Value (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Return the value of the <Index>th element of the array.
|
||||
---C++: alias operator ()
|
||||
returns Boolean from Standard;
|
||||
|
||||
Lower (me)
|
||||
---Purpose: Returns the lower boundary of the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
Upper (me)
|
||||
---Purpose: Returns the upper boundary of the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
Length (me)
|
||||
---Purpose: Returns the number of elements in the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
---Category: Advanced area
|
||||
-- =============
|
||||
|
||||
InternalArray (me)
|
||||
---C++: return const &
|
||||
returns HArray1OfByte from TColStd;
|
||||
|
||||
SetInternalArray (me : mutable;
|
||||
values : HArray1OfByte from TColStd);
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
Create
|
||||
returns mutable BooleanArray from TDataStd;
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable;
|
||||
with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump (me;
|
||||
OS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myValues : HArray1OfByte from TColStd;
|
||||
myLower : Integer from Standard;
|
||||
myUpper : Integer from Standard;
|
||||
|
||||
|
||||
end BooleanArray;
|
260
src/TDataStd/TDataStd_BooleanArray.cxx
Executable file
260
src/TDataStd/TDataStd_BooleanArray.cxx
Executable file
@@ -0,0 +1,260 @@
|
||||
// File: TDataStd_BooleanArray.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_BooleanArray.ixx>
|
||||
|
||||
static Standard_Integer DegreeOf2(const Standard_Integer degree)
|
||||
{
|
||||
switch (degree)
|
||||
{
|
||||
case 0:
|
||||
return 1;
|
||||
case 1:
|
||||
return 2;
|
||||
case 2:
|
||||
return 4;
|
||||
case 3:
|
||||
return 8;
|
||||
case 4:
|
||||
return 16;
|
||||
case 5:
|
||||
return 32;
|
||||
case 6:
|
||||
return 64;
|
||||
case 7:
|
||||
return 128;
|
||||
case 8:
|
||||
return 256;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_BooleanArray::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_BooleanArrayID ("C7E98E54-B5EA-4aa9-AC99-9164EBD07F10");
|
||||
return TDataStd_BooleanArrayID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_BooleanArray
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_BooleanArray::TDataStd_BooleanArray()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanArray::Init(const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Backup();
|
||||
|
||||
myLower = lower;
|
||||
myUpper = upper;
|
||||
if (myUpper >= myLower)
|
||||
myValues = new TColStd_HArray1OfByte(0, Length() >> 3, 0/*initialize to FALSE*/);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_BooleanArray) TDataStd_BooleanArray::Set(const TDF_Label& label,
|
||||
const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Handle(TDataStd_BooleanArray) A;
|
||||
if (!label.FindAttribute (TDataStd_BooleanArray::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_BooleanArray;
|
||||
A->Init (lower, upper);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
else if (lower != A->Lower() || upper != A->Upper())
|
||||
{
|
||||
A->Init(lower, upper);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanArray::SetValue (const Standard_Integer index,
|
||||
const Standard_Boolean value)
|
||||
{
|
||||
#ifdef DEB
|
||||
if (myValues.IsNull())
|
||||
return;
|
||||
if (index < myLower || index > myUpper)
|
||||
return;
|
||||
#endif
|
||||
|
||||
Standard_Integer byte_index = (index - myLower) >> 3;
|
||||
Standard_Integer degree = index - (byte_index << 3) - myLower;
|
||||
Standard_Integer byte_value = DegreeOf2(degree);
|
||||
|
||||
if (value == ((myValues->Value(byte_index) & byte_value) > 0))
|
||||
return;
|
||||
|
||||
Backup();
|
||||
|
||||
if (value)
|
||||
{
|
||||
myValues->ChangeValue(byte_index) |= byte_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
myValues->ChangeValue(byte_index) ^= byte_value;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_BooleanArray::Value (const Standard_Integer index) const
|
||||
{
|
||||
if (myValues.IsNull())
|
||||
return Standard_False;
|
||||
if (index < myLower || index > myUpper)
|
||||
return Standard_False;
|
||||
|
||||
Standard_Integer byte_index = (index - myLower) >> 3;
|
||||
Standard_Integer degree = index - (byte_index << 3) - myLower;
|
||||
Standard_Integer byte_value = DegreeOf2(degree);
|
||||
|
||||
return (myValues->Value(byte_index) & byte_value) > 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Lower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_BooleanArray::Lower (void) const
|
||||
{
|
||||
return myLower;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Upper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_BooleanArray::Upper (void) const
|
||||
{
|
||||
return myUpper;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_BooleanArray::Length (void) const
|
||||
{
|
||||
return myUpper - myLower + 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InternalArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(TColStd_HArray1OfByte)& TDataStd_BooleanArray::InternalArray () const
|
||||
{
|
||||
return myValues;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetInternalArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanArray::SetInternalArray (const Handle(TColStd_HArray1OfByte)& values)
|
||||
{
|
||||
myValues = values;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_BooleanArray::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_BooleanArray::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_BooleanArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanArray::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_BooleanArray) anArray = Handle(TDataStd_BooleanArray)::DownCast(With);
|
||||
if (!anArray->myValues.IsNull())
|
||||
{
|
||||
myLower = anArray->Lower();
|
||||
myUpper = anArray->Upper();
|
||||
Standard_Integer byte_upper = Length() >> 3;
|
||||
myValues = new TColStd_HArray1OfByte(0, byte_upper, 0/*initialize to FALSE*/);
|
||||
const TColStd_Array1OfByte& with_array = anArray->myValues->Array1();
|
||||
for (Standard_Integer i = 0; i <= byte_upper; i++)
|
||||
{
|
||||
myValues->SetValue(i, with_array.Value(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myValues.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanArray::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
if (!myValues.IsNull())
|
||||
{
|
||||
Handle(TDataStd_BooleanArray) anArray = Handle(TDataStd_BooleanArray)::DownCast(Into);
|
||||
if (!anArray.IsNull())
|
||||
{
|
||||
anArray->Init(myLower, myUpper);
|
||||
for (Standard_Integer i = myLower; i <= myUpper; i++)
|
||||
{
|
||||
anArray->SetValue(i, Value(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_BooleanArray::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "BooleanArray";
|
||||
return anOS;
|
||||
}
|
93
src/TDataStd/TDataStd_BooleanList.cdl
Executable file
93
src/TDataStd/TDataStd_BooleanList.cdl
Executable file
@@ -0,0 +1,93 @@
|
||||
-- File: TDataStd_BooleanList.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class BooleanList from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains a list of bolleans.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
ListOfByte from TDataStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the list of booleans attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Finds or creates a list of boolean values attribute.
|
||||
returns BooleanList from TDataStd;
|
||||
|
||||
|
||||
---Category: BooleanList methods
|
||||
-- ===================
|
||||
|
||||
Create
|
||||
returns mutable BooleanList from TDataStd;
|
||||
|
||||
IsEmpty (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Extent (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
Prepend (me : mutable;
|
||||
value : Boolean from Standard);
|
||||
|
||||
Append (me : mutable;
|
||||
value : Boolean from Standard);
|
||||
|
||||
Clear (me : mutable);
|
||||
|
||||
First (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Last (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
List (me)
|
||||
---C++: return const &
|
||||
---Purpose: 1 - means TRUE,
|
||||
-- 0 - means FALSE.
|
||||
returns ListOfByte from TDataStd;
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myList : ListOfByte from TDataStd;
|
||||
|
||||
|
||||
end BooleanList;
|
176
src/TDataStd/TDataStd_BooleanList.cxx
Executable file
176
src/TDataStd/TDataStd_BooleanList.cxx
Executable file
@@ -0,0 +1,176 @@
|
||||
// File: TDataStd_BooleanList.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_BooleanList.ixx>
|
||||
#include <TDataStd_ListIteratorOfListOfByte.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_BooleanList::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_BooleanListID ("23A9D60E-A033-44d8-96EE-015587A41BBC");
|
||||
return TDataStd_BooleanListID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_BooleanList
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_BooleanList::TDataStd_BooleanList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_BooleanList) TDataStd_BooleanList::Set(const TDF_Label& label)
|
||||
{
|
||||
Handle(TDataStd_BooleanList) A;
|
||||
if (!label.FindAttribute (TDataStd_BooleanList::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_BooleanList;
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_BooleanList::IsEmpty() const
|
||||
{
|
||||
return myList.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_BooleanList::Extent() const
|
||||
{
|
||||
return myList.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanList::Prepend(const Standard_Boolean value)
|
||||
{
|
||||
Backup();
|
||||
myList.Prepend( value ? 1 : 0 );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanList::Append(const Standard_Boolean value)
|
||||
{
|
||||
Backup();
|
||||
myList.Append( value ? 1 : 0 );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanList::Clear()
|
||||
{
|
||||
Backup();
|
||||
myList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_BooleanList::First() const
|
||||
{
|
||||
return myList.First() == 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_BooleanList::Last() const
|
||||
{
|
||||
return myList.Last() == 1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : List
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TDataStd_ListOfByte& TDataStd_BooleanList::List() const
|
||||
{
|
||||
return myList;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_BooleanList::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_BooleanList::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_BooleanList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanList::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myList.Clear();
|
||||
Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(With);
|
||||
TDataStd_ListIteratorOfListOfByte itr(aList->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
myList.Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_BooleanList::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(TDataStd_BooleanList) aList = Handle(TDataStd_BooleanList)::DownCast(Into);
|
||||
aList->Clear();
|
||||
TDataStd_ListIteratorOfListOfByte itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
aList->Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_BooleanList::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "BooleanList";
|
||||
return anOS;
|
||||
}
|
142
src/TDataStd/TDataStd_ByteArray.cdl
Executable file
142
src/TDataStd/TDataStd_ByteArray.cdl
Executable file
@@ -0,0 +1,142 @@
|
||||
-- File: TDataStd_ByteArray.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE 2007
|
||||
|
||||
class ByteArray from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: An array of Byte (unsigned char) values.
|
||||
|
||||
uses
|
||||
GUID from Standard,
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
DeltaOnModification from TDF,
|
||||
HArray1OfByte from TColStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns an ID for array.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass;
|
||||
label : Label from TDF;
|
||||
lower, upper : Integer from Standard;
|
||||
isDelta : Boolean from Standard = Standard_False)
|
||||
---Purpose: Finds or creates an attribute with the array.
|
||||
-- If <isDelta> == False, DefaultDeltaOnModification is used.
|
||||
-- If attribute is already set, all input parameters are refused
|
||||
-- and the found attribute is returned.
|
||||
returns ByteArray from TDataStd;
|
||||
|
||||
|
||||
---Category: ByteArray methods
|
||||
-- =================
|
||||
|
||||
Init (me : mutable;
|
||||
lower, upper : Integer from Standard);
|
||||
---Purpose: Initialize the inner array with bounds from <lower> to <upper>
|
||||
|
||||
SetValue (me : mutable;
|
||||
index :Integer from Standard;
|
||||
value : Byte from Standard);
|
||||
---Purpose: Sets the <Index>th element of the array to <Value>
|
||||
|
||||
Value (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Return the value of the <Index>th element of the array.
|
||||
---C++: alias operator ()
|
||||
returns Byte from Standard;
|
||||
|
||||
Lower (me)
|
||||
---Purpose: Returns the lower boundary of the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
Upper (me)
|
||||
---Purpose: Returns the upper boundary of the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
Length (me)
|
||||
---Purpose: Returns the number of elements in the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
---Category: Advanced area
|
||||
-- =============
|
||||
|
||||
InternalArray (me)
|
||||
---C++: return const
|
||||
---C++: inline
|
||||
returns HArray1OfByte from TColStd;
|
||||
|
||||
ChangeArray (me : mutable;
|
||||
newArray : HArray1OfByte from TColStd;
|
||||
isCheckItems : Boolean = Standard_True);
|
||||
---Purpose: Sets the inner array <myValue> of the attribute to
|
||||
-- <newArray>. If value of <newArray> differs from <myValue>, Backup performed
|
||||
-- and myValue refers to new instance of HArray1OfInteger that holds <newArray>
|
||||
-- values.
|
||||
-- If <isCheckItems> equal True each item of <newArray> will be checked with each
|
||||
-- item of <myValue> for coincidence (to avoid backup).
|
||||
|
||||
GetDelta(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetDelta(me : mutable; isDelta : Boolean from Standard);
|
||||
---C++: inline
|
||||
---Purpose: for internal use only!
|
||||
|
||||
RemoveArray(me : mutable) is private;
|
||||
---C++: inline
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
Create
|
||||
returns mutable ByteArray from TDataStd;
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable;
|
||||
with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump (me;
|
||||
OS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
---Category: methods to be added for using in DeltaOn Modification
|
||||
-- =====================================================
|
||||
DeltaOnModification(me; anOldAttribute : Attribute from TDF)
|
||||
returns DeltaOnModification from TDF
|
||||
---Purpose : Makes a DeltaOnModification between <me> and
|
||||
-- <anOldAttribute>.
|
||||
is redefined virtual;
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myValue : HArray1OfByte from TColStd;
|
||||
myIsDelta : Boolean from Standard;
|
||||
|
||||
friends
|
||||
class DeltaOnModificationOfByteArray from TDataStd
|
||||
|
||||
end ByteArray;
|
233
src/TDataStd/TDataStd_ByteArray.cxx
Executable file
233
src/TDataStd/TDataStd_ByteArray.cxx
Executable file
@@ -0,0 +1,233 @@
|
||||
// File: TDataStd_ByteArray.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TDataStd_ByteArray.ixx>
|
||||
#include <TDataStd_DeltaOnModificationOfByteArray.hxx>
|
||||
#include <TDF_DefaultDeltaOnModification.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ByteArray::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_ByteArrayID ("FD9B918F-2980-4c66-85E0-D71965475290");
|
||||
return TDataStd_ByteArrayID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ByteArray
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_ByteArray::TDataStd_ByteArray() : myIsDelta(Standard_False){}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ByteArray::Init(const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Backup();
|
||||
|
||||
if (upper >= lower)
|
||||
myValue = new TColStd_HArray1OfByte(lower, upper, 0x00);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_ByteArray) TDataStd_ByteArray::Set(const TDF_Label& label,
|
||||
const Standard_Integer lower,
|
||||
const Standard_Integer upper,
|
||||
const Standard_Boolean isDelta)
|
||||
{
|
||||
Handle(TDataStd_ByteArray) A;
|
||||
if (!label.FindAttribute (TDataStd_ByteArray::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_ByteArray;
|
||||
A->Init (lower, upper);
|
||||
A->SetDelta(isDelta);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ByteArray::SetValue (const Standard_Integer index,
|
||||
const Standard_Byte value)
|
||||
{
|
||||
if (value == myValue->Value(index))
|
||||
return;
|
||||
Backup();
|
||||
|
||||
myValue->SetValue(index, value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Byte TDataStd_ByteArray::Value (const Standard_Integer index) const
|
||||
{
|
||||
return myValue->Value(index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Lower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ByteArray::Lower (void) const
|
||||
{
|
||||
if (myValue.IsNull())
|
||||
return 0;
|
||||
return myValue->Lower();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Upper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ByteArray::Upper (void) const
|
||||
{
|
||||
if (myValue.IsNull()) return -1;
|
||||
return myValue->Upper();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ByteArray::Length (void) const
|
||||
{
|
||||
if (myValue.IsNull())
|
||||
return 0;
|
||||
return myValue->Length();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeArray
|
||||
//purpose : If value of <newArray> differs from <myValue>, Backup
|
||||
// : performed and myValue refers to new instance of HArray1OfByte
|
||||
// : that holds <newArray>
|
||||
//=======================================================================
|
||||
void TDataStd_ByteArray::ChangeArray (const Handle(TColStd_HArray1OfByte)& newArray,
|
||||
const Standard_Boolean isCheckItems)
|
||||
{
|
||||
|
||||
Standard_Integer aLower = newArray->Lower();
|
||||
Standard_Integer anUpper = newArray->Upper();
|
||||
Standard_Boolean aDimEqual = Standard_False;
|
||||
Standard_Integer i;
|
||||
|
||||
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
|
||||
aDimEqual = Standard_True;
|
||||
if(isCheckItems) {
|
||||
Standard_Boolean isEqual = Standard_True;
|
||||
for(i = aLower; i <= anUpper; i++) {
|
||||
if(myValue->Value(i) != newArray->Value(i)) {
|
||||
isEqual = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isEqual)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Backup();
|
||||
// Handles of myValue of current and backuped attributes will be different!
|
||||
if(!aDimEqual)
|
||||
myValue = new TColStd_HArray1OfByte(aLower, anUpper);
|
||||
|
||||
for(i = aLower; i <= anUpper; i++)
|
||||
myValue->SetValue(i, newArray->Value(i));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ByteArray::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_ByteArray::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_ByteArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ByteArray::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_ByteArray) anArray = Handle(TDataStd_ByteArray)::DownCast(With);
|
||||
if (!anArray->myValue.IsNull())
|
||||
{
|
||||
const TColStd_Array1OfByte& with_array = anArray->myValue->Array1();
|
||||
Standard_Integer lower = with_array.Lower(), i = lower, upper = with_array.Upper();
|
||||
myValue = new TColStd_HArray1OfByte(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
myValue->SetValue(i, with_array.Value(i));
|
||||
myIsDelta = anArray->myIsDelta;
|
||||
}
|
||||
else
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ByteArray::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
if (!myValue.IsNull())
|
||||
{
|
||||
Handle(TDataStd_ByteArray) anAtt = Handle(TDataStd_ByteArray)::DownCast(Into);
|
||||
if (!anAtt.IsNull())
|
||||
{
|
||||
anAtt->ChangeArray( myValue, Standard_False);
|
||||
anAtt->SetDelta(myIsDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_ByteArray::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "ByteArray";
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeltaOnModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_DeltaOnModification) TDataStd_ByteArray::DeltaOnModification
|
||||
(const Handle(TDF_Attribute)& OldAttribute) const
|
||||
{
|
||||
if(myIsDelta)
|
||||
return new TDataStd_DeltaOnModificationOfByteArray(*((Handle(TDataStd_ByteArray)*)&OldAttribute));
|
||||
else return new TDF_DefaultDeltaOnModification(OldAttribute);
|
||||
}
|
||||
|
44
src/TDataStd/TDataStd_ByteArray.lxx
Executable file
44
src/TDataStd/TDataStd_ByteArray.lxx
Executable file
@@ -0,0 +1,44 @@
|
||||
// File: TDataStd_ByteArray.lxx
|
||||
// Created: Wed Dec 5 16:41:27 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Array
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(TColStd_HArray1OfByte) TDataStd_ByteArray::InternalArray(void) const
|
||||
{
|
||||
return myValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_ByteArray::RemoveArray(void)
|
||||
{
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_ByteArray::SetDelta(const Standard_Boolean isDelta)
|
||||
{
|
||||
myIsDelta = isDelta;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_ByteArray::GetDelta(void) const
|
||||
{
|
||||
return myIsDelta;
|
||||
}
|
67
src/TDataStd/TDataStd_ChildNodeIterator.cdl
Executable file
67
src/TDataStd/TDataStd_ChildNodeIterator.cdl
Executable file
@@ -0,0 +1,67 @@
|
||||
-- File: TDataStd_ChildNodeIterator.cdl
|
||||
-- Created: Wed Jan 26 16:32:08 2000
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 2000
|
||||
|
||||
|
||||
class ChildNodeIterator from TDataStd
|
||||
|
||||
---Purpose: Iterates on the ChildStepren step of a step, at the
|
||||
-- first level only. It is possible to ask the
|
||||
-- iterator to explore all the sub step levels of the
|
||||
-- given one, with the option "allLevels".
|
||||
|
||||
uses TreeNode from TDataStd
|
||||
|
||||
is
|
||||
|
||||
Create
|
||||
returns ChildNodeIterator from TDataStd;
|
||||
---Purpose: Creates an empty iterator.
|
||||
|
||||
Create(aTreeNode : TreeNode from TDataStd;
|
||||
allLevels : Boolean from Standard = Standard_False)
|
||||
returns ChildNodeIterator from TDataStd;
|
||||
---Purpose: Iterates on the ChildStepren of the given Step. If
|
||||
-- <allLevels> option is set to true, it explores not
|
||||
-- only the first, but all the sub Step levels.
|
||||
|
||||
Initialize(me : in out;
|
||||
aTreeNode : TreeNode from TDataStd;
|
||||
allLevels : Boolean from Standard = Standard_False);
|
||||
---Purpose: Initializes the iteration on the Children Step of
|
||||
-- the given Step. If <allLevels> option is set to
|
||||
-- true, it explores not only the first, but all the
|
||||
-- sub Step levels.
|
||||
|
||||
More(me) returns Boolean;
|
||||
---C++: inline
|
||||
---Purpose: Returns True if there is a current Item in the
|
||||
-- iteration.
|
||||
|
||||
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 Step ChildStepren.
|
||||
|
||||
Value(me) returns TreeNode from TDataStd;
|
||||
---C++: inline
|
||||
---Purpose: Returns the current item; a null Step if there is
|
||||
-- no one.
|
||||
|
||||
fields
|
||||
|
||||
myNode : TreeNode from TDataStd;
|
||||
myFirstLevel : Integer from Standard;
|
||||
|
||||
end ChildNodeIterator;
|
||||
|
||||
|
||||
|
||||
|
||||
|
76
src/TDataStd/TDataStd_ChildNodeIterator.cxx
Executable file
76
src/TDataStd/TDataStd_ChildNodeIterator.cxx
Executable file
@@ -0,0 +1,76 @@
|
||||
// File: TDataStd_ChildNodeIterator.cxx
|
||||
// Created: Wed Jan 26 16:43:08 2000
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_ChildNodeIterator.ixx>
|
||||
|
||||
#define ChildNodeIterator_UpToBrother \
|
||||
{ \
|
||||
while (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myNext == NULL) \
|
||||
myNode = myNode->myFather; \
|
||||
if (!myNode.IsNull() && (myNode->Depth() > myFirstLevel) && myNode->myFather != NULL) \
|
||||
myNode = myNode->myNext; \
|
||||
else \
|
||||
myNode = NULL; \
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ChildNodeIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_ChildNodeIterator::TDataStd_ChildNodeIterator()
|
||||
: myFirstLevel(0)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ChildNodeIterator
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_ChildNodeIterator::TDataStd_ChildNodeIterator (const Handle(TDataStd_TreeNode)& aTreeNode,
|
||||
const Standard_Boolean allLevels)
|
||||
: myNode(aTreeNode->myFirst),
|
||||
myFirstLevel(allLevels ? aTreeNode->Depth() : -1)
|
||||
{}
|
||||
|
||||
//=======================================================================
|
||||
//function : Initialize
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ChildNodeIterator::Initialize(const Handle(TDataStd_TreeNode)& aTreeNode,
|
||||
const Standard_Boolean allLevels)
|
||||
{
|
||||
myNode = aTreeNode->myFirst;
|
||||
myFirstLevel = allLevels ? aTreeNode->Depth() : -1;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ChildNodeIterator::Next()
|
||||
{
|
||||
if (myFirstLevel == -1) {
|
||||
myNode = myNode->myNext;
|
||||
}
|
||||
else {
|
||||
if (myNode->myFirst != NULL) myNode = myNode->myFirst;
|
||||
else ChildNodeIterator_UpToBrother;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NextBrother
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ChildNodeIterator::NextBrother()
|
||||
{
|
||||
if (myNode->myNext != NULL) myNode = myNode->myNext;
|
||||
else ChildNodeIterator_UpToBrother;
|
||||
}
|
23
src/TDataStd/TDataStd_ChildNodeIterator.lxx
Executable file
23
src/TDataStd/TDataStd_ChildNodeIterator.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_ChildNodeIterator.lxx
|
||||
// Created: Fri Feb 11 15:17:58 2000
|
||||
// Author: Vladislav ROMASHKO
|
||||
// <vro@flox.nnov.matra-dtv.fr>
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TDataStd_ChildNodeIterator::More() const
|
||||
{
|
||||
return !myNode.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Handle(TDataStd_TreeNode) TDataStd_ChildNodeIterator::Value() const
|
||||
{
|
||||
return myNode;
|
||||
}
|
89
src/TDataStd/TDataStd_Comment.cdl
Executable file
89
src/TDataStd/TDataStd_Comment.cdl
Executable file
@@ -0,0 +1,89 @@
|
||||
-- File: TDataStd_Comment.cdl
|
||||
-- Created: Thu Jan 15 10:33:38 1998
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class Comment from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Comment attribute. may be associated to any label
|
||||
-- to store user comment.
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
ExtendedString from TCollection,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
AttributeSequence from TDF,
|
||||
Data from TDF
|
||||
|
||||
|
||||
is
|
||||
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for comments.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Find, or create a Comment attribute. the Comment
|
||||
-- attribute is returned.
|
||||
returns Comment from TDataStd;
|
||||
|
||||
Set (myclass; label : Label from TDF; string : ExtendedString from TCollection)
|
||||
---Purpose: Finds, or creates a Comment attribute and sets the string.
|
||||
-- the Comment attribute is returned.
|
||||
returns Comment from TDataStd;
|
||||
|
||||
---Purpose: Comment methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Comment from TDataStd;
|
||||
|
||||
Set (me : mutable; S : ExtendedString from TCollection);
|
||||
|
||||
|
||||
Get (me)
|
||||
returns ExtendedString from TCollection;
|
||||
---Purpose:
|
||||
-- Returns the comment attribute.
|
||||
---C++: return const &
|
||||
|
||||
---Category: TDF_Attribute methods
|
||||
-- =====================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
AfterRetrieval(me: mutable;
|
||||
forceIt : Boolean from Standard = Standard_False)
|
||||
returns Boolean from Standard
|
||||
is redefined static;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myString : ExtendedString from TCollection;
|
||||
|
||||
end Comment;
|
157
src/TDataStd/TDataStd_Comment.cxx
Executable file
157
src/TDataStd/TDataStd_Comment.cxx
Executable file
@@ -0,0 +1,157 @@
|
||||
// File: TDataStd_Comment.cxx
|
||||
// Created: Thu Jan 15 10:38:19 1998
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_Comment.ixx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDF_ChildIDIterator.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
|
||||
|
||||
#define lid1 45
|
||||
#define lid2 36
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Comment::GetID ()
|
||||
{
|
||||
static Standard_GUID TDataStd_CommentID ("2a96b616-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_CommentID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Comment) TDataStd_Comment::Set (const TDF_Label& L,
|
||||
const TCollection_ExtendedString& S)
|
||||
{
|
||||
Handle(TDataStd_Comment) A;
|
||||
if (!L.FindAttribute(TDataStd_Comment::GetID(),A)) {
|
||||
A = new TDataStd_Comment ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
A->Set (S);
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Comment) TDataStd_Comment::Set (const TDF_Label& L)
|
||||
{
|
||||
Handle(TDataStd_Comment) A;
|
||||
if (!L.FindAttribute(TDataStd_Comment::GetID(),A)) {
|
||||
A = new TDataStd_Comment ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Comment
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TDataStd_Comment::TDataStd_Comment () { }
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_Comment::Set (const TCollection_ExtendedString& S)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myString == S) return;
|
||||
|
||||
Backup();
|
||||
|
||||
myString = S;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& TDataStd_Comment::Get () const
|
||||
{
|
||||
return myString;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Comment::ID () const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Comment::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_Comment();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Comment::Restore(const Handle(TDF_Attribute)& with)
|
||||
{
|
||||
myString = Handle(TDataStd_Comment)::DownCast (with)->Get ();
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Comment::Paste (const Handle(TDF_Attribute)& into,
|
||||
const Handle(TDF_RelocationTable)& /*RT*/) const
|
||||
{
|
||||
Handle(TDataStd_Comment)::DownCast (into)->Set (myString);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Comment::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
TDF_Attribute::Dump(anOS);
|
||||
anOS << "Comment=|"<<myString<<"|";
|
||||
return anOS;
|
||||
}
|
||||
Standard_Boolean TDataStd_Comment::
|
||||
AfterRetrieval(const Standard_Boolean)
|
||||
{
|
||||
return Standard_True;
|
||||
}
|
80
src/TDataStd/TDataStd_Current.cdl
Executable file
80
src/TDataStd/TDataStd_Current.cdl
Executable file
@@ -0,0 +1,80 @@
|
||||
-- File: TDataStd_Current.cdl
|
||||
-- Created: Mon Aug 2 09:49:50 1999
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class Current from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: this attribute, located at root label, manage an
|
||||
-- access to a current label.
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
|
||||
Set (myclass; L : Label from TDF);
|
||||
---Purpose: Set <L> as current of <L> Framework.
|
||||
|
||||
|
||||
Get (myclass; acces : Label from TDF)
|
||||
---Purpose: returns current of <acces> Framework. raise if (!Has)
|
||||
returns Label from TDF;
|
||||
|
||||
|
||||
Has (myclass; acces : Label from TDF)
|
||||
---Purpose: returns True if a current label is managed in <acces>
|
||||
-- Framework.
|
||||
returns Boolean from Standard;
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
Create
|
||||
returns mutable Current from TDataStd;
|
||||
|
||||
SetLabel (me : mutable; current : Label from TDF);
|
||||
|
||||
GetLabel (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 mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myLabel : Label from TDF;
|
||||
|
||||
end Current;
|
151
src/TDataStd/TDataStd_Current.cxx
Executable file
151
src/TDataStd/TDataStd_Current.cxx
Executable file
@@ -0,0 +1,151 @@
|
||||
// File: TDataStd_Current.cxx
|
||||
// Created: Mon Aug 2 09:58:09 1999
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_Current.ixx>
|
||||
#include <TDF_Data.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Current::GetID ()
|
||||
{
|
||||
static Standard_GUID TDataStd_CurrentID("2a96b623-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_CurrentID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Current::Set (const TDF_Label& current)
|
||||
{
|
||||
Handle(TDataStd_Current) A;
|
||||
Handle(TDF_Data) D = current.Data();
|
||||
if (!D->Root().FindAttribute (TDataStd_Current::GetID(), A)) {
|
||||
A = new TDataStd_Current ();
|
||||
D->Root().AddAttribute(A);
|
||||
}
|
||||
A->SetLabel (current);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDF_Label TDataStd_Current::Get (const TDF_Label& access)
|
||||
{
|
||||
// TDF_Label current;
|
||||
Handle(TDataStd_Current) A;
|
||||
if (!access.Data()->Root().FindAttribute (TDataStd_Current::GetID(), A)) {
|
||||
Standard_DomainError::Raise("TDataStd_Current::Get : not setted");
|
||||
}
|
||||
return A->GetLabel();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Has
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Current::Has (const TDF_Label& access)
|
||||
{
|
||||
return (access.Data()->Root().IsAttribute (TDataStd_Current::GetID()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Current
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Current::TDataStd_Current () { }
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Current::SetLabel (const TDF_Label& current)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myLabel == current) return;
|
||||
|
||||
Backup();
|
||||
myLabel = current;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDF_Label TDataStd_Current::GetLabel () const
|
||||
{
|
||||
return myLabel;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Current::ID() const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Current::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_Current();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Current::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myLabel = Handle(TDataStd_Current)::DownCast (With)->GetLabel ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Current::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
TDF_Label tLab;
|
||||
if (!myLabel.IsNull()) {
|
||||
if (!RT->HasRelocation(myLabel,tLab)) tLab = myLabel;
|
||||
}
|
||||
Handle(TDataStd_Current)::DownCast(Into)->SetLabel(tLab);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Current::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Current";
|
||||
return anOS;
|
||||
}
|
||||
|
||||
|
36
src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cdl
Executable file
36
src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: TDataStd_DeltaOnModificationOfByteArray.cdl
|
||||
-- Created: Wed Dec 5 15:43:43 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class DeltaOnModificationOfByteArray from TDataStd inherits DeltaOnModification from TDF
|
||||
|
||||
---Purpose: This class provides default services for an
|
||||
-- AttributeDelta on a MODIFICATION action.
|
||||
|
||||
uses
|
||||
Attribute from TDF,
|
||||
HArray1OfInteger from TColStd,
|
||||
HArray1OfByte from TColStd,
|
||||
ByteArray from TDataStd
|
||||
|
||||
is
|
||||
|
||||
Create (Arr : ByteArray from TDataStd)
|
||||
returns mutable DeltaOnModificationOfByteArray from TDataStd;
|
||||
---Purpose: Initializes a TDF_DeltaOnModification.
|
||||
|
||||
Apply (me : mutable)
|
||||
is redefined virtual;
|
||||
---Purpose: Applies the delta to the attribute.
|
||||
fields
|
||||
|
||||
myIndxes : HArray1OfInteger from TColStd;
|
||||
myValues : HArray1OfByte from TColStd;
|
||||
myUp1 : Integer from Standard;
|
||||
myUp2 : Integer from Standard;
|
||||
|
||||
end DeltaOnModificationOfByteArray;
|
||||
|
166
src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cxx
Executable file
166
src/TDataStd/TDataStd_DeltaOnModificationOfByteArray.cxx
Executable file
@@ -0,0 +1,166 @@
|
||||
// File: TDataStd_DeltaOnModificationOfByteArray.cxx
|
||||
// Created: Wed Dec 5 16:18:51 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TDataStd_DeltaOnModificationOfByteArray.ixx>
|
||||
#include <TDataStd_ByteArray.hxx>
|
||||
#include <TDF_DeltaOnModification.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_HArray1OfByte.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TDF_AttributeIterator.hxx>
|
||||
|
||||
#ifdef DEB
|
||||
#define MAXUP 1000
|
||||
#endif
|
||||
//=======================================================================
|
||||
//function : TDataStd_DeltaOnModificationOfByteArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_DeltaOnModificationOfByteArray::TDataStd_DeltaOnModificationOfByteArray(const Handle(TDataStd_ByteArray)& OldAtt)
|
||||
: TDF_DeltaOnModification(OldAtt)
|
||||
{
|
||||
Handle(TDataStd_ByteArray) CurrAtt;
|
||||
if (Label().FindAttribute(OldAtt->ID(),CurrAtt)) {
|
||||
{
|
||||
Handle(TColStd_HArray1OfByte) Arr1, Arr2;
|
||||
Arr1 = OldAtt->InternalArray();
|
||||
Arr2 = CurrAtt->InternalArray();
|
||||
#ifdef DEB_DELTA
|
||||
if(Arr1.IsNull())
|
||||
cout <<"DeltaOnModificationOfByteArray:: Old ByteArray is Null" <<endl;
|
||||
if(Arr2.IsNull())
|
||||
cout <<"DeltaOnModificationOfByteArray:: Current ByteArray is Null" <<endl;
|
||||
#endif
|
||||
|
||||
if(Arr1.IsNull() || Arr2.IsNull()) return;
|
||||
if(Arr1 != Arr2) {
|
||||
myUp1 = Arr1->Upper();
|
||||
myUp2 = Arr2->Upper();
|
||||
Standard_Integer i, N=0, aCase=0;
|
||||
if(myUp1 == myUp2)
|
||||
{aCase = 1; N = myUp1;}
|
||||
else if(myUp1 < myUp2)
|
||||
{aCase = 2; N = myUp1;}
|
||||
else
|
||||
{aCase = 3; N = myUp2;}//Up1 > Up2
|
||||
|
||||
TColStd_ListOfInteger aList;
|
||||
for(i=Arr1->Lower();i<= N; i++)
|
||||
if(Arr1->Value(i) != Arr2->Value(i))
|
||||
aList.Append(i);
|
||||
if(aCase == 3) {
|
||||
for(i = N+1;i <= myUp1; i++)
|
||||
aList.Append(i);
|
||||
}
|
||||
|
||||
if(aList.Extent()) {
|
||||
myIndxes = new TColStd_HArray1OfInteger(1,aList.Extent());
|
||||
myValues = new TColStd_HArray1OfByte(1,aList.Extent());
|
||||
TColStd_ListIteratorOfListOfInteger anIt(aList);
|
||||
for(i =1;anIt.More();anIt.Next(),i++) {
|
||||
myIndxes->SetValue(i, anIt.Value());
|
||||
myValues->SetValue(i, Arr1->Value(anIt.Value()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OldAtt->RemoveArray();
|
||||
#ifdef DEB
|
||||
if(OldAtt->InternalArray().IsNull())
|
||||
cout << "BackUp Arr is Nullified" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Apply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_DeltaOnModificationOfByteArray::Apply()
|
||||
{
|
||||
|
||||
Handle(TDF_Attribute) TDFAttribute = Attribute();
|
||||
Handle(TDataStd_ByteArray) BackAtt = (*((Handle(TDataStd_ByteArray)*)&TDFAttribute));
|
||||
if(BackAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfByteArray::Apply: OldAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(TDataStd_ByteArray) aCurAtt;
|
||||
if (!Label().FindAttribute(BackAtt->ID(),aCurAtt)) {
|
||||
|
||||
Label().AddAttribute(BackAtt);
|
||||
}
|
||||
|
||||
if(aCurAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfByteArray::Apply: CurAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
aCurAtt->Backup();
|
||||
|
||||
Standard_Integer aCase;
|
||||
if(myUp1 == myUp2)
|
||||
aCase = 1;
|
||||
else if(myUp1 < myUp2)
|
||||
aCase = 2;
|
||||
else
|
||||
aCase = 3;//Up1 > Up2
|
||||
|
||||
if (aCase == 1 && (myIndxes.IsNull() || myValues.IsNull()))
|
||||
return;
|
||||
|
||||
Standard_Integer i;
|
||||
Handle(TColStd_HArray1OfByte) BArr = aCurAtt->InternalArray();
|
||||
if(BArr.IsNull()) return;
|
||||
if(aCase == 1)
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
BArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
else if(aCase == 2) {
|
||||
Handle(TColStd_HArray1OfByte) byteArr = new TColStd_HArray1OfByte(BArr->Lower(), myUp1);
|
||||
for(i = BArr->Lower(); i <= myUp1 && i <= BArr->Upper(); i++)
|
||||
byteArr->SetValue(i, BArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
byteArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
aCurAtt->myValue = byteArr;
|
||||
}
|
||||
else { // aCase == 3
|
||||
Standard_Integer low = BArr->Lower();
|
||||
Handle(TColStd_HArray1OfByte) byteArr = new TColStd_HArray1OfByte(low, myUp1);
|
||||
for(i = BArr->Lower(); i <= myUp2 && i <= BArr->Upper(); i++)
|
||||
byteArr->SetValue(i, BArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++) {
|
||||
#ifdef DEB
|
||||
cout << "i = " << i << " myIndxes->Upper = " << myIndxes->Upper() << endl;
|
||||
cout << "myIndxes->Value(i) = " << myIndxes->Value(i) << endl;
|
||||
cout << "myValues->Value(i) = " << myValues->Value(i) << endl;
|
||||
#endif
|
||||
byteArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
}
|
||||
aCurAtt->myValue = byteArr;
|
||||
}
|
||||
|
||||
#ifdef DEB
|
||||
cout << " << Array Dump after Delta Apply >>" <<endl;
|
||||
Handle(TColStd_HArray1OfByte) BArr2 = aCurAtt->InternalArray();
|
||||
for(i=BArr2->Lower(); i<=BArr2->Upper() && i<= MAXUP;i++)
|
||||
cout << BArr2->Value(i) << " ";
|
||||
cout <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
35
src/TDataStd/TDataStd_DeltaOnModificationOfExtStringArray.cdl
Executable file
35
src/TDataStd/TDataStd_DeltaOnModificationOfExtStringArray.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: TDataStd_DeltaOnModificationOfExtStringArray.cdl
|
||||
-- Created: Tue Dec 4 17:43:15 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class DeltaOnModificationOfExtStringArray from TDataStd inherits DeltaOnModification from TDF
|
||||
|
||||
---Purpose: This class provides default services for an
|
||||
-- AttributeDelta on a MODIFICATION action.
|
||||
|
||||
uses
|
||||
Attribute from TDF,
|
||||
HArray1OfExtendedString from TColStd,
|
||||
ExtStringArray from TDataStd,
|
||||
HArray1OfInteger from TColStd
|
||||
|
||||
is
|
||||
Create (Arr : ExtStringArray from TDataStd)
|
||||
returns mutable DeltaOnModificationOfExtStringArray from TDataStd;
|
||||
---Purpose: Initializes a TDF_DeltaOnModification.
|
||||
|
||||
Apply (me : mutable)
|
||||
is redefined virtual;
|
||||
---Purpose: Applies the delta to the attribute.
|
||||
fields
|
||||
myIndxes : HArray1OfInteger from TColStd;
|
||||
myValues : HArray1OfExtendedString from TColStd;
|
||||
myUp1 : Integer from Standard;
|
||||
myUp2 : Integer from Standard;
|
||||
|
||||
end DeltaOnModificationOfExtStringArray;
|
||||
|
||||
|
169
src/TDataStd/TDataStd_DeltaOnModificationOfExtStringArray.cxx
Executable file
169
src/TDataStd/TDataStd_DeltaOnModificationOfExtStringArray.cxx
Executable file
@@ -0,0 +1,169 @@
|
||||
// File: TDataStd_DeltaOnModificationOfExtStringArray.cxx
|
||||
// Created: Tue Dec 4 17:48:47 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TDataStd_DeltaOnModificationOfExtStringArray.ixx>
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
#include <TDF_DeltaOnModification.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TColStd_HArray1OfExtendedString.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TDF_AttributeIterator.hxx>
|
||||
|
||||
#ifdef DEB
|
||||
#define MAXUP 1000
|
||||
#endif
|
||||
//=======================================================================
|
||||
//function : TDataStd_DeltaOnModificationOfExtStringArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_DeltaOnModificationOfExtStringArray::TDataStd_DeltaOnModificationOfExtStringArray(const Handle(TDataStd_ExtStringArray)& OldAtt)
|
||||
: TDF_DeltaOnModification(OldAtt)
|
||||
{
|
||||
Handle(TDataStd_ExtStringArray) CurrAtt;
|
||||
if (Label().FindAttribute(OldAtt->ID(),CurrAtt)) {
|
||||
{
|
||||
Handle(TColStd_HArray1OfExtendedString) Arr1, Arr2;
|
||||
Arr1 = OldAtt->Array();
|
||||
Arr2 = CurrAtt->Array();
|
||||
#ifdef DEB
|
||||
if(Arr1.IsNull())
|
||||
cout <<"DeltaOnModificationOfExtStringArray:: Old IntArray is Null" <<endl;
|
||||
if(Arr2.IsNull())
|
||||
cout <<"DeltaOnModificationOfExtStringArray:: Current IntArray is Null" <<endl;
|
||||
#endif
|
||||
|
||||
if(Arr1.IsNull() || Arr2.IsNull()) return;
|
||||
if(Arr1 != Arr2) {
|
||||
myUp1 = Arr1->Upper();
|
||||
myUp2 = Arr2->Upper();
|
||||
Standard_Integer i, N =0, aCase=0;
|
||||
if(myUp1 == myUp2)
|
||||
{aCase = 1; N = myUp1;}
|
||||
else if(myUp1 < myUp2)
|
||||
{aCase = 2; N = myUp1;}
|
||||
else
|
||||
{aCase = 3; N = myUp2;}//Up1 > Up2
|
||||
|
||||
TColStd_ListOfInteger aList;
|
||||
for(i=Arr1->Lower();i <= N; i++)
|
||||
if(Arr1->Value(i) != Arr2->Value(i))
|
||||
aList.Append(i);
|
||||
if(aCase == 3) {
|
||||
for(i = N+1;i <= myUp1; i++)
|
||||
aList.Append(i);
|
||||
}
|
||||
|
||||
if(aList.Extent()) {
|
||||
myIndxes = new TColStd_HArray1OfInteger(1,aList.Extent());
|
||||
myValues = new TColStd_HArray1OfExtendedString(1,aList.Extent());
|
||||
TColStd_ListIteratorOfListOfInteger anIt(aList);
|
||||
for(i =1;anIt.More();anIt.Next(),i++) {
|
||||
myIndxes->SetValue(i, anIt.Value());
|
||||
myValues->SetValue(i, Arr1->Value(anIt.Value()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OldAtt->RemoveArray();
|
||||
#ifdef DEB
|
||||
if(OldAtt->Array().IsNull())
|
||||
cout << "BackUp Arr is Nullified" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Apply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_DeltaOnModificationOfExtStringArray::Apply()
|
||||
{
|
||||
|
||||
Handle(TDF_Attribute) TDFAttribute = Attribute();
|
||||
Handle(TDataStd_ExtStringArray) BackAtt = (*((Handle(TDataStd_ExtStringArray)*)&TDFAttribute));
|
||||
if(BackAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfExtStringArray::Apply: OldAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(TDataStd_ExtStringArray) aCurAtt;
|
||||
if (!Label().FindAttribute(BackAtt->ID(),aCurAtt)) {
|
||||
|
||||
Label().AddAttribute(BackAtt);
|
||||
}
|
||||
|
||||
if(aCurAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfExtStringArray::Apply: CurAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
aCurAtt->Backup();
|
||||
|
||||
Standard_Integer aCase;
|
||||
if(myUp1 == myUp2)
|
||||
aCase = 1;
|
||||
else if(myUp1 < myUp2)
|
||||
aCase = 2;
|
||||
else
|
||||
aCase = 3;//Up1 > Up2
|
||||
|
||||
if (aCase == 1 && (myIndxes.IsNull() || myValues.IsNull()))
|
||||
return;
|
||||
|
||||
Standard_Integer i;
|
||||
Handle(TColStd_HArray1OfExtendedString) aStrArr = aCurAtt->Array();
|
||||
if(aStrArr.IsNull()) return;
|
||||
|
||||
if(aCase == 1)
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
aStrArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
else if(aCase == 2) {
|
||||
Handle(TColStd_HArray1OfExtendedString) strArr =
|
||||
new TColStd_HArray1OfExtendedString(aStrArr->Lower(), myUp1);
|
||||
for(i = aStrArr->Lower(); i <= myUp1 && i <= aStrArr->Upper(); i++)
|
||||
strArr->SetValue(i, aStrArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
strArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
aCurAtt->myValue = strArr;
|
||||
}
|
||||
else { // == 3
|
||||
Standard_Integer low = aStrArr->Lower();
|
||||
Handle(TColStd_HArray1OfExtendedString) strArr =
|
||||
new TColStd_HArray1OfExtendedString(low, myUp1);
|
||||
for(i = aStrArr->Lower(); i <= myUp2 && i <= aStrArr->Upper(); i++)
|
||||
strArr->SetValue(i, aStrArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++) {
|
||||
#ifdef DEB
|
||||
cout << "i = " << i << " myIndxes->Upper = " << myIndxes->Upper() << endl;
|
||||
cout << "myIndxes->Value(i) = " << myIndxes->Value(i) << endl;
|
||||
cout << "myValues->Value(i) = " << myValues->Value(i) << endl;
|
||||
#endif
|
||||
strArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
}
|
||||
aCurAtt->myValue = strArr;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEB
|
||||
cout << " << Array Dump after Delta Apply >>" <<endl;
|
||||
Handle(TColStd_HArray1OfExtendedString) aStrArr2 = aCurAtt->Array();
|
||||
for(i=aStrArr2->Lower(); i<= aStrArr2->Upper() && i<= MAXUP;i++)
|
||||
cout << aStrArr2->Value(i) << " ";
|
||||
cout <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
33
src/TDataStd/TDataStd_DeltaOnModificationOfIntArray.cdl
Executable file
33
src/TDataStd/TDataStd_DeltaOnModificationOfIntArray.cdl
Executable file
@@ -0,0 +1,33 @@
|
||||
-- File: TDataStd_DeltaOnModificationOfIntArray.cdl
|
||||
-- Created: Thu Sep 6 16:58:59 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class DeltaOnModificationOfIntArray from TDataStd inherits DeltaOnModification from TDF
|
||||
|
||||
---Purpose: This class provides default services for an
|
||||
-- AttributeDelta on a MODIFICATION action.
|
||||
|
||||
uses
|
||||
Attribute from TDF,
|
||||
HArray1OfInteger from TColStd,
|
||||
IntegerArray from TDataStd
|
||||
|
||||
is
|
||||
Create (Arr : IntegerArray from TDataStd)
|
||||
returns mutable DeltaOnModificationOfIntArray from TDataStd;
|
||||
---Purpose: Initializes a TDF_DeltaOnModification.
|
||||
|
||||
Apply (me : mutable)
|
||||
is redefined virtual;
|
||||
---Purpose: Applies the delta to the attribute.
|
||||
fields
|
||||
|
||||
myIndxes : HArray1OfInteger from TColStd;
|
||||
myValues : HArray1OfInteger from TColStd;
|
||||
myUp1 : Integer from Standard;
|
||||
myUp2 : Integer from Standard;
|
||||
|
||||
end DeltaOnModificationOfIntArray;
|
163
src/TDataStd/TDataStd_DeltaOnModificationOfIntArray.cxx
Executable file
163
src/TDataStd/TDataStd_DeltaOnModificationOfIntArray.cxx
Executable file
@@ -0,0 +1,163 @@
|
||||
// File: TDataStd_DeltaOnModificationOfIntArray.cxx
|
||||
// Created: Thu Sep 6 17:04:04 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TDataStd_DeltaOnModificationOfIntArray.ixx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDF_DeltaOnModification.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TDF_AttributeIterator.hxx>
|
||||
#ifdef DEB
|
||||
#define MAXUP 1000
|
||||
#endif
|
||||
//=======================================================================
|
||||
//function : TDataStd_DeltaOnModificationOfIntArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_DeltaOnModificationOfIntArray::TDataStd_DeltaOnModificationOfIntArray(const Handle(TDataStd_IntegerArray)& OldAtt)
|
||||
: TDF_DeltaOnModification(OldAtt)
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) CurrAtt;
|
||||
if (Label().FindAttribute(OldAtt->ID(),CurrAtt)) {
|
||||
{
|
||||
Handle(TColStd_HArray1OfInteger) Arr1, Arr2;
|
||||
Arr1 = OldAtt->Array();
|
||||
Arr2 = CurrAtt->Array();
|
||||
#ifdef DEB
|
||||
if(Arr1.IsNull())
|
||||
cout <<"DeltaOnModificationOfIntArray:: Old IntArray is Null" <<endl;
|
||||
if(Arr2.IsNull())
|
||||
cout <<"DeltaOnModificationOfIntArray:: Current IntArray is Null" <<endl;
|
||||
#endif
|
||||
|
||||
if(Arr1.IsNull() || Arr2.IsNull()) return;
|
||||
if(Arr1 != Arr2) {
|
||||
myUp1 = Arr1->Upper();
|
||||
myUp2 = Arr2->Upper();
|
||||
Standard_Integer i, N=0, aCase=0;
|
||||
if(myUp1 == myUp2)
|
||||
{aCase = 1; N = myUp1;}
|
||||
else if(myUp1 < myUp2)
|
||||
{aCase = 2; N = myUp1;}
|
||||
else
|
||||
{aCase = 3; N = myUp2;}//Up1 > Up2
|
||||
|
||||
TColStd_ListOfInteger aList;
|
||||
for(i=Arr1->Lower();i <= N; i++)
|
||||
if(Arr1->Value(i) != Arr2->Value(i))
|
||||
aList.Append(i);
|
||||
if(aCase == 3) {
|
||||
for(i = N+1;i <= myUp1; i++)
|
||||
aList.Append(i);
|
||||
}
|
||||
if(aList.Extent()) {
|
||||
myIndxes = new TColStd_HArray1OfInteger(1,aList.Extent());
|
||||
myValues = new TColStd_HArray1OfInteger(1,aList.Extent());
|
||||
TColStd_ListIteratorOfListOfInteger anIt(aList);
|
||||
for(i=1;anIt.More();anIt.Next(),i++) {
|
||||
myIndxes->SetValue(i, anIt.Value());
|
||||
myValues->SetValue(i, Arr1->Value(anIt.Value()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OldAtt->RemoveArray();
|
||||
#ifdef DEB
|
||||
if(OldAtt->Array().IsNull())
|
||||
cout << "BackUp Arr is Nullified" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Apply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_DeltaOnModificationOfIntArray::Apply()
|
||||
{
|
||||
|
||||
Handle(TDF_Attribute) TDFAttribute = Attribute();
|
||||
Handle(TDataStd_IntegerArray) BackAtt = (*((Handle(TDataStd_IntegerArray)*)&TDFAttribute));
|
||||
if(BackAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfIntArray::Apply: OldAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(TDataStd_IntegerArray) aCurAtt;
|
||||
if (!Label().FindAttribute(BackAtt->ID(),aCurAtt)) {
|
||||
|
||||
Label().AddAttribute(BackAtt);
|
||||
}
|
||||
|
||||
if(aCurAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfIntArray::Apply: CurAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
aCurAtt->Backup();
|
||||
|
||||
Standard_Integer aCase;
|
||||
if(myUp1 == myUp2)
|
||||
aCase = 1;
|
||||
else if(myUp1 < myUp2)
|
||||
aCase = 2;
|
||||
else
|
||||
aCase = 3;//Up1 > Up2
|
||||
////
|
||||
if (aCase == 1 && (myIndxes.IsNull() || myValues.IsNull()))
|
||||
return;
|
||||
|
||||
Standard_Integer i;
|
||||
Handle(TColStd_HArray1OfInteger) IntArr = aCurAtt->Array();
|
||||
if(IntArr.IsNull()) return;
|
||||
if(aCase == 1)
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
IntArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
else if(aCase == 2) {
|
||||
Handle(TColStd_HArray1OfInteger) intArr = new TColStd_HArray1OfInteger(IntArr->Lower(), myUp1);
|
||||
for(i = IntArr->Lower(); i <= myUp1 && i <= IntArr->Upper(); i++)
|
||||
intArr->SetValue(i, IntArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
intArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
aCurAtt->myValue = intArr;
|
||||
}
|
||||
else { // aCase == 3
|
||||
Standard_Integer low = IntArr->Lower();
|
||||
Handle(TColStd_HArray1OfInteger) intArr = new TColStd_HArray1OfInteger(low, myUp1);
|
||||
for(i = IntArr->Lower(); i <= myUp2 && i <= IntArr->Upper(); i++)
|
||||
intArr->SetValue(i, IntArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++) {
|
||||
#ifdef DEB
|
||||
cout << "i = " << i << " myIndxes->Upper = " << myIndxes->Upper() << endl;
|
||||
cout << "myIndxes->Value(i) = " << myIndxes->Value(i) << endl;
|
||||
cout << "myValues->Value(i) = " << myValues->Value(i) << endl;
|
||||
#endif
|
||||
intArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
}
|
||||
aCurAtt->myValue = intArr;
|
||||
}
|
||||
|
||||
#ifdef DEB
|
||||
cout << " << Array Dump after Delta Apply >>" <<endl;
|
||||
Handle(TColStd_HArray1OfInteger) IntArr2 = aCurAtt->Array();
|
||||
for(i=IntArr2->Lower(); i<=IntArr2->Upper() && i <= MAXUP;i++)
|
||||
cout << IntArr2->Value(i) << " ";
|
||||
cout <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
34
src/TDataStd/TDataStd_DeltaOnModificationOfIntPackedMap.cdl
Executable file
34
src/TDataStd/TDataStd_DeltaOnModificationOfIntPackedMap.cdl
Executable file
@@ -0,0 +1,34 @@
|
||||
-- File: TDataStd_DeltaOnModificationOfIntPackedMap.cdl
|
||||
-- Created: Wed Jan 23 10:59:04 2008
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2008
|
||||
|
||||
|
||||
class DeltaOnModificationOfIntPackedMap from TDataStd inherits DeltaOnModification from TDF
|
||||
|
||||
---Purpose: This class provides default services for an
|
||||
-- AttributeDelta on a MODIFICATION action.
|
||||
|
||||
uses
|
||||
Attribute from TDF,
|
||||
IntPackedMap from TDataStd,
|
||||
HPackedMapOfInteger from TColStd
|
||||
|
||||
|
||||
is
|
||||
|
||||
Create (Arr : IntPackedMap from TDataStd)
|
||||
returns mutable DeltaOnModificationOfIntPackedMap from TDataStd;
|
||||
---Purpose: Initializes a TDF_DeltaOnModification.
|
||||
|
||||
Apply (me : mutable)
|
||||
is redefined virtual;
|
||||
---Purpose: Applies the delta to the attribute.
|
||||
fields
|
||||
|
||||
myAddition : HPackedMapOfInteger from TColStd;
|
||||
myDeletion : HPackedMapOfInteger from TColStd;
|
||||
|
||||
end DeltaOnModificationOfIntPackedMap;
|
||||
|
129
src/TDataStd/TDataStd_DeltaOnModificationOfIntPackedMap.cxx
Executable file
129
src/TDataStd/TDataStd_DeltaOnModificationOfIntPackedMap.cxx
Executable file
@@ -0,0 +1,129 @@
|
||||
// File: TDataStd_DeltaOnModificationOfIntPackedMap.cxx
|
||||
// Created: Wed Jan 23 11:05:47 2008
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2008
|
||||
|
||||
#include <TDataStd_DeltaOnModificationOfIntPackedMap.ixx>
|
||||
#include <TDF_DeltaOnModification.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
#include <TColStd_HPackedMapOfInteger.hxx>
|
||||
#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
|
||||
|
||||
#ifdef DEB
|
||||
#define MAXUP 1000
|
||||
#endif
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_DeltaOnModificationOfIntPackedMap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_DeltaOnModificationOfIntPackedMap::TDataStd_DeltaOnModificationOfIntPackedMap(
|
||||
const Handle(TDataStd_IntPackedMap)& OldAtt)
|
||||
: TDF_DeltaOnModification(OldAtt)
|
||||
{
|
||||
Handle(TDataStd_IntPackedMap) CurrAtt;
|
||||
if (Label().FindAttribute(OldAtt->ID(),CurrAtt)) {
|
||||
{
|
||||
Handle(TColStd_HPackedMapOfInteger) aMap1, aMap2;
|
||||
aMap1 = OldAtt->GetHMap();
|
||||
aMap2 = CurrAtt->GetHMap();
|
||||
#ifdef DEB
|
||||
if(aMap1.IsNull())
|
||||
cout <<"DeltaOnModificationOfIntPackedMap:: Old Map is Null" <<endl;
|
||||
if(aMap2.IsNull())
|
||||
cout <<"DeltaOnModificationOfIntPackedMap:: Current Map is Null" <<endl;
|
||||
#endif
|
||||
|
||||
if(aMap1.IsNull() || aMap2.IsNull()) return;
|
||||
if(aMap1 != aMap2) {
|
||||
if(!aMap1->Map().HasIntersection(aMap2->Map()))
|
||||
return; // no intersection: use full-scale backup
|
||||
|
||||
if(aMap1->Map().IsSubset(aMap2->Map())) {
|
||||
myDeletion = new TColStd_HPackedMapOfInteger();
|
||||
myDeletion->ChangeMap().Subtraction(aMap2->Map(), aMap1->Map());
|
||||
} else if(aMap2->Map().IsSubset(aMap1->Map())) {
|
||||
myAddition = new TColStd_HPackedMapOfInteger();
|
||||
myAddition->ChangeMap().Subtraction(aMap1->Map(), aMap2->Map());
|
||||
} else {
|
||||
myAddition = new TColStd_HPackedMapOfInteger();
|
||||
myAddition->ChangeMap().Subtraction(aMap1->Map(), aMap2->Map());
|
||||
myDeletion = new TColStd_HPackedMapOfInteger();
|
||||
myDeletion->ChangeMap().Subtraction(aMap2->Map(), aMap1->Map());
|
||||
}
|
||||
}
|
||||
}
|
||||
OldAtt->RemoveMap();
|
||||
#ifdef DEB
|
||||
if(OldAtt->GetHMap().IsNull())
|
||||
cout << "BackUp Arr is Nullified" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Apply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_DeltaOnModificationOfIntPackedMap::Apply()
|
||||
{
|
||||
|
||||
Handle(TDF_Attribute) aTDFAttribute = Attribute();
|
||||
Handle(TDataStd_IntPackedMap) aBackAtt = (*((Handle(TDataStd_IntPackedMap)*)&aTDFAttribute));
|
||||
if(aBackAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfIntPAckedMap::Apply: OldAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(TDataStd_IntPackedMap) aCurAtt;
|
||||
if (!Label().FindAttribute(aBackAtt->ID(),aCurAtt)) {
|
||||
|
||||
Label().AddAttribute(aBackAtt);
|
||||
}
|
||||
|
||||
if(aCurAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfIntAPckedMAp::Apply: CurAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
aCurAtt->Backup();
|
||||
|
||||
|
||||
|
||||
Handle(TColStd_HPackedMapOfInteger) IntMap = aCurAtt->GetHMap();
|
||||
if(IntMap.IsNull()) return;
|
||||
|
||||
if(myDeletion.IsNull() && myAddition.IsNull())
|
||||
return;
|
||||
else {
|
||||
if(!myDeletion.IsNull()) {
|
||||
|
||||
if(myDeletion->Map().Extent())
|
||||
IntMap->ChangeMap().Subtract(myDeletion->Map());
|
||||
}
|
||||
if(!myAddition.IsNull()) {
|
||||
if(myAddition->Map().Extent())
|
||||
IntMap->ChangeMap().Unite(myAddition->Map());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEB
|
||||
cout << " << Map Dump after Delta Apply >>" <<endl;
|
||||
Handle(TColStd_HPackedMapOfInteger) aIntMap = aCurAtt->GetHMap();
|
||||
TColStd_MapIteratorOfPackedMapOfInteger it(aIntMap->Map());
|
||||
for (Standard_Integer i=1;it.More() && i <= MAXUP; it.Next(), i++)
|
||||
cout << it.Key() << " ";
|
||||
cout <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
36
src/TDataStd/TDataStd_DeltaOnModificationOfRealArray.cdl
Executable file
36
src/TDataStd/TDataStd_DeltaOnModificationOfRealArray.cdl
Executable file
@@ -0,0 +1,36 @@
|
||||
-- File: TDataStd_DeltaOnModificationOfRealArray.cdl
|
||||
-- Created: Tue Oct 30 16:49:40 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class DeltaOnModificationOfRealArray from TDataStd inherits DeltaOnModification from TDF
|
||||
|
||||
---Purpose: This class provides default services for an
|
||||
-- AttributeDelta on a MODIFICATION action
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
HArray1OfReal from TColStd,
|
||||
HArray1OfInteger from TColStd,
|
||||
RealArray from TDataStd
|
||||
|
||||
is
|
||||
|
||||
Create (Arr : RealArray from TDataStd)
|
||||
returns mutable DeltaOnModificationOfRealArray from TDataStd;
|
||||
---Purpose: Initializes a TDF_DeltaOnModification.
|
||||
|
||||
Apply (me : mutable)
|
||||
is redefined virtual;
|
||||
---Purpose: Applies the delta to the attribute.
|
||||
fields
|
||||
|
||||
myIndxes : HArray1OfInteger from TColStd;
|
||||
myValues : HArray1OfReal from TColStd;
|
||||
myUp1 : Integer from Standard;
|
||||
myUp2 : Integer from Standard;
|
||||
|
||||
end DeltaOnModificationOfRealArray;
|
163
src/TDataStd/TDataStd_DeltaOnModificationOfRealArray.cxx
Executable file
163
src/TDataStd/TDataStd_DeltaOnModificationOfRealArray.cxx
Executable file
@@ -0,0 +1,163 @@
|
||||
// File: TDataStd_DeltaOnModificationOfRealArray.cxx
|
||||
// Created: Tue Oct 30 16:57:38 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
#include <TDataStd_DeltaOnModificationOfRealArray.ixx>
|
||||
#include <TDataStd_RealArray.hxx>
|
||||
#include <TDF_DeltaOnModification.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TColStd_HArray1OfReal.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TDF_AttributeIterator.hxx>
|
||||
#ifdef DEB
|
||||
#define MAXUP 1000
|
||||
#endif
|
||||
//=======================================================================
|
||||
//function : TDataStd_DeltaOnModificationOfRealArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_DeltaOnModificationOfRealArray::
|
||||
TDataStd_DeltaOnModificationOfRealArray(const Handle(TDataStd_RealArray)& OldAtt)
|
||||
: TDF_DeltaOnModification(OldAtt)
|
||||
{
|
||||
Handle(TDataStd_RealArray) CurrAtt;
|
||||
if (Label().FindAttribute(OldAtt->ID(),CurrAtt)) {
|
||||
Handle(TColStd_HArray1OfReal) Arr1, Arr2;
|
||||
Arr1 = OldAtt->Array();
|
||||
Arr2 = CurrAtt->Array();
|
||||
#ifdef DEB
|
||||
if(Arr1.IsNull())
|
||||
cout <<"DeltaOnModificationOfRealArray:: Old Array is Null" <<endl;
|
||||
if(Arr2.IsNull())
|
||||
cout <<"DeltaOnModificationOfRealArray:: Current Array is Null" <<endl;
|
||||
#endif
|
||||
|
||||
if(Arr1.IsNull() || Arr2.IsNull()) return;
|
||||
if(Arr1 != Arr2) {
|
||||
myUp1 = Arr1->Upper();
|
||||
myUp2 = Arr2->Upper();
|
||||
Standard_Integer i, N =0, aCase=0;
|
||||
if(myUp1 == myUp2)
|
||||
{aCase = 1; N = myUp1;}
|
||||
else if(myUp1 < myUp2)
|
||||
{aCase = 2; N = myUp1;}
|
||||
else
|
||||
{aCase = 3; N = myUp2;}//Up1 > Up2
|
||||
|
||||
TColStd_ListOfInteger aList;
|
||||
for(i=Arr1->Lower();i <= N; i++)
|
||||
if(Arr1->Value(i) != Arr2->Value(i))
|
||||
aList.Append(i);
|
||||
if(aCase == 3) {
|
||||
for(i = N+1;i <= myUp1; i++)
|
||||
aList.Append(i);
|
||||
}
|
||||
if(aList.Extent()) {
|
||||
myIndxes = new TColStd_HArray1OfInteger(1,aList.Extent());
|
||||
myValues = new TColStd_HArray1OfReal(1,aList.Extent());
|
||||
TColStd_ListIteratorOfListOfInteger anIt(aList);
|
||||
for(i =1;anIt.More();anIt.Next(),i++) {
|
||||
myIndxes->SetValue(i, anIt.Value());
|
||||
myValues->SetValue(i, Arr1->Value(anIt.Value()));
|
||||
}
|
||||
}
|
||||
}
|
||||
OldAtt->RemoveArray();
|
||||
#ifdef DEB
|
||||
if(OldAtt->Array().IsNull())
|
||||
cout << "BackUp Arr is Nullified" << endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Apply
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_DeltaOnModificationOfRealArray::Apply()
|
||||
{
|
||||
|
||||
Handle(TDF_Attribute) TDFAttribute = Attribute();
|
||||
Handle(TDataStd_RealArray) BackAtt = (*((Handle(TDataStd_RealArray)*)&TDFAttribute));
|
||||
if(BackAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfRealArray::Apply: OldAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
Handle(TDataStd_RealArray) aCurAtt;
|
||||
if (!Label().FindAttribute(BackAtt->ID(),aCurAtt)) {
|
||||
|
||||
Label().AddAttribute(BackAtt);
|
||||
}
|
||||
|
||||
if(aCurAtt.IsNull()) {
|
||||
#ifdef DEB
|
||||
cout << "DeltaOnModificationOfRealArray::Apply: CurAtt is Null" <<endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
aCurAtt->Backup();
|
||||
|
||||
Standard_Integer aCase;
|
||||
if(myUp1 == myUp2)
|
||||
aCase = 1;
|
||||
else if(myUp1 < myUp2)
|
||||
aCase = 2;
|
||||
else
|
||||
aCase = 3;//Up1 > Up2
|
||||
|
||||
if (aCase == 1 && (myIndxes.IsNull() || myValues.IsNull()))
|
||||
return;
|
||||
|
||||
Standard_Integer i;
|
||||
Handle(TColStd_HArray1OfReal) aRealArr = aCurAtt->Array();
|
||||
if(aRealArr.IsNull()) return;
|
||||
if(aCase == 1)
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
aRealArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
else if(aCase == 2) {
|
||||
Handle(TColStd_HArray1OfReal) realArr = new TColStd_HArray1OfReal(aRealArr->Lower(), myUp1);
|
||||
for(i = aRealArr->Lower(); i <= myUp1 && i <= aRealArr->Upper(); i++)
|
||||
realArr->SetValue(i, aRealArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++)
|
||||
realArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
aCurAtt->myValue = realArr;
|
||||
}
|
||||
else { // == 3
|
||||
Standard_Integer low = aRealArr->Lower();
|
||||
Handle(TColStd_HArray1OfReal) realArr = new TColStd_HArray1OfReal(low, myUp1);
|
||||
for(i = aRealArr->Lower(); i <= myUp2 && i <= aRealArr->Upper(); i++)
|
||||
realArr->SetValue(i, aRealArr->Value(i));
|
||||
if(!myIndxes.IsNull() && !myValues.IsNull())
|
||||
for(i = 1; i <= myIndxes->Upper();i++) {
|
||||
#ifdef DEB
|
||||
cout << "i = " << i << " myIndxes->Upper = " << myIndxes->Upper() << endl;
|
||||
cout << "myIndxes->Value(i) = " << myIndxes->Value(i) << endl;
|
||||
cout << "myValues->Value(i) = " << myValues->Value(i) << endl;
|
||||
#endif
|
||||
realArr->ChangeArray1().SetValue(myIndxes->Value(i), myValues->Value(i));
|
||||
}
|
||||
aCurAtt->myValue = realArr;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEB
|
||||
cout << " << RealArray Dump after Delta Apply >>" <<endl;
|
||||
Handle(TColStd_HArray1OfReal) aRArr = aCurAtt->Array();
|
||||
for(i=aRArr->Lower(); i<=aRArr->Upper() && i <= MAXUP;i++)
|
||||
cout << aRArr->Value(i) << " ";
|
||||
cout <<endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
85
src/TDataStd/TDataStd_Directory.cdl
Executable file
85
src/TDataStd/TDataStd_Directory.cdl
Executable file
@@ -0,0 +1,85 @@
|
||||
-- File: TDataStd_Directory.cdl
|
||||
-- Created: Fri Jun 25 13:59:31 1999
|
||||
-- Author: Sergey RUIN
|
||||
-- <s-ruin@nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
|
||||
class Directory from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Associates a directory in the data framework with
|
||||
-- a TDataStd_TagSource attribute.
|
||||
-- You can create a new directory label and add
|
||||
-- sub-directory or object labels to it,
|
||||
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF
|
||||
is
|
||||
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
|
||||
Find (myclass; current : Label from TDF; D : in out Directory from TDataStd)
|
||||
---Purpose: Searches for a directory attribute on the label
|
||||
-- current, or on one of the father labels of current.
|
||||
-- If a directory attribute is found, true is returned,
|
||||
-- and the attribute found is set as D.
|
||||
returns Boolean from Standard;
|
||||
|
||||
New (myclass; label : Label from TDF)
|
||||
---Purpose: Creates an enpty Directory attribute, located at
|
||||
-- <label>. Raises if <label> has attribute
|
||||
returns Directory from TDataStd;
|
||||
|
||||
AddDirectory (myclass; dir : Directory from TDataStd)
|
||||
---Purpose: Creates a new sub-label and sets the
|
||||
-- sub-directory dir on that label.
|
||||
returns Directory from TDataStd;
|
||||
|
||||
MakeObjectLabel (myclass; dir : Directory from TDataStd)
|
||||
---Purpose: Makes new label and returns it to insert
|
||||
-- other object attributes (sketch,part...etc...)
|
||||
returns Label from TDF;
|
||||
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
|
||||
---Purpose: Directory methods
|
||||
-- ===============
|
||||
|
||||
Create
|
||||
returns mutable Directory from TDataStd;
|
||||
|
||||
---Category: methodes de TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable 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 &
|
||||
|
||||
end Directory;
|
157
src/TDataStd/TDataStd_Directory.cxx
Executable file
157
src/TDataStd/TDataStd_Directory.cxx
Executable file
@@ -0,0 +1,157 @@
|
||||
// File: TDataStd_Directory.cxx
|
||||
// Created: Fri Jun 25 14:42:27 1999
|
||||
// Author: Sergey RUIN
|
||||
|
||||
|
||||
#include <TDataStd_Directory.ixx>
|
||||
#include <TDataStd.hxx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Find
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Directory::Find (const TDF_Label& current,
|
||||
Handle(TDataStd_Directory)& D)
|
||||
{
|
||||
TDF_Label L = current;
|
||||
Handle(TDataStd_Directory) dir;
|
||||
if (L.IsNull()) return Standard_False;
|
||||
|
||||
while (1) {
|
||||
if(L.FindAttribute(TDataStd_Directory::GetID(), dir)) break;
|
||||
L = L.Father();
|
||||
if (L.IsNull()) break;
|
||||
}
|
||||
|
||||
if (!dir.IsNull()) {
|
||||
D = dir;
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Directory::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_DirectoryID("2a96b61f-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_DirectoryID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : New
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Directory) TDataStd_Directory::New (const TDF_Label& L)
|
||||
{
|
||||
if (L.HasAttribute()) {
|
||||
Standard_DomainError::Raise("TDataStd_Directory::New : not an empty label");
|
||||
}
|
||||
Handle(TDataStd_Directory) A = new TDataStd_Directory ();
|
||||
L.AddAttribute(A);
|
||||
TDF_TagSource::Set(L);
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_AddDirectory
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Directory) TDataStd_Directory::AddDirectory(const Handle(TDataStd_Directory)& dir)
|
||||
{
|
||||
TDF_Label newLabel = TDF_TagSource::NewChild ( dir->Label() );
|
||||
Handle(TDataStd_Directory) A = TDataStd_Directory::New (newLabel );
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_MakeObjectLabel
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDF_Label TDataStd_Directory::MakeObjectLabel(const Handle(TDataStd_Directory)& dir)
|
||||
{
|
||||
return TDF_TagSource::NewChild ( dir->Label() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Directory
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Directory::TDataStd_Directory()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Directory::ID() const
|
||||
{ return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Directory::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_Directory();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Directory::Restore(const Handle(TDF_Attribute)& with)
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Directory::Paste (const Handle(TDF_Attribute)& into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : References
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Directory::References (const Handle(TDF_DataSet)& DS) const
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Directory::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Directory";
|
||||
return anOS;
|
||||
}
|
||||
|
||||
|
89
src/TDataStd/TDataStd_Expression.cdl
Executable file
89
src/TDataStd/TDataStd_Expression.cdl
Executable file
@@ -0,0 +1,89 @@
|
||||
-- File: TDataStd_Expression.cdl
|
||||
-- Created: Tue Dec 16 17:32:53 1997
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class Expression from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Expression attribute.
|
||||
-- ====================
|
||||
--
|
||||
-- * Data Structure of the Expression is stored in a
|
||||
-- string and references to variables used by the string
|
||||
--
|
||||
-- Warning: To be consistent, each Variable referenced by the
|
||||
-- expression must have its equivalent in the string
|
||||
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
Real from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
ExtendedString from TCollection,
|
||||
AttributeList 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, an Expression attribute.
|
||||
returns Expression from TDataStd;
|
||||
|
||||
---Purpose: Expressionmethods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Expression from TDataStd;
|
||||
|
||||
Name (me)
|
||||
---Purpose: build and return the expression name
|
||||
returns ExtendedString from TCollection;
|
||||
|
||||
SetExpression (me : mutable; E : ExtendedString from TCollection);
|
||||
|
||||
GetExpression (me)
|
||||
returns ExtendedString from TCollection;
|
||||
---C++: return const &
|
||||
|
||||
GetVariables (me : mutable)
|
||||
---C++: return &
|
||||
returns AttributeList 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 mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
fields
|
||||
|
||||
myExpression : ExtendedString from TCollection;
|
||||
myVariables : AttributeList from TDF;
|
||||
|
||||
end Expression;
|
156
src/TDataStd/TDataStd_Expression.cxx
Executable file
156
src/TDataStd/TDataStd_Expression.cxx
Executable file
@@ -0,0 +1,156 @@
|
||||
// File: TDataStd_Expression.cxx
|
||||
// Created: Tue Dec 16 17:33:32 1997
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_Expression.ixx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDataStd_Variable.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Expression::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_ExpressionID("ce24146a-8e57-11d1-8953-080009dc4425");
|
||||
return TDataStd_ExpressionID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Expression) TDataStd_Expression::Set(const TDF_Label& L)
|
||||
{
|
||||
Handle(TDataStd_Expression) A;
|
||||
if (!L.FindAttribute (TDataStd_Expression::GetID(), A)) {
|
||||
A = new TDataStd_Expression ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Expression
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Expression::TDataStd_Expression()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TCollection_ExtendedString TDataStd_Expression::Name () const
|
||||
{
|
||||
return myExpression; // ->String();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetExpression
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Expression::SetExpression(const TCollection_ExtendedString& E)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myExpression == E) return;
|
||||
|
||||
Backup();
|
||||
myExpression = E;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetExpression
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TCollection_ExtendedString& TDataStd_Expression::GetExpression () const
|
||||
{
|
||||
return myExpression;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDF_AttributeList& TDataStd_Expression::GetVariables()
|
||||
{
|
||||
return myVariables;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Expression::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Expression::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_Expression) EXPR = Handle(TDataStd_Expression)::DownCast (With);
|
||||
myExpression = EXPR->GetExpression();
|
||||
|
||||
Handle(TDataStd_Variable) V;
|
||||
for (TDF_ListIteratorOfAttributeList it (EXPR->GetVariables()); it.More(); it.Next()) {
|
||||
V = Handle(TDataStd_Variable)::DownCast(it.Value());
|
||||
myVariables.Append(V);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Expression::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Expression();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Expression::Paste(const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_Expression) EXPR = Handle(TDataStd_Expression)::DownCast (Into);
|
||||
EXPR->SetExpression(myExpression);
|
||||
Handle(TDataStd_Variable) V1,V2;
|
||||
for (TDF_ListIteratorOfAttributeList it (myVariables); it.More(); it.Next()) {
|
||||
V1 = Handle(TDataStd_Variable)::DownCast(it.Value());
|
||||
RT->HasRelocation (V1,V2);
|
||||
EXPR->GetVariables().Append(V2);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Expression::Dump(Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Expression";
|
||||
return anOS;
|
||||
}
|
||||
|
126
src/TDataStd/TDataStd_ExtStringArray.cdl
Executable file
126
src/TDataStd/TDataStd_ExtStringArray.cdl
Executable file
@@ -0,0 +1,126 @@
|
||||
-- File: TDataStd_ExtStringArray.cdl
|
||||
-- Created: Wed Jan 16 10:10:33 2002
|
||||
-- Author: Michael PONIKAROV
|
||||
-- <mpv@covox>
|
||||
---Copyright: Matra Datavision 2002
|
||||
|
||||
class ExtStringArray from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: ExtStringArray Attribute. Handles an
|
||||
-- array of UNICODE strings (represented by the
|
||||
-- TCollection_ExtendedString class).
|
||||
|
||||
uses GUID from Standard,
|
||||
ExtendedString from TCollection,
|
||||
HArray1OfExtendedString from TColStd,
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
DeltaOnModification from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for the attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF; lower, upper : Integer from Standard;
|
||||
isDelta : Boolean from Standard = Standard_False)
|
||||
---Purpose: Finds, or creates, an ExtStringArray attribute with <lower>
|
||||
-- and <upper> bounds. The ExtStringArray attribute is returned.
|
||||
-- If <isDelta> == False, DefaultDeltaOnModification is used.
|
||||
-- If attribute is already set, all input parameters are refused
|
||||
-- and the found attribute is returned.
|
||||
returns ExtStringArray from TDataStd;
|
||||
|
||||
|
||||
---Category: ExtStringArray methods
|
||||
-- ===============
|
||||
|
||||
Init(me : mutable; lower, upper : Integer from Standard);
|
||||
---Purpose: Initializes the inner array with bounds from <lower> to <upper>
|
||||
|
||||
SetValue (me : mutable; Index : Integer from Standard; Value : ExtendedString from TCollection);
|
||||
---Purpose: Sets the <Index>th element of the array to <Value>
|
||||
|
||||
Value (me; Index : Integer from Standard)
|
||||
---Purpose: Returns the value of the <Index>th element of the array
|
||||
--
|
||||
---C++: alias operator ()
|
||||
returns ExtendedString from TCollection;
|
||||
|
||||
Lower (me) returns Integer from Standard;
|
||||
---Purpose: Return the lower bound.
|
||||
|
||||
Upper (me) returns Integer from Standard;
|
||||
---Purpose: Return the upper bound
|
||||
|
||||
Length (me) returns Integer from Standard;
|
||||
---Purpose: Return the number of elements of <me>.
|
||||
|
||||
ChangeArray(me : mutable; newArray : HArray1OfExtendedString from TColStd;
|
||||
isCheckItems : Boolean = Standard_True);
|
||||
---Purpose: Sets the inner array <myValue> of the ExtStringArray attribute to <newArray>.
|
||||
-- If value of <newArray> differs from <myValue>, Backup performed and myValue
|
||||
-- refers to new instance of HArray1OfExtendedString that holds <newArray> values
|
||||
-- If <isCheckItems> equal True each item of <newArray> will be checked with each
|
||||
-- item of <myValue> for coincidence (to avoid backup).
|
||||
|
||||
Array(me) returns HArray1OfExtendedString from TColStd;
|
||||
---Purpose: Return the inner array of the ExtStringArray attribute
|
||||
---C++: inline
|
||||
---C++: return const
|
||||
|
||||
GetDelta(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetDelta(me : mutable; isDelta : Boolean from Standard);
|
||||
---C++: inline
|
||||
---Purpose: for internal use only!
|
||||
|
||||
RemoveArray(me : mutable) is private;
|
||||
---C++: inline
|
||||
|
||||
---Category: methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
Create returns mutable ExtStringArray from TDataStd;
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
---Category: methods to be added for using in DeltaOn Modification
|
||||
-- =====================================================
|
||||
DeltaOnModification(me; anOldAttribute : Attribute from TDF)
|
||||
returns DeltaOnModification from TDF
|
||||
---Purpose : Makes a DeltaOnModification between <me> and
|
||||
-- <anOldAttribute>.
|
||||
is redefined virtual;
|
||||
|
||||
fields
|
||||
|
||||
myValue : HArray1OfExtendedString from TColStd;
|
||||
myIsDelta : Boolean from Standard;
|
||||
|
||||
friends
|
||||
class DeltaOnModificationOfExtStringArray from TDataStd
|
||||
|
||||
end ExtStringArray;
|
261
src/TDataStd/TDataStd_ExtStringArray.cxx
Executable file
261
src/TDataStd/TDataStd_ExtStringArray.cxx
Executable file
@@ -0,0 +1,261 @@
|
||||
// File: TDataStd_ExtStringArray.cxx
|
||||
// Created: Wed Jan 16 10:10:40 2002
|
||||
// Author: Michael PONIKAROV
|
||||
// <mpv@covox>
|
||||
|
||||
|
||||
#include <TDataStd_ExtStringArray.ixx>
|
||||
#include <TDataStd_DeltaOnModificationOfExtStringArray.hxx>
|
||||
#include <TDF_DefaultDeltaOnModification.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_ExtStringArray::GetID()
|
||||
{
|
||||
static Standard_GUID anExtStringArrayID ("2a96b624-ec8b-11d0-bee7-080009dc3333");
|
||||
return anExtStringArrayID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ExtStringArray::TDataStd_ExtStringArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_ExtStringArray::TDataStd_ExtStringArray()
|
||||
: myIsDelta(Standard_False){}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ExtStringArray::Init(const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Backup();
|
||||
myValue = new TColStd_HArray1OfExtendedString(lower, upper, "");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_ExtStringArray) TDataStd_ExtStringArray::Set (
|
||||
const TDF_Label& label,
|
||||
const Standard_Integer lower,
|
||||
const Standard_Integer upper,
|
||||
const Standard_Boolean isDelta)
|
||||
|
||||
{
|
||||
Handle(TDataStd_ExtStringArray) A;
|
||||
if (!label.FindAttribute (TDataStd_ExtStringArray::GetID(), A)) {
|
||||
A = new TDataStd_ExtStringArray;
|
||||
A->Init (lower, upper);
|
||||
A->SetDelta(isDelta);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
else if (lower != A->Lower() || upper != A->Upper())
|
||||
{
|
||||
A->Init (lower, upper);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ExtStringArray::SetValue(const Standard_Integer index, const TCollection_ExtendedString& value)
|
||||
{
|
||||
if(myValue.IsNull()) return;
|
||||
if( myValue->Value(index) == value)
|
||||
return;
|
||||
|
||||
Backup();
|
||||
myValue->SetValue(index, value);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TCollection_ExtendedString TDataStd_ExtStringArray::Value (const Standard_Integer index) const
|
||||
{
|
||||
if(myValue.IsNull()) return TCollection_ExtendedString();
|
||||
return myValue->Value(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Lower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ExtStringArray::Lower (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Lower();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Upper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ExtStringArray::Upper (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Upper();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ExtStringArray::Length (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Length();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeArray
|
||||
//purpose : If value of <newArray> differs from <myValue>, Backup
|
||||
// : performed and myValue refers to new instance of HArray1OfExtendedString
|
||||
// : that holds <newArray>
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ExtStringArray::ChangeArray(const Handle(TColStd_HArray1OfExtendedString)& newArray,
|
||||
const Standard_Boolean isCheckItems)
|
||||
{
|
||||
Standard_Integer aLower = newArray->Lower();
|
||||
Standard_Integer anUpper = newArray->Upper();
|
||||
Standard_Boolean aDimEqual = Standard_False;
|
||||
Standard_Integer i;
|
||||
|
||||
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
|
||||
aDimEqual = Standard_True;
|
||||
Standard_Boolean isEqual = Standard_True;
|
||||
if(isCheckItems) {
|
||||
for(i = aLower; i <= anUpper; i++) {
|
||||
if(myValue->Value(i) != newArray->Value(i)) {
|
||||
isEqual = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isEqual)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Backup();
|
||||
|
||||
// Handles of myValue of current and backuped attributes will be different!!!
|
||||
if(!aDimEqual)
|
||||
myValue = new TColStd_HArray1OfExtendedString(aLower, anUpper);
|
||||
|
||||
for(i = aLower; i <= anUpper; i++)
|
||||
myValue->SetValue(i, newArray->Value(i));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_ExtStringArray::ID () const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_ExtStringArray::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_ExtStringArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ExtStringArray::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Standard_Integer i, lower, upper;
|
||||
Handle(TDataStd_ExtStringArray) anArray = Handle(TDataStd_ExtStringArray)::DownCast(With);
|
||||
if(!anArray->myValue.IsNull()) {
|
||||
lower = anArray->Lower();
|
||||
upper = anArray->Upper();
|
||||
myValue = new TColStd_HArray1OfExtendedString(lower, upper);
|
||||
for(i = lower; i<=upper; i++)
|
||||
myValue->SetValue(i, anArray->Value(i));
|
||||
myIsDelta = anArray->myIsDelta;
|
||||
}
|
||||
else
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_ExtStringArray::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
if(!myValue.IsNull()) {
|
||||
Handle(TDataStd_ExtStringArray) anAtt = Handle(TDataStd_ExtStringArray)::DownCast(Into);
|
||||
if(!anAtt.IsNull()) {
|
||||
anAtt->ChangeArray( myValue, Standard_False );
|
||||
anAtt->SetDelta(myIsDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_ExtStringArray::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "ExtStringArray :";
|
||||
if(!myValue.IsNull()) {
|
||||
Standard_Integer i, lower, upper;
|
||||
lower = myValue->Lower();
|
||||
upper = myValue->Upper();
|
||||
for(i = lower; i<=upper; i++)
|
||||
anOS << "\t" <<myValue->Value(i)<<endl;
|
||||
}
|
||||
anOS << " Delta is " << myIsDelta ? "ON":"OFF";
|
||||
anOS << endl;
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeltaOnModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_DeltaOnModification) TDataStd_ExtStringArray::DeltaOnModification
|
||||
(const Handle(TDF_Attribute)& OldAttribute) const
|
||||
{
|
||||
if(myIsDelta)
|
||||
return new TDataStd_DeltaOnModificationOfExtStringArray(*((Handle(TDataStd_ExtStringArray)*)&OldAttribute));
|
||||
else return new TDF_DefaultDeltaOnModification(OldAttribute);
|
||||
}
|
||||
|
43
src/TDataStd/TDataStd_ExtStringArray.lxx
Executable file
43
src/TDataStd/TDataStd_ExtStringArray.lxx
Executable file
@@ -0,0 +1,43 @@
|
||||
// File: TDataStd_ExtStringArray.lxx
|
||||
// Created: Tue Dec 4 17:05:05 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
|
||||
#include <TColStd_HArray1OfExtendedString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Array
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(TColStd_HArray1OfExtendedString) TDataStd_ExtStringArray::Array(void) const
|
||||
{
|
||||
return myValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_ExtStringArray::RemoveArray(void)
|
||||
{
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_ExtStringArray::SetDelta(const Standard_Boolean isDelta)
|
||||
{
|
||||
myIsDelta = isDelta;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_ExtStringArray::GetDelta(void) const
|
||||
{
|
||||
return myIsDelta;
|
||||
}
|
111
src/TDataStd/TDataStd_ExtStringList.cdl
Executable file
111
src/TDataStd/TDataStd_ExtStringList.cdl
Executable file
@@ -0,0 +1,111 @@
|
||||
-- File: TDataStd_ExtStringList.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ExtStringList from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains a list of ExtendedString.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
ExtendedString from TCollection,
|
||||
ListOfExtendedString from TDataStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the list of strings attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Finds or creates a list of string values attribute.
|
||||
returns ExtStringList from TDataStd;
|
||||
|
||||
|
||||
---Category: ExtStringList methods
|
||||
-- =====================
|
||||
|
||||
Create
|
||||
returns mutable ExtStringList from TDataStd;
|
||||
|
||||
IsEmpty (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Extent (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
Prepend (me : mutable;
|
||||
value : ExtendedString from TCollection);
|
||||
|
||||
Append (me : mutable;
|
||||
value : ExtendedString from TCollection);
|
||||
|
||||
InsertBefore (me : mutable;
|
||||
value : ExtendedString from TCollection;
|
||||
before_value : ExtendedString from TCollection)
|
||||
---Purpose: Inserts the <value> before the first meet of <before_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
InsertAfter (me : mutable;
|
||||
value : ExtendedString from TCollection;
|
||||
after_value : ExtendedString from TCollection)
|
||||
---Purpose: Inserts the <value> after the first meet of <after_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Remove (me : mutable;
|
||||
value : ExtendedString from TCollection)
|
||||
---Purpose: Removes the first meet of the <value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Clear (me : mutable);
|
||||
|
||||
First (me)
|
||||
---C++: return const &
|
||||
returns ExtendedString from TCollection;
|
||||
|
||||
Last (me)
|
||||
---C++: return const &
|
||||
returns ExtendedString from TCollection;
|
||||
|
||||
List (me)
|
||||
---C++: return const &
|
||||
returns ListOfExtendedString from TDataStd;
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myList : ListOfExtendedString from TDataStd;
|
||||
|
||||
|
||||
end ExtStringList;
|
235
src/TDataStd/TDataStd_ExtStringList.cxx
Executable file
235
src/TDataStd/TDataStd_ExtStringList.cxx
Executable file
@@ -0,0 +1,235 @@
|
||||
// File: TDataStd_ExtStringList.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_ExtStringList.ixx>
|
||||
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ExtStringList::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_ExtStringListID ("D13FBE0A-E084-4912-A99D-7713C59C0AC4");
|
||||
return TDataStd_ExtStringListID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ExtStringList
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_ExtStringList::TDataStd_ExtStringList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_ExtStringList) TDataStd_ExtStringList::Set(const TDF_Label& label)
|
||||
{
|
||||
Handle(TDataStd_ExtStringList) A;
|
||||
if (!label.FindAttribute (TDataStd_ExtStringList::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_ExtStringList;
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ExtStringList::IsEmpty() const
|
||||
{
|
||||
return myList.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ExtStringList::Extent() const
|
||||
{
|
||||
return myList.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ExtStringList::Prepend(const TCollection_ExtendedString& value)
|
||||
{
|
||||
Backup();
|
||||
myList.Prepend(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ExtStringList::Append(const TCollection_ExtendedString& value)
|
||||
{
|
||||
Backup();
|
||||
myList.Append(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertBefore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ExtStringList::InsertBefore(const TCollection_ExtendedString& value,
|
||||
const TCollection_ExtendedString& before_value)
|
||||
{
|
||||
TDataStd_ListIteratorOfListOfExtendedString itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == before_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertBefore(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertAfter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ExtStringList::InsertAfter(const TCollection_ExtendedString& value,
|
||||
const TCollection_ExtendedString& after_value)
|
||||
{
|
||||
TDataStd_ListIteratorOfListOfExtendedString itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == after_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertAfter(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ExtStringList::Remove(const TCollection_ExtendedString& value)
|
||||
{
|
||||
TDataStd_ListIteratorOfListOfExtendedString itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == value)
|
||||
{
|
||||
Backup();
|
||||
myList.Remove(itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ExtStringList::Clear()
|
||||
{
|
||||
Backup();
|
||||
myList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& TDataStd_ExtStringList::First() const
|
||||
{
|
||||
return myList.First();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& TDataStd_ExtStringList::Last() const
|
||||
{
|
||||
return myList.Last();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : List
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TDataStd_ListOfExtendedString& TDataStd_ExtStringList::List() const
|
||||
{
|
||||
return myList;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ExtStringList::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_ExtStringList::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_ExtStringList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ExtStringList::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myList.Clear();
|
||||
Handle(TDataStd_ExtStringList) aList = Handle(TDataStd_ExtStringList)::DownCast(With);
|
||||
TDataStd_ListIteratorOfListOfExtendedString itr(aList->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
myList.Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ExtStringList::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(TDataStd_ExtStringList) aList = Handle(TDataStd_ExtStringList)::DownCast(Into);
|
||||
aList->Clear();
|
||||
TDataStd_ListIteratorOfListOfExtendedString itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
aList->Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_ExtStringList::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "ExtStringList";
|
||||
return anOS;
|
||||
}
|
37
src/TDataStd/TDataStd_HDataMapOfStringByte.cdl
Executable file
37
src/TDataStd/TDataStd_HDataMapOfStringByte.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: TDataStd_HDataMapOfStringByte.cdl
|
||||
-- Created: Fri Aug 17 16:56:13 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class HDataMapOfStringByte from TDataStd inherits TShared from MMgt
|
||||
|
||||
---Purpose: Extension of TDataStd_DataMapOfStringByte class
|
||||
-- to be manipulated by handle.
|
||||
|
||||
uses
|
||||
DataMapOfStringByte from TDataStd
|
||||
|
||||
is
|
||||
Create( NbBuckets: Integer from Standard = 1 )
|
||||
returns mutable HDataMapOfStringByte from TDataStd;
|
||||
|
||||
Create( theOther: DataMapOfStringByte from TDataStd)
|
||||
returns mutable HDataMapOfStringByte from TDataStd;
|
||||
|
||||
Map( me ) returns DataMapOfStringByte from TDataStd
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
ChangeMap( me: mutable ) returns DataMapOfStringByte from TDataStd
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : DataMapOfStringByte from TDataStd ;
|
||||
|
||||
end HDataMapOfStringByte;
|
25
src/TDataStd/TDataStd_HDataMapOfStringByte.cxx
Executable file
25
src/TDataStd/TDataStd_HDataMapOfStringByte.cxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: TDataStd_HDataMapOfStringByte.cxx
|
||||
// Created: Fri Aug 17 16:58:50 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
#include <TDataStd_HDataMapOfStringByte.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringByte
|
||||
//purpose : Constructor of empty map
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringByte::TDataStd_HDataMapOfStringByte(const Standard_Integer NbBuckets)
|
||||
{
|
||||
myMap.ReSize(NbBuckets);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringByte
|
||||
//purpose : Constructor from already existing map; performs copying
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringByte::TDataStd_HDataMapOfStringByte (const TDataStd_DataMapOfStringByte &theOther)
|
||||
{
|
||||
myMap.Assign ( theOther );
|
||||
}
|
23
src/TDataStd/TDataStd_HDataMapOfStringByte.lxx
Executable file
23
src/TDataStd/TDataStd_HDataMapOfStringByte.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_HDataMapOfStringByte.lxx
|
||||
// Created: Fri Aug 17 17:00:33 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CasCade SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose : Access to the map
|
||||
//=======================================================================
|
||||
inline const TDataStd_DataMapOfStringByte& TDataStd_HDataMapOfStringByte::Map () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose : Access to the map for modification
|
||||
//=======================================================================
|
||||
inline TDataStd_DataMapOfStringByte& TDataStd_HDataMapOfStringByte::ChangeMap ()
|
||||
{
|
||||
return myMap;
|
||||
}
|
37
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfInteger.cdl
Executable file
37
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfInteger.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: TDataStd_HDataMapOfStringHArray1OfInteger.cdl
|
||||
-- Created: Fri Aug 17 17:07:35 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class HDataMapOfStringHArray1OfInteger from TDataStd inherits TShared from MMgt
|
||||
|
||||
---Purpose: Extension of TDataStd_DataMapOfStringHArray1OfInteger class
|
||||
-- to be manipulated by handle.
|
||||
|
||||
uses
|
||||
DataMapOfStringHArray1OfInteger from TDataStd
|
||||
|
||||
is
|
||||
Create( NbBuckets: Integer from Standard = 1 )
|
||||
returns mutable HDataMapOfStringHArray1OfInteger from TDataStd;
|
||||
|
||||
Create( theOther: DataMapOfStringHArray1OfInteger from TDataStd)
|
||||
returns mutable HDataMapOfStringHArray1OfInteger from TDataStd;
|
||||
|
||||
Map( me ) returns DataMapOfStringHArray1OfInteger from TDataStd
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
ChangeMap( me: mutable ) returns DataMapOfStringHArray1OfInteger from TDataStd
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : DataMapOfStringHArray1OfInteger from TDataStd ;
|
||||
|
||||
end HDataMapOfStringHArray1OfInteger;
|
25
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfInteger.cxx
Executable file
25
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfInteger.cxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: TDataStd_HDataMapOfStringHArray1OfInteger.cxx
|
||||
// Created: Fri Aug 17 17:10:36 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
#include <TDataStd_HDataMapOfStringHArray1OfInteger.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringHArray1OfInteger
|
||||
//purpose : Constructor of empty map
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringHArray1OfInteger::TDataStd_HDataMapOfStringHArray1OfInteger(const Standard_Integer NbBuckets)
|
||||
{
|
||||
myMap.ReSize(NbBuckets);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringHArray1OfInteger
|
||||
//purpose : Constructor from already existing map; performs copying
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringHArray1OfInteger::TDataStd_HDataMapOfStringHArray1OfInteger (const TDataStd_DataMapOfStringHArray1OfInteger &theOther)
|
||||
{
|
||||
myMap.Assign ( theOther );
|
||||
}
|
23
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfInteger.lxx
Executable file
23
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfInteger.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_HDataMapOfStringHArray1OfInteger.lxx
|
||||
// Created: Fri Aug 17 17:12:04 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CasCade SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose : Access to the map
|
||||
//=======================================================================
|
||||
inline const TDataStd_DataMapOfStringHArray1OfInteger& TDataStd_HDataMapOfStringHArray1OfInteger::Map () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose : Access to the map for modification
|
||||
//=======================================================================
|
||||
inline TDataStd_DataMapOfStringHArray1OfInteger& TDataStd_HDataMapOfStringHArray1OfInteger::ChangeMap ()
|
||||
{
|
||||
return myMap;
|
||||
}
|
37
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfReal.cdl
Executable file
37
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfReal.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: TDataStd_HDataMapOfStringHArray1OfReal.cdl
|
||||
-- Created: Fri Aug 17 17:24:55 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class HDataMapOfStringHArray1OfReal from TDataStd inherits TShared from MMgt
|
||||
|
||||
---Purpose: Extension of TDataStd_DataMapOfStringHArray1OfReal class
|
||||
-- to be manipulated by handle.
|
||||
|
||||
uses
|
||||
DataMapOfStringHArray1OfReal from TDataStd
|
||||
|
||||
is
|
||||
Create( NbBuckets: Integer from Standard = 1 )
|
||||
returns mutable HDataMapOfStringHArray1OfReal from TDataStd;
|
||||
|
||||
Create( theOther: DataMapOfStringHArray1OfReal from TDataStd)
|
||||
returns mutable HDataMapOfStringHArray1OfReal from TDataStd;
|
||||
|
||||
Map( me ) returns DataMapOfStringHArray1OfReal from TDataStd
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
ChangeMap( me: mutable ) returns DataMapOfStringHArray1OfReal from TDataStd
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : DataMapOfStringHArray1OfReal from TDataStd ;
|
||||
|
||||
end HDataMapOfStringHArray1OfReal;
|
25
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfReal.cxx
Executable file
25
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfReal.cxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: TDataStd_HDataMapOfStringHArray1OfReal.cxx
|
||||
// Created: Fri Aug 17 17:27:26 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
#include <TDataStd_HDataMapOfStringHArray1OfReal.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringHArray1OfReal
|
||||
//purpose : Constructor of empty map
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringHArray1OfReal::TDataStd_HDataMapOfStringHArray1OfReal(const Standard_Integer NbBuckets)
|
||||
{
|
||||
myMap.ReSize(NbBuckets);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringHArray1OfReal
|
||||
//purpose : Constructor from already existing map; performs copying
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringHArray1OfReal::TDataStd_HDataMapOfStringHArray1OfReal (const TDataStd_DataMapOfStringHArray1OfReal &theOther)
|
||||
{
|
||||
myMap.Assign ( theOther );
|
||||
}
|
23
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfReal.lxx
Executable file
23
src/TDataStd/TDataStd_HDataMapOfStringHArray1OfReal.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_HDataMapOfStringHArray1OfReal.lxx
|
||||
// Created: Fri Aug 17 17:29:22 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CasCade SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose : Access to the map
|
||||
//=======================================================================
|
||||
inline const TDataStd_DataMapOfStringHArray1OfReal& TDataStd_HDataMapOfStringHArray1OfReal::Map () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose : Access to the map for modification
|
||||
//=======================================================================
|
||||
inline TDataStd_DataMapOfStringHArray1OfReal& TDataStd_HDataMapOfStringHArray1OfReal::ChangeMap ()
|
||||
{
|
||||
return myMap;
|
||||
}
|
37
src/TDataStd/TDataStd_HDataMapOfStringInteger.cdl
Executable file
37
src/TDataStd/TDataStd_HDataMapOfStringInteger.cdl
Executable file
@@ -0,0 +1,37 @@
|
||||
-- File: TDataStd_HDataMapOfStringInteger.cdl
|
||||
-- Created: Fri Aug 17 16:13:55 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class HDataMapOfStringInteger from TDataStd inherits TShared from MMgt
|
||||
|
||||
---Purpose: Extension of TColStd_DataMapOfStringInteger class
|
||||
-- to be manipulated by handle.
|
||||
|
||||
uses
|
||||
DataMapOfStringInteger from TColStd
|
||||
|
||||
is
|
||||
Create( NbBuckets: Integer from Standard = 1 )
|
||||
returns mutable HDataMapOfStringInteger from TDataStd;
|
||||
|
||||
Create( theOther: DataMapOfStringInteger from TColStd)
|
||||
returns mutable HDataMapOfStringInteger from TDataStd;
|
||||
|
||||
Map( me ) returns DataMapOfStringInteger from TColStd
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
ChangeMap( me: mutable ) returns DataMapOfStringInteger from TColStd
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : DataMapOfStringInteger from TColStd ;
|
||||
|
||||
end HDataMapOfStringInteger;
|
25
src/TDataStd/TDataStd_HDataMapOfStringInteger.cxx
Executable file
25
src/TDataStd/TDataStd_HDataMapOfStringInteger.cxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: TDataStd_HDataMapOfStringInteger.cxx
|
||||
// Created: Fri Aug 17 16:20:53 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
#include <TDataStd_HDataMapOfStringInteger.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringInteger
|
||||
//purpose : Constructor of empty map
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringInteger::TDataStd_HDataMapOfStringInteger(const Standard_Integer NbBuckets)
|
||||
{
|
||||
myMap.ReSize(NbBuckets);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringInteger
|
||||
//purpose : Constructor from already existing map; performs copying
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringInteger::TDataStd_HDataMapOfStringInteger (const TColStd_DataMapOfStringInteger &theOther)
|
||||
{
|
||||
myMap.Assign ( theOther );
|
||||
}
|
23
src/TDataStd/TDataStd_HDataMapOfStringInteger.lxx
Executable file
23
src/TDataStd/TDataStd_HDataMapOfStringInteger.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_HDataMapOfStringInteger.lxx
|
||||
// Created: Fri Aug 17 16:26:51 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CasCade SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose : Access to the map
|
||||
//=======================================================================
|
||||
inline const TColStd_DataMapOfStringInteger& TDataStd_HDataMapOfStringInteger::Map () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose : Access to the map for modification
|
||||
//=======================================================================
|
||||
inline TColStd_DataMapOfStringInteger& TDataStd_HDataMapOfStringInteger::ChangeMap ()
|
||||
{
|
||||
return myMap;
|
||||
}
|
38
src/TDataStd/TDataStd_HDataMapOfStringReal.cdl
Executable file
38
src/TDataStd/TDataStd_HDataMapOfStringReal.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: TDataStd_HDataMapOfStringReal.cdl
|
||||
-- Created: Fri Aug 17 16:37:57 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class HDataMapOfStringReal from TDataStd inherits TShared from MMgt
|
||||
|
||||
---Purpose:Extension of TDataStd_DataMapOfStringReal class
|
||||
-- to be manipulated by handle.
|
||||
|
||||
uses
|
||||
DataMapOfStringReal from TDataStd
|
||||
|
||||
is
|
||||
Create( NbBuckets: Integer from Standard = 1 )
|
||||
returns mutable HDataMapOfStringReal from TDataStd;
|
||||
|
||||
Create( theOther: DataMapOfStringReal from TDataStd)
|
||||
returns mutable HDataMapOfStringReal from TDataStd;
|
||||
|
||||
Map( me ) returns DataMapOfStringReal from TDataStd
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
ChangeMap( me: mutable ) returns DataMapOfStringReal from TDataStd
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : DataMapOfStringReal from TDataStd ;
|
||||
|
||||
|
||||
end HDataMapOfStringReal;
|
24
src/TDataStd/TDataStd_HDataMapOfStringReal.cxx
Executable file
24
src/TDataStd/TDataStd_HDataMapOfStringReal.cxx
Executable file
@@ -0,0 +1,24 @@
|
||||
// File: TDataStd_HDataMapOfStringReal.cxx
|
||||
// Created: Fri Aug 17 16:41:04 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
#include <TDataStd_HDataMapOfStringReal.ixx>
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringReal
|
||||
//purpose : Constructor of empty map
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringReal::TDataStd_HDataMapOfStringReal(const Standard_Integer NbBuckets)
|
||||
{
|
||||
myMap.ReSize(NbBuckets);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringReal
|
||||
//purpose : Constructor from already existing map; performs copying
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringReal::TDataStd_HDataMapOfStringReal (const TDataStd_DataMapOfStringReal &theOther)
|
||||
{
|
||||
myMap.Assign ( theOther );
|
||||
}
|
23
src/TDataStd/TDataStd_HDataMapOfStringReal.lxx
Executable file
23
src/TDataStd/TDataStd_HDataMapOfStringReal.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_HDataMapOfStringReal.lxx
|
||||
// Created: Fri Aug 17 16:42:38 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CasCade SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose : Access to the map
|
||||
//=======================================================================
|
||||
inline const TDataStd_DataMapOfStringReal& TDataStd_HDataMapOfStringReal::Map () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose : Access to the map for modification
|
||||
//=======================================================================
|
||||
inline TDataStd_DataMapOfStringReal& TDataStd_HDataMapOfStringReal::ChangeMap ()
|
||||
{
|
||||
return myMap;
|
||||
}
|
38
src/TDataStd/TDataStd_HDataMapOfStringString.cdl
Executable file
38
src/TDataStd/TDataStd_HDataMapOfStringString.cdl
Executable file
@@ -0,0 +1,38 @@
|
||||
-- File: TDataStd_HDataMapOfStringString.cdl
|
||||
-- Created: Fri Aug 17 16:50:27 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <szy@popox.nnov.matra-dtv.fr>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class HDataMapOfStringString from TDataStd inherits TShared from MMgt
|
||||
|
||||
---Purpose: Extension of TDataStd_DataMapOfStringString class
|
||||
-- to be manipulated by handle.
|
||||
|
||||
uses
|
||||
DataMapOfStringString from TDataStd
|
||||
|
||||
is
|
||||
Create( NbBuckets: Integer from Standard = 1 )
|
||||
returns mutable HDataMapOfStringString from TDataStd;
|
||||
|
||||
Create( theOther: DataMapOfStringString from TDataStd)
|
||||
returns mutable HDataMapOfStringString from TDataStd;
|
||||
|
||||
Map( me ) returns DataMapOfStringString from TDataStd
|
||||
---C++: return const &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
ChangeMap( me: mutable ) returns DataMapOfStringString from TDataStd
|
||||
---C++: return &
|
||||
---C++: inline
|
||||
is static;
|
||||
|
||||
fields
|
||||
|
||||
myMap : DataMapOfStringString from TDataStd ;
|
||||
|
||||
|
||||
end HDataMapOfStringString;
|
25
src/TDataStd/TDataStd_HDataMapOfStringString.cxx
Executable file
25
src/TDataStd/TDataStd_HDataMapOfStringString.cxx
Executable file
@@ -0,0 +1,25 @@
|
||||
// File: TDataStd_HDataMapOfStringString.cxx
|
||||
// Created: Fri Aug 17 16:53:03 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
#include <TDataStd_HDataMapOfStringString.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringString
|
||||
//purpose : Constructor of empty map
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringString::TDataStd_HDataMapOfStringString(const Standard_Integer NbBuckets)
|
||||
{
|
||||
myMap.ReSize(NbBuckets);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_HDataMapOfStringString
|
||||
//purpose : Constructor from already existing map; performs copying
|
||||
//=======================================================================
|
||||
TDataStd_HDataMapOfStringString::TDataStd_HDataMapOfStringString (const TDataStd_DataMapOfStringString &theOther)
|
||||
{
|
||||
myMap.Assign ( theOther );
|
||||
}
|
23
src/TDataStd/TDataStd_HDataMapOfStringString.lxx
Executable file
23
src/TDataStd/TDataStd_HDataMapOfStringString.lxx
Executable file
@@ -0,0 +1,23 @@
|
||||
// File: TDataStd_HDataMapOfStringString.lxx
|
||||
// Created: Fri Aug 17 16:54:56 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open Cascade SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : Map
|
||||
//purpose : Access to the map
|
||||
//=======================================================================
|
||||
inline const TDataStd_DataMapOfStringString& TDataStd_HDataMapOfStringString::Map () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose : Access to the map for modification
|
||||
//=======================================================================
|
||||
inline TDataStd_DataMapOfStringString& TDataStd_HDataMapOfStringString::ChangeMap ()
|
||||
{
|
||||
return myMap;
|
||||
}
|
143
src/TDataStd/TDataStd_IntPackedMap.cdl
Executable file
143
src/TDataStd/TDataStd_IntPackedMap.cdl
Executable file
@@ -0,0 +1,143 @@
|
||||
-- File: TDataStd_IntPackedMap.cdl
|
||||
-- Created: Tue Jul 31 15:30:36 2007
|
||||
-- Author: Sergey ZARITCHNY
|
||||
-- <sergey.zaritchny@opencascade.com>
|
||||
---Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
class IntPackedMap from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Attribute for storing TColStd_PackedMapOfInteger
|
||||
|
||||
uses
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
PackedMapOfInteger from TColStd,
|
||||
HPackedMapOfInteger from TColStd,
|
||||
DeltaOnModification from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID of the attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF; isDelta : Boolean from Standard = Standard_False)
|
||||
---Purpose: Finds or creates an integer map attribute on the given label.
|
||||
-- If <isDelta> == False, DefaultDeltaOnModification is used.
|
||||
-- If <isDelta> == True, DeltaOnModification of the current attribute is used.
|
||||
-- If attribute is already set, input parameter <isDelta> is refused and the found
|
||||
-- attribute returned.
|
||||
returns IntPackedMap from TDataStd;
|
||||
|
||||
---Purpose: Attribute methods
|
||||
-- ===================
|
||||
|
||||
Create
|
||||
returns mutable IntPackedMap from TDataStd;
|
||||
-- Constructor
|
||||
|
||||
ChangeMap (me : mutable; theMap : HPackedMapOfInteger from TColStd)
|
||||
-- Sets the inner map to theMap. If the content of theMap is the same as myMap,
|
||||
-- it does nothing and return false. Else full backup is performed.
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetMap (me)
|
||||
returns PackedMapOfInteger from TColStd;
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
-- Access to the const interface of the map
|
||||
|
||||
GetHMap (me)
|
||||
returns HPackedMapOfInteger from TColStd;
|
||||
---C++: inline
|
||||
---C++: return const &
|
||||
-- Access to the handle of the map.
|
||||
-- WARNING! do not use the handle returned by this method to modify the map,
|
||||
-- otherwise undo/redo mechanism will be failed.
|
||||
|
||||
Clear(me : mutable)
|
||||
returns Boolean from Standard;
|
||||
-- Clears the inner map. Returns false if map is alredy empty.
|
||||
|
||||
Add(me : mutable; theKey : Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
-- Adds a new key to the map. Returns false if this key already exists.
|
||||
|
||||
Remove(me : mutable; theKey : Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
-- Removes the key from the map. Returns false if this key was not found.
|
||||
|
||||
Contains(me; theKey : Integer from Standard)
|
||||
returns Boolean from Standard;
|
||||
-- Returns true if the key contains in the map, false otherwise
|
||||
|
||||
Extent(me)
|
||||
---C++: inline
|
||||
returns Integer from Standard;
|
||||
-- Returns the size of the map
|
||||
|
||||
IsEmpty(me)
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetDelta(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetDelta(me : mutable; isDelta : Boolean from Standard);
|
||||
---C++: inline
|
||||
---Purpose: for internal use only!
|
||||
|
||||
RemoveMap(me : mutable) is private;
|
||||
---C++: inline
|
||||
---Category: TDF_Attribute methods
|
||||
-- =====================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
-- Restores the backuped content from <with> into this one.
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
-- Returns an new empty AsciiString attribute.
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
-- This method is used when copying an attribute from a source structure
|
||||
-- into a target structure.
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
-- This method dumps the attribute value into the stream
|
||||
|
||||
---Category: methods to be added for using in DeltaOn Modification
|
||||
-- =====================================================
|
||||
DeltaOnModification(me; anOldAttribute : Attribute from TDF)
|
||||
returns DeltaOnModification from TDF
|
||||
---Purpose : Makes a DeltaOnModification between <me> and
|
||||
-- <anOldAttribute>.
|
||||
is redefined virtual;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myMap : HPackedMapOfInteger from TColStd;
|
||||
myIsDelta : Boolean from Standard;
|
||||
|
||||
friends
|
||||
|
||||
class DeltaOnModificationOfIntPackedMap from TDataStd
|
||||
|
||||
end IntPackedMap;
|
208
src/TDataStd/TDataStd_IntPackedMap.cxx
Executable file
208
src/TDataStd/TDataStd_IntPackedMap.cxx
Executable file
@@ -0,0 +1,208 @@
|
||||
// File: TDataStd_IntPackedMap.cxx
|
||||
// Created: Tue Jul 31 17:29:51 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
//Copyright: Open CasCade SA 2007
|
||||
|
||||
|
||||
#include <TDataStd_IntPackedMap.ixx>
|
||||
#include <TColStd_PackedMapOfInteger.hxx>
|
||||
#include <TColStd_HPackedMapOfInteger.hxx>
|
||||
#include <TDF_DefaultDeltaOnModification.hxx>
|
||||
#include <TDataStd_DeltaOnModificationOfIntPackedMap.hxx>
|
||||
#include <Standard_GUID.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Attribute.hxx>
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_IntPackedMap::GetID()
|
||||
{
|
||||
static Standard_GUID theGUID ("7031faff-161e-44df-8239-7c264a81f5a1");
|
||||
return theGUID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_IntPackedMap) TDataStd_IntPackedMap::Set (const TDF_Label& theLabel,
|
||||
const Standard_Boolean isDelta)
|
||||
{
|
||||
Handle(TDataStd_IntPackedMap) anAtt;
|
||||
if (!theLabel.FindAttribute(TDataStd_IntPackedMap::GetID(), anAtt))
|
||||
{
|
||||
anAtt = new TDataStd_IntPackedMap;
|
||||
anAtt->Clear();
|
||||
anAtt->SetDelta(isDelta);
|
||||
theLabel.AddAttribute(anAtt);
|
||||
}
|
||||
return anAtt;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TDataStd_IntPackedMap::TDataStd_IntPackedMap ()
|
||||
:myIsDelta(Standard_False)
|
||||
{
|
||||
myMap = new TColStd_HPackedMapOfInteger ();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : ChangeMap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_IntPackedMap::ChangeMap (const Handle(TColStd_HPackedMapOfInteger)& theMap)
|
||||
{
|
||||
if(theMap.IsNull()) return Standard_False;
|
||||
if (myMap != theMap)
|
||||
{
|
||||
if (!myMap->Map().IsEqual(theMap->Map()))
|
||||
{
|
||||
Backup();
|
||||
myMap->ChangeMap().Assign(theMap->Map());
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_IntPackedMap::Clear ()
|
||||
{
|
||||
if (!myMap->Map().IsEmpty())
|
||||
{
|
||||
Backup();
|
||||
myMap = new TColStd_HPackedMapOfInteger;
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Contains
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_IntPackedMap::Contains(const Standard_Integer theKey) const
|
||||
{
|
||||
return myMap->Map().Contains(theKey);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_IntPackedMap::Add(const Standard_Integer theKey)
|
||||
{
|
||||
Standard_Boolean aResult = !myMap->Map().Contains(theKey);
|
||||
if (aResult)
|
||||
{
|
||||
Backup();
|
||||
aResult = myMap->ChangeMap().Add(theKey);
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_IntPackedMap::Remove(const Standard_Integer theKey)
|
||||
{
|
||||
Standard_Boolean aResult = myMap->Map().Contains(theKey);
|
||||
if (aResult)
|
||||
{
|
||||
Backup();
|
||||
aResult = myMap->ChangeMap().Remove(theKey);
|
||||
}
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_IntPackedMap::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_IntPackedMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntPackedMap::Restore (const Handle(TDF_Attribute)& theWith)
|
||||
{
|
||||
Handle(TDataStd_IntPackedMap) aWith =
|
||||
Handle(TDataStd_IntPackedMap)::DownCast(theWith);
|
||||
if (aWith->myMap.IsNull())
|
||||
myMap.Nullify();
|
||||
else
|
||||
{
|
||||
myMap = new TColStd_HPackedMapOfInteger;
|
||||
myMap->ChangeMap().Assign(aWith->myMap->Map());
|
||||
myIsDelta = aWith->myIsDelta;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntPackedMap::Paste (const Handle(TDF_Attribute)& theInto,
|
||||
const Handle(TDF_RelocationTable)&) const
|
||||
{
|
||||
Handle(TDataStd_IntPackedMap) anInto =
|
||||
Handle(TDataStd_IntPackedMap)::DownCast(theInto);
|
||||
if(!anInto.IsNull()) {
|
||||
anInto->ChangeMap(myMap);
|
||||
anInto->SetDelta(myIsDelta);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_IntPackedMap::ID() const
|
||||
{ return GetID(); }
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_IntPackedMap::Dump(Standard_OStream& theOS) const
|
||||
{
|
||||
Standard_OStream& anOS = TDF_Attribute::Dump( theOS );
|
||||
anOS << "IntPackedMap size = " << Extent();
|
||||
anOS << " Delta is " << myIsDelta ? "ON":"OFF";
|
||||
anOS << endl;
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeltaOnModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_DeltaOnModification) TDataStd_IntPackedMap::DeltaOnModification
|
||||
(const Handle(TDF_Attribute)& OldAttribute) const
|
||||
{
|
||||
if(myIsDelta)
|
||||
return new TDataStd_DeltaOnModificationOfIntPackedMap(*((Handle(TDataStd_IntPackedMap)*)&OldAttribute));
|
||||
else return new TDF_DefaultDeltaOnModification(OldAttribute);
|
||||
}
|
||||
|
||||
|
70
src/TDataStd/TDataStd_IntPackedMap.lxx
Executable file
70
src/TDataStd/TDataStd_IntPackedMap.lxx
Executable file
@@ -0,0 +1,70 @@
|
||||
// File: TDataStd_IntPackedMap.lxx
|
||||
// Created: Thu Jan 24 15:50:56 2008
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
//Copyright: Open CasCade SA 2008
|
||||
|
||||
#include <TColStd_HPackedMapOfInteger.hxx>
|
||||
//=======================================================================
|
||||
//function : GetHMap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline const Handle(TColStd_HPackedMapOfInteger)& TDataStd_IntPackedMap::GetHMap () const
|
||||
{
|
||||
return myMap;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const TColStd_PackedMapOfInteger& TDataStd_IntPackedMap::GetMap () const
|
||||
{
|
||||
return myMap->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_IntPackedMap::IsEmpty() const
|
||||
{
|
||||
return myMap->Map().IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer TDataStd_IntPackedMap::Extent() const
|
||||
{
|
||||
return myMap->Map().Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveMap
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_IntPackedMap::RemoveMap(void)
|
||||
{
|
||||
myMap.Nullify();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_IntPackedMap::SetDelta(const Standard_Boolean isDelta)
|
||||
{
|
||||
myIsDelta = isDelta;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_IntPackedMap::GetDelta(void) const
|
||||
{
|
||||
return myIsDelta;
|
||||
}
|
72
src/TDataStd/TDataStd_Integer.cdl
Executable file
72
src/TDataStd/TDataStd_Integer.cdl
Executable file
@@ -0,0 +1,72 @@
|
||||
-- File: TDataStd_Integer.cdl
|
||||
-- Created: Thu Feb 6 17:04:48 1997
|
||||
-- Author: Denis PASCAL
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class Integer from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: The basis to define an integer attribute.
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
Integer from Standard,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for integers.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF; value : Integer from Standard)
|
||||
---Purpose: Finds, or creates, an Integer attribute and sets <value>
|
||||
-- the Integer attribute is returned.
|
||||
returns Integer from TDataStd;
|
||||
|
||||
---Purpose: Integer methods
|
||||
-- ===============
|
||||
|
||||
Set (me : mutable; V : Integer from Standard);
|
||||
|
||||
Get (me)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Returns the integer value contained in the attribute.
|
||||
IsCaptured(me) returns Boolean;
|
||||
---Purpose: Returns True if there is a reference on the same label
|
||||
|
||||
---Category: methodes de TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
Create
|
||||
returns mutable Integer from TDataStd;
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myValue : Integer from Standard;
|
||||
|
||||
end Integer;
|
136
src/TDataStd/TDataStd_Integer.cxx
Executable file
136
src/TDataStd/TDataStd_Integer.cxx
Executable file
@@ -0,0 +1,136 @@
|
||||
// File: TDataStd_Integer.cxx
|
||||
// Created: Thu Mar 6 10:32:25 1997
|
||||
// Author: Denis PASCAL
|
||||
|
||||
|
||||
#include <TDataStd_Integer.ixx>
|
||||
#include <TDF_Reference.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Integer::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_IntegerID ("2a96b606-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_IntegerID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Integer) TDataStd_Integer::Set (const TDF_Label& L,
|
||||
const Standard_Integer V)
|
||||
|
||||
{
|
||||
Handle(TDataStd_Integer) A;
|
||||
if (!L.FindAttribute (TDataStd_Integer::GetID(), A)) {
|
||||
A = new TDataStd_Integer ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
A->Set (V);
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Integer
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Integer::TDataStd_Integer ()
|
||||
: myValue (-1)
|
||||
{ }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Integer::Set(const Standard_Integer v)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myValue == v) return;
|
||||
|
||||
Backup();
|
||||
myValue = v;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer TDataStd_Integer::Get () const { return myValue; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCaptured
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Integer::IsCaptured() const
|
||||
{
|
||||
Handle(TDF_Reference) R;
|
||||
return (Label().FindAttribute(TDF_Reference::GetID(),R));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Integer::ID () const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Integer::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_Integer ();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Integer::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myValue = Handle(TDataStd_Integer)::DownCast (With)->Get();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Integer::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_Integer)::DownCast(Into)->Set(myValue);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Integer::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Integer:: "<< this <<" : ";
|
||||
anOS << myValue;
|
||||
//
|
||||
anOS <<"\nAttribute fields: ";
|
||||
anOS << TDF_Attribute::Dump(anOS);
|
||||
return anOS;
|
||||
}
|
||||
|
131
src/TDataStd/TDataStd_IntegerArray.cdl
Executable file
131
src/TDataStd/TDataStd_IntegerArray.cdl
Executable file
@@ -0,0 +1,131 @@
|
||||
-- File: TDataStd_IntegerArray.cdl
|
||||
-- Created: Wed Jun 16 11:04:48 1999
|
||||
-- Author: Sergey RUIN
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class IntegerArray from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains an array of integers.
|
||||
|
||||
uses
|
||||
GUID from Standard,
|
||||
HArray1OfInteger from TColStd,
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
DeltaOnModification from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for arrays of integers.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF; lower, upper : Integer from Standard;
|
||||
isDelta : Boolean from Standard = Standard_False)
|
||||
---Purpose: Finds or creates on the <label> an integer array attribute
|
||||
-- with the specified <lower> and <upper> boundaries.
|
||||
-- If <isDelta> == False, DefaultDeltaOnModification is used.
|
||||
-- If attribute is already set, all input parameters are refused and the found
|
||||
-- attribute is returned.
|
||||
returns IntegerArray from TDataStd;
|
||||
|
||||
|
||||
---Category: IntegerArray methods
|
||||
-- ===============
|
||||
|
||||
Init(me : mutable; lower, upper : Integer from Standard);
|
||||
---Purpose: Initialize the inner array with bounds from <lower> to <upper>
|
||||
|
||||
SetValue (me : mutable; Index, Value : Integer from Standard);
|
||||
---Purpose: Sets the <Index>th element of the array to <Value>
|
||||
|
||||
Value (me; Index : Integer from Standard)
|
||||
---Purpose: Return the value of the <Index>th element of the array
|
||||
--
|
||||
---C++: alias operator ()
|
||||
returns Integer from Standard;
|
||||
|
||||
Lower (me) returns Integer from Standard;
|
||||
---Purpose: Returns the lower boundary of this array of integers.
|
||||
|
||||
Upper (me) returns Integer from Standard;
|
||||
---Purpose: Return the upper boundary of this array of integers.
|
||||
|
||||
Length (me) returns Integer from Standard;
|
||||
---Purpose: Returns the length of this array of integers in
|
||||
-- terms of the number of elements it contains.
|
||||
|
||||
ChangeArray(me : mutable; newArray : HArray1OfInteger from TColStd;
|
||||
isCheckItems : Boolean = Standard_True);
|
||||
---Purpose: Sets the inner array <myValue> of the IntegerArray attribute to
|
||||
-- <newArray>. If value of <newArray> differs from <myValue>, Backup performed
|
||||
-- and myValue refers to new instance of HArray1OfInteger that holds <newArray>
|
||||
-- values
|
||||
-- If <isCheckItems> equal True each item of <newArray> will be checked with each
|
||||
-- item of <myValue> for coincidence (to avoid backup).
|
||||
|
||||
Array(me) returns HArray1OfInteger from TColStd;
|
||||
---Purpose: Return the inner array of the IntegerArray attribute
|
||||
---C++: inline
|
||||
---C++: return const
|
||||
|
||||
GetDelta(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetDelta(me : mutable; isDelta : Boolean from Standard);
|
||||
---C++: inline
|
||||
---Purpose: for internal use only!
|
||||
|
||||
RemoveArray(me : mutable) is private;
|
||||
---C++: inline
|
||||
|
||||
|
||||
---Category: methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
Create returns mutable IntegerArray from TDataStd;
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
---Purpose: Note. Uses inside ChangeArray() method
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
---Category: methods to be added for using in DeltaOn Modification
|
||||
-- =====================================================
|
||||
DeltaOnModification(me; anOldAttribute : Attribute from TDF)
|
||||
returns DeltaOnModification from TDF
|
||||
---Purpose : Makes a DeltaOnModification between <me> and
|
||||
-- <anOldAttribute>.
|
||||
is redefined virtual;
|
||||
|
||||
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myValue : HArray1OfInteger from TColStd;
|
||||
myIsDelta : Boolean from Standard;
|
||||
friends
|
||||
|
||||
class DeltaOnModificationOfIntArray from TDataStd
|
||||
|
||||
end IntegerArray;
|
268
src/TDataStd/TDataStd_IntegerArray.cxx
Executable file
268
src/TDataStd/TDataStd_IntegerArray.cxx
Executable file
@@ -0,0 +1,268 @@
|
||||
// File: TDataStd_IntegerArray.cxx
|
||||
// Created: Wed Jun 16 10:32:25 1999
|
||||
// Author: Sergey RUIN
|
||||
|
||||
|
||||
#include <TDataStd_IntegerArray.ixx>
|
||||
#include <TDataStd_DeltaOnModificationOfIntArray.hxx>
|
||||
#include <TDF_DefaultDeltaOnModification.hxx>
|
||||
#define OCC925
|
||||
#define OCC2932
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_IntegerArray::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_IntegerArrayID ("2a96b61d-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_IntegerArrayID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_IntegerArray
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_IntegerArray::TDataStd_IntegerArray()
|
||||
:myIsDelta(Standard_False) {}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntegerArray::Init(const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
#ifdef OCC925
|
||||
Backup();
|
||||
#endif
|
||||
myValue = new TColStd_HArray1OfInteger(lower, upper, 0);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose : isDelta applicable only for new attributes
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_IntegerArray) TDataStd_IntegerArray::Set
|
||||
(const TDF_Label& label,
|
||||
const Standard_Integer lower,
|
||||
const Standard_Integer upper,
|
||||
const Standard_Boolean isDelta)
|
||||
|
||||
{
|
||||
Handle(TDataStd_IntegerArray) A;
|
||||
if (!label.FindAttribute (TDataStd_IntegerArray::GetID(), A)) {
|
||||
A = new TDataStd_IntegerArray;
|
||||
A->Init (lower, upper);
|
||||
A->SetDelta(isDelta);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
else if (lower != A->Lower() || upper != A->Upper())
|
||||
{
|
||||
A->Init (lower, upper);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntegerArray::SetValue(const Standard_Integer index, const Standard_Integer value)
|
||||
{
|
||||
if(myValue.IsNull()) return;
|
||||
if( myValue->Value(index) == value)
|
||||
return;
|
||||
Backup();
|
||||
myValue->SetValue(index, value);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer TDataStd_IntegerArray::Value (const Standard_Integer index) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Value(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Lower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_IntegerArray::Lower (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Lower();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Upper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_IntegerArray::Upper (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Upper();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_IntegerArray::Length (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Length();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeArray
|
||||
//purpose : If value of <newArray> differs from <myValue>, Backup
|
||||
// : performed and myValue refers to new instance of HArray1OfInteger
|
||||
// : that holds <newArray>
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntegerArray::ChangeArray(const Handle(TColStd_HArray1OfInteger)& newArray,
|
||||
const Standard_Boolean isCheckItems)
|
||||
{
|
||||
Standard_Integer aLower = newArray->Lower();
|
||||
Standard_Integer anUpper = newArray->Upper();
|
||||
Standard_Boolean aDimEqual = Standard_False;
|
||||
Standard_Integer i;
|
||||
#ifdef OCC2932
|
||||
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
|
||||
aDimEqual = Standard_True;
|
||||
if(isCheckItems) {
|
||||
Standard_Boolean isEqual = Standard_True;
|
||||
for(i = aLower; i <= anUpper; i++) {
|
||||
if(myValue->Value(i) != newArray->Value(i)) {
|
||||
isEqual = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isEqual)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Backup();
|
||||
// Handles of myValue of current and backuped attributes will be different!
|
||||
if(!aDimEqual)
|
||||
myValue = new TColStd_HArray1OfInteger(aLower, anUpper);
|
||||
|
||||
for(i = aLower; i <= anUpper; i++)
|
||||
myValue->SetValue(i, newArray->Value(i));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_IntegerArray::ID () const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_IntegerArray::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_IntegerArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntegerArray::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Standard_Integer i, lower, upper;
|
||||
Handle(TDataStd_IntegerArray) anArray = Handle(TDataStd_IntegerArray)::DownCast(With);
|
||||
if(!anArray->myValue.IsNull()) {
|
||||
lower = anArray->Lower();
|
||||
upper = anArray->Upper();
|
||||
myValue = new TColStd_HArray1OfInteger(lower, upper);
|
||||
for(i = lower; i<=upper; i++)
|
||||
myValue->SetValue(i, anArray->Value(i));
|
||||
myIsDelta = anArray->myIsDelta;
|
||||
}
|
||||
else
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_IntegerArray::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
|
||||
if(!myValue.IsNull()) {
|
||||
Handle(TDataStd_IntegerArray) anAtt = Handle(TDataStd_IntegerArray)::DownCast(Into);
|
||||
if(!anAtt.IsNull()) {
|
||||
anAtt->ChangeArray( myValue, Standard_False );
|
||||
anAtt->SetDelta(myIsDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_IntegerArray::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "\nIntegerArray:: " << this <<" :";
|
||||
if(!myValue.IsNull()) {
|
||||
Standard_Integer i, lower, upper;
|
||||
lower = myValue->Lower();
|
||||
upper = myValue->Upper();
|
||||
for(i = lower; i<=upper; i++)
|
||||
anOS << " " <<myValue->Value(i);
|
||||
}
|
||||
anOS << " Delta is " << myIsDelta ? "ON":"OFF";
|
||||
anOS << endl;
|
||||
|
||||
// anOS <<"\nAttribute fields: ";
|
||||
// anOS << TDF_Attribute::Dump(anOS);
|
||||
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeltaOnModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_DeltaOnModification) TDataStd_IntegerArray::DeltaOnModification
|
||||
(const Handle(TDF_Attribute)& OldAttribute) const
|
||||
{
|
||||
if(myIsDelta)
|
||||
return new TDataStd_DeltaOnModificationOfIntArray(*((Handle(TDataStd_IntegerArray)*)&OldAttribute));
|
||||
else return new TDF_DefaultDeltaOnModification(OldAttribute);
|
||||
}
|
||||
|
||||
|
43
src/TDataStd/TDataStd_IntegerArray.lxx
Executable file
43
src/TDataStd/TDataStd_IntegerArray.lxx
Executable file
@@ -0,0 +1,43 @@
|
||||
// File: TDataStd_IntegerArray.lxx
|
||||
// Created: Tue Oct 2 14:34:01 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Array
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(TColStd_HArray1OfInteger) TDataStd_IntegerArray::Array(void) const
|
||||
{
|
||||
return myValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_IntegerArray::RemoveArray(void)
|
||||
{
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_IntegerArray::SetDelta(const Standard_Boolean isDelta)
|
||||
{
|
||||
myIsDelta = isDelta;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_IntegerArray::GetDelta(void) const
|
||||
{
|
||||
return myIsDelta;
|
||||
}
|
107
src/TDataStd/TDataStd_IntegerList.cdl
Executable file
107
src/TDataStd/TDataStd_IntegerList.cdl
Executable file
@@ -0,0 +1,107 @@
|
||||
-- File: TDataStd_IntegerList.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class IntegerList from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains a list of integers.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
ListOfInteger from TColStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the list of integer attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Finds or creates a list of integer values attribute.
|
||||
returns IntegerList from TDataStd;
|
||||
|
||||
|
||||
---Category: IntegerList methods
|
||||
-- ===================
|
||||
|
||||
Create
|
||||
returns mutable IntegerList from TDataStd;
|
||||
|
||||
IsEmpty (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Extent (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
Prepend (me : mutable;
|
||||
value : Integer from Standard);
|
||||
|
||||
Append (me : mutable;
|
||||
value : Integer from Standard);
|
||||
|
||||
InsertBefore (me : mutable;
|
||||
value : Integer from Standard;
|
||||
before_value : Integer from Standard)
|
||||
---Purpose: Inserts the <value> before the first meet of <before_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
InsertAfter (me : mutable;
|
||||
value : Integer from Standard;
|
||||
after_value : Integer from Standard)
|
||||
---Purpose: Inserts the <value> after the first meet of <after_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Remove (me : mutable;
|
||||
value : Integer from Standard)
|
||||
---Purpose: Removes the first meet of the <value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Clear (me : mutable);
|
||||
|
||||
First (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
Last (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
List (me)
|
||||
---C++: return const &
|
||||
returns ListOfInteger from TColStd;
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myList : ListOfInteger from TColStd;
|
||||
|
||||
|
||||
end IntegerList;
|
235
src/TDataStd/TDataStd_IntegerList.cxx
Executable file
235
src/TDataStd/TDataStd_IntegerList.cxx
Executable file
@@ -0,0 +1,235 @@
|
||||
// File: TDataStd_IntegerList.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_IntegerList.ixx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_IntegerList::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_IntegerListID ("E406AA18-FF3F-483b-9A78-1A5EA5D1AA52");
|
||||
return TDataStd_IntegerListID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_IntegerList
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_IntegerList::TDataStd_IntegerList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_IntegerList) TDataStd_IntegerList::Set(const TDF_Label& label)
|
||||
{
|
||||
Handle(TDataStd_IntegerList) A;
|
||||
if (!label.FindAttribute (TDataStd_IntegerList::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_IntegerList;
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_IntegerList::IsEmpty() const
|
||||
{
|
||||
return myList.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_IntegerList::Extent() const
|
||||
{
|
||||
return myList.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_IntegerList::Prepend(const Standard_Integer value)
|
||||
{
|
||||
Backup();
|
||||
myList.Prepend(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_IntegerList::Append(const Standard_Integer value)
|
||||
{
|
||||
Backup();
|
||||
myList.Append(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertBefore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_IntegerList::InsertBefore(const Standard_Integer value,
|
||||
const Standard_Integer before_value)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == before_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertBefore(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertAfter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_IntegerList::InsertAfter(const Standard_Integer value,
|
||||
const Standard_Integer after_value)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == after_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertAfter(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_IntegerList::Remove(const Standard_Integer value)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfInteger itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == value)
|
||||
{
|
||||
Backup();
|
||||
myList.Remove(itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_IntegerList::Clear()
|
||||
{
|
||||
Backup();
|
||||
myList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_IntegerList::First() const
|
||||
{
|
||||
return myList.First();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_IntegerList::Last() const
|
||||
{
|
||||
return myList.Last();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : List
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TColStd_ListOfInteger& TDataStd_IntegerList::List() const
|
||||
{
|
||||
return myList;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_IntegerList::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_IntegerList::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_IntegerList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_IntegerList::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myList.Clear();
|
||||
Handle(TDataStd_IntegerList) aList = Handle(TDataStd_IntegerList)::DownCast(With);
|
||||
TColStd_ListIteratorOfListOfInteger itr(aList->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
myList.Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_IntegerList::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(TDataStd_IntegerList) aList = Handle(TDataStd_IntegerList)::DownCast(Into);
|
||||
aList->Clear();
|
||||
TColStd_ListIteratorOfListOfInteger itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
aList->Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_IntegerList::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "IntegerList";
|
||||
return anOS;
|
||||
}
|
175
src/TDataStd/TDataStd_Name.cdl
Executable file
175
src/TDataStd/TDataStd_Name.cdl
Executable file
@@ -0,0 +1,175 @@
|
||||
-- File: TDataStd_Name.cdl
|
||||
-- Created: Thu Jul 31 10:29:12 1997
|
||||
-- Author: Denis PASCAL
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
|
||||
class Name from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Used to define a name attribute containing a string which specifies the name.
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
ExtendedString from TCollection,
|
||||
ListOfExtendedString from TDataStd,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
AttributeSequence from TDF,
|
||||
AttributeList from TDF,
|
||||
Data from TDF,
|
||||
AttributeDelta from TDF
|
||||
|
||||
|
||||
raises
|
||||
|
||||
DomainError from Standard
|
||||
|
||||
|
||||
is
|
||||
|
||||
|
||||
---Purpose: class methods working on the name itself
|
||||
-- ========================================
|
||||
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for name attributes.
|
||||
returns GUID from Standard;
|
||||
|
||||
|
||||
Set (myclass; label: Label from TDF; string : ExtendedString from TCollection)
|
||||
---Purpose: Creates (if does not exist) and sets the name in the name attribute.
|
||||
-- myEmpty becomes False
|
||||
returns Name from TDataStd;
|
||||
|
||||
|
||||
|
||||
---Warning: ======================================================
|
||||
-- As already announced next methods will be moved soon in 2 tools
|
||||
--
|
||||
-- * one to search label from name following the framework
|
||||
-- label hierarchy.
|
||||
--
|
||||
-- * one to search label from name following the treenode hierachy.
|
||||
-- ===============================================================
|
||||
|
||||
--Find (myclass; L : Label from TDF; father : in out Name from TDataStd)
|
||||
---Purpose: from any label <L> search in father labels (L is not
|
||||
-- concerned) the first name attribute.if found set it in
|
||||
-- <father>.
|
||||
--returns Boolean from Standard;
|
||||
|
||||
|
||||
---Purpose: class methods working on the name tree
|
||||
-- ======================================
|
||||
|
||||
--Find (myclass; framework : Data from TDF;
|
||||
-- fullPath : ListOfExtendedString from TDataStd;
|
||||
-- name : in out Name from TDataStd)
|
||||
--returns Boolean from Standard;
|
||||
---Purpose: Search in the whole TDF_Data the Name attribute which
|
||||
-- fit with <fullPath>. Returns True if found.
|
||||
|
||||
--Find (myclass; current : Label from TDF;
|
||||
-- string : ExtendedString from TCollection;
|
||||
-- name : in out Name from TDataStd)
|
||||
--returns Boolean from Standard;
|
||||
---Purpose: Search under <currentLabel> a label which fit with
|
||||
-- <name>. Returns True if found. Shortcut which avoids
|
||||
-- building a ListOfExtendedStrin.
|
||||
|
||||
--Find (myclass; framework : Data from TDF;
|
||||
-- string : ExtendedString from TCollection;
|
||||
-- name : in out Name from TDataStd)
|
||||
--returns Boolean from Standard;
|
||||
---Purpose: Search in the whole TDF_Data the label which fit with name
|
||||
-- Returns True if found.
|
||||
|
||||
---Purpose: tools methods to translate path <-> pathlist
|
||||
-- ===========================================
|
||||
|
||||
--MakePath (myclass; path : ExtendedString from TCollection;
|
||||
-- pathlist : in out ListOfExtendedString from TDataStd;
|
||||
-- Separator: ExtCharacter from Standard = ':')
|
||||
--returns Boolean from Standard;
|
||||
---Purpose: move to draw For Draw test we may provide this tool method which convert a path in a
|
||||
-- sequence of string to call after the FindLabel methods.
|
||||
-- Example: if it's given "Assembly:Part_1:Sketch_5" it will return in <pathlist>
|
||||
-- the list of 3 strings: "Assembly","Part_1","Sketch_5".
|
||||
|
||||
--MakePath (myclass; pathlist : AttributeList from TDF;
|
||||
-- path : in out ExtendedString from TCollection;
|
||||
-- Separator: ExtCharacter from Standard = ':')
|
||||
---Purpose: move to draw from <pathlist> build the string path
|
||||
--returns Boolean from Standard;
|
||||
|
||||
|
||||
---Purpose: Name methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Name from TDataStd;
|
||||
|
||||
|
||||
--Father (me; father : in out Name from TDataStd)
|
||||
-- Purpose: Returns the Father Name. The search is done in <me>
|
||||
-- fathers labels. If noone father is found returns
|
||||
-- False.
|
||||
--returns Boolean from Standard;
|
||||
|
||||
--FullPath (me; path : in out AttributeList from TDF)
|
||||
--returns Boolean from Standard;
|
||||
|
||||
--ChildNames (me; list : in out AttributeList from TDF)
|
||||
-- Purpose: puts in list the childs names of me. returns TRUE if
|
||||
-- found
|
||||
--returns Boolean from Standard;
|
||||
|
||||
--Find (me; relativePath : ListOfExtendedString from TDataStd;
|
||||
-- name : in out Name from TDataStd)
|
||||
--returns Boolean from Standard;
|
||||
|
||||
Set (me : mutable; S : ExtendedString from TCollection)
|
||||
raises DomainError from Standard;
|
||||
---Purpose: Sets <S> as name. Raises if <S> is not a valid name.
|
||||
|
||||
Get (me)
|
||||
returns ExtendedString from TCollection;
|
||||
---Purpose:
|
||||
-- Returns the name contained in this name attribute.
|
||||
---C++: return const &
|
||||
|
||||
--SetEmpty(me: mutable);
|
||||
---Purpose: Set myEmpty field
|
||||
|
||||
--IsEmpty(me) returns Boolean from Standard;
|
||||
|
||||
---Category: TDF_Attribute methods
|
||||
-- =====================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
fields
|
||||
|
||||
myString : ExtendedString from TCollection; --To store name
|
||||
myEmpty : Boolean from Standard; --Is set to True if name isn't set
|
||||
|
||||
end Name;
|
482
src/TDataStd/TDataStd_Name.cxx
Executable file
482
src/TDataStd/TDataStd_Name.cxx
Executable file
@@ -0,0 +1,482 @@
|
||||
// File: TDataStd_Name.cxx
|
||||
// Created: Thu Jul 31 10:32:56 1997
|
||||
// Author: Denis PASCAL
|
||||
|
||||
#include <TDataStd_Name.ixx>
|
||||
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_ChildIterator.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Name::GetID ()
|
||||
{
|
||||
static Standard_GUID TDataStd_NameID("2a96b608-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_NameID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_Name) TDataStd_Name::Set
|
||||
(const TDF_Label& label,
|
||||
const TCollection_ExtendedString& theString)
|
||||
{
|
||||
Handle(TDataStd_Name) N;
|
||||
if (!label.FindAttribute(TDataStd_Name::GetID(), N)) {
|
||||
N = new TDataStd_Name ();
|
||||
label.AddAttribute(N);
|
||||
}
|
||||
N->Set(theString);
|
||||
return N;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Find
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Find (const TDF_Label& label, Handle(TDataStd_Name)& name)
|
||||
// {
|
||||
// Handle(TDataStd_Name) N;
|
||||
// if (label.FindAttribute(TDataStd_Name::GetID(), N)) {
|
||||
// name = N;
|
||||
// return Standard_True;
|
||||
// }
|
||||
// TDF_Label L = label;
|
||||
// while (!L.IsRoot()) {
|
||||
// L = L.Father();
|
||||
// if (L.FindAttribute (TDataStd_Name::GetID(), N)) {
|
||||
// name = N;
|
||||
// return Standard_True;
|
||||
// }
|
||||
// }
|
||||
// return Standard_False;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : IsNamed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::IsNamed(const TDF_Label& label)
|
||||
// {
|
||||
// Handle(TDataStd_Name) N;
|
||||
|
||||
// return label.FindAttribute(TDataStd_Name::GetID(), N);
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::IsEmpty(const TDF_Label& label)
|
||||
// {
|
||||
// Handle(TDataStd_Name) N;
|
||||
// if(label.FindAttribute(TDataStd_Name::GetID(), N)) {
|
||||
// return N->IsEmpty();
|
||||
// }
|
||||
|
||||
// Standard_DomainError::Raise("There isn't the Name Attribute on the label");
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : Erase
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// void TDataStd_Name::Erase(const TDF_Label& label)
|
||||
// {
|
||||
// Handle(TDataStd_Name) N;
|
||||
|
||||
// if(label.FindAttribute(TDataStd_Name::GetID(), N)) {
|
||||
// N->SetEmpty();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Standard_DomainError::Raise("There isn't the Name Attribute on the label");
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Name
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Name::TDataStd_Name ()
|
||||
: myEmpty(Standard_True) { }
|
||||
|
||||
//=======================================================================
|
||||
//function : Father
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Father (Handle(TDataStd_Name)& name) const
|
||||
// {
|
||||
// Handle(TDataStd_Name) father;
|
||||
// TDF_Label L = Label();
|
||||
// while (!L.IsRoot()) {
|
||||
// L = L.Father();
|
||||
// if (L.FindAttribute (TDataStd_Name::GetID(), father)) {
|
||||
// name = father;
|
||||
// return Standard_True;
|
||||
// }
|
||||
// }
|
||||
// return Standard_False;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_Name::Set (const TCollection_ExtendedString& S)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myString == S) return;
|
||||
|
||||
Backup();
|
||||
myString = S;
|
||||
//TCollection_ExtendedString tmpS(S);
|
||||
//tmpS.RemoveAll(':');
|
||||
//myString = tmpS;
|
||||
//myEmpty = Standard_False;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& TDataStd_Name::Get () const
|
||||
{
|
||||
return myString;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
// void TDataStd_Name::SetEmpty()
|
||||
// {
|
||||
// Backup();
|
||||
// myEmpty = Standard_True;
|
||||
// myString.Clear();
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//Standard_Boolean TDataStd_Name::IsEmpty() const {return myEmpty;}
|
||||
|
||||
|
||||
// TDF_Attribute methods
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Name::ID () const { return GetID(); }
|
||||
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Name::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_Name();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Name::Restore(const Handle(TDF_Attribute)& with)
|
||||
{
|
||||
myString = Handle(TDataStd_Name)::DownCast (with)->Get();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Name::Paste (const Handle(TDF_Attribute)& into,
|
||||
const Handle(TDF_RelocationTable)&/* RT*/) const
|
||||
{
|
||||
Handle(TDataStd_Name)::DownCast (into)->Set (myString);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Name::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
TDF_Attribute::Dump(anOS);
|
||||
anOS << " Name=|"<<myString<<"|"<<endl;
|
||||
return anOS;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Find (by the full path)
|
||||
//purpose : Name
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Find (const Handle(TDF_Data)& framework,
|
||||
// const TDataStd_ListOfExtendedString& fullPath,
|
||||
// Handle(TDataStd_Name)& name)
|
||||
// {
|
||||
// Handle(TDataStd_Name) Ncurrent;
|
||||
// TDF_Label L, root = framework->Root();
|
||||
// TDF_ChildIterator ChItr (root, Standard_True);
|
||||
// TCollection_ExtendedString string, first = fullPath.First();
|
||||
// TDataStd_ListOfExtendedString tmpPath;
|
||||
// Standard_Boolean IsRootVisited = Standard_False;
|
||||
|
||||
// tmpPath.Assign(fullPath);
|
||||
// if(tmpPath.Extent() > 0 ) tmpPath.RemoveFirst();
|
||||
|
||||
// while( ChItr.More() ) {
|
||||
// if( !IsRootVisited ) L = root; //For the fisrt time visit the root label
|
||||
// else L = ChItr.Value();
|
||||
|
||||
// if( L.FindAttribute(TDataStd_Name::GetID(), Ncurrent) ) {
|
||||
// string = Ncurrent->Get();
|
||||
// if( (string == first ) && ((string.Length()) == (first.Length())) ) {
|
||||
// if( fullPath.Extent() == 1 ) {
|
||||
// name = Ncurrent;
|
||||
// return Standard_True;
|
||||
// }
|
||||
// if (Ncurrent->Find(tmpPath, name) ) return Standard_True;
|
||||
// }
|
||||
// else {
|
||||
// if( !Ncurrent->IsEmpty() ) {
|
||||
// //The root contains String different from first name in the path
|
||||
// if( !IsRootVisited ) return Standard_False;
|
||||
// ChItr.NextBrother(); continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if( !IsRootVisited ) {
|
||||
// IsRootVisited = Standard_True;
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// ChItr.Next();
|
||||
// }
|
||||
// return Standard_False;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : Find (by the relative path)
|
||||
//purpose : Name
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Find (const TDF_Label& currentLabel,
|
||||
// const TDataStd_ListOfExtendedString& relativePath,
|
||||
// Handle(TDataStd_Name)& name)
|
||||
// {
|
||||
// Handle(TDataStd_Name) Ncurrent;
|
||||
// TDF_ChildIterator ChItr (currentLabel, Standard_True);
|
||||
// TCollection_ExtendedString string, first = relativePath.First();
|
||||
// TDataStd_ListOfExtendedString tmpPath;
|
||||
// tmpPath.Assign(relativePath);
|
||||
|
||||
// if( !currentLabel.FindAttribute(TDataStd_Name::GetID(), Ncurrent) )
|
||||
// Standard_DomainError::Raise("There isn't the Name attribute on the label");
|
||||
|
||||
|
||||
// while( ChItr.More() ) {
|
||||
// if( ChItr.Value().FindAttribute(TDataStd_Name::GetID(), Ncurrent) ) {
|
||||
// string = Ncurrent->Get();
|
||||
// if( (string == first ) && ((string.Length()) == (first.Length())) ) {
|
||||
// if( relativePath.Extent() == 1 ) { //it has reached the end of the relative path
|
||||
// name = Ncurrent;
|
||||
// return Standard_True;
|
||||
// }
|
||||
// else {
|
||||
// if (tmpPath.Extent() > 0) tmpPath.RemoveFirst();
|
||||
// if (Find(ChItr.Value(), tmpPath, Ncurrent)) return Standard_True;
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if( !Ncurrent->IsEmpty() ) {
|
||||
// ChItr.NextBrother(); continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ChItr.Next();
|
||||
// }
|
||||
|
||||
// return Standard_False;
|
||||
// }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Find (by the relative path)
|
||||
//purpose : NameTool
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Find(const TDF_Label& currentLabel,
|
||||
// const TCollection_ExtendedString& string,
|
||||
// Handle(TDataStd_Name)& name)
|
||||
// {
|
||||
// TDataStd_ListOfExtendedString tmpPath;
|
||||
// TDataStd_Name::MakePath(string, tmpPath,':');
|
||||
// Handle(TDataStd_Name) Ncurrent;
|
||||
// if (TDataStd_Name::Find(currentLabel,Ncurrent)) {
|
||||
// return Ncurrent->Find(tmpPath, name);
|
||||
// }
|
||||
// return Standard_False;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : Find (by the full path)
|
||||
//purpose : NameTool
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Find(const Handle(TDF_Data)& framework,
|
||||
// const TCollection_ExtendedString& string,
|
||||
// Handle(TDataStd_Name)& name)
|
||||
// {
|
||||
// TDataStd_ListOfExtendedString tmpPath;
|
||||
// TDataStd_Name::MakePath(string, tmpPath,':');
|
||||
// return Find(framework, tmpPath, name);
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : FullPath
|
||||
//purpose : NameTool
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::FullPath (TDF_AttributeList& path) const
|
||||
// {
|
||||
// path.Clear();
|
||||
// if( !IsEmpty() ) path.Append(this);
|
||||
// TDF_Label L = Label();
|
||||
// if(L.IsRoot() ) return Standard_True;
|
||||
// Handle(TDataStd_Name) Ncur;
|
||||
// while ( !L.IsRoot()) {
|
||||
// L = L.Father();
|
||||
// if(L.FindAttribute (TDataStd_Name::GetID(), Ncur)) {
|
||||
// if( !Ncur->IsEmpty() )path.Prepend(Ncur);
|
||||
// }
|
||||
// }
|
||||
// return Standard_True;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : MakePath
|
||||
//purpose : NameTool
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::MakePath(const TCollection_ExtendedString& path,
|
||||
// TDataStd_ListOfExtendedString& pathlist,
|
||||
// const Standard_ExtCharacter Separator)
|
||||
// {
|
||||
// TCollection_ExtendedString tmpPath = path, str;
|
||||
|
||||
// str+=Separator; str+=Separator;
|
||||
// if( tmpPath.Search(str) != -1 ) return Standard_False; //Not valid path (contains two adjacent separators)
|
||||
|
||||
// if( tmpPath.Search(Separator) == -1 ) { //The path contains only one name.
|
||||
// pathlist.Append(path);
|
||||
// return Standard_True;
|
||||
// }
|
||||
// Standard_Integer i;
|
||||
// while( (i = tmpPath.SearchFromEnd(Separator) ) != -1 ) {
|
||||
// str = tmpPath.Split(i-1);
|
||||
// str.Remove(1);
|
||||
// pathlist.Prepend(str);
|
||||
// }
|
||||
// if( tmpPath.Length() > 0 ) pathlist.Prepend(tmpPath);
|
||||
// return Standard_True;
|
||||
// }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : MakePath
|
||||
//purpose : NameTool
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::MakePath(const TDF_AttributeList& pathlist,
|
||||
// TCollection_ExtendedString& path,
|
||||
// const Standard_ExtCharacter Separator)
|
||||
// {
|
||||
// TDF_ListIteratorOfAttributeList Itr(pathlist);
|
||||
// Handle(TDataStd_Name) N;
|
||||
|
||||
// if( pathlist.Extent() == 0 ) return Standard_False;
|
||||
// path.Clear();
|
||||
// for(; Itr.More(); Itr.Next() ) {
|
||||
// N = Handle(TDataStd_Name)::DownCast(Itr.Value());
|
||||
// path = path + N->Get();
|
||||
// path = path + Separator;
|
||||
// }
|
||||
// path.Remove(path.Length(), 1);
|
||||
// return Standard_True;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : Find (by the relative path)
|
||||
//purpose : Name
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::Find (const TDataStd_ListOfExtendedString& relativePath,
|
||||
// Handle(TDataStd_Name)& name) const
|
||||
// {
|
||||
// Handle(TDataStd_Name) Ncurrent;
|
||||
// TDF_ChildIterator ChItr (Label(), Standard_True);
|
||||
// TCollection_ExtendedString string, first = relativePath.First();
|
||||
// TDataStd_ListOfExtendedString tmpPath;
|
||||
// tmpPath.Assign(relativePath);
|
||||
// //
|
||||
// while( ChItr.More() ) {
|
||||
// if( ChItr.Value().FindAttribute(TDataStd_Name::GetID(), Ncurrent) ) {
|
||||
// string = Ncurrent->Get();
|
||||
// if( (string == first ) && ((string.Length()) == (first.Length())) ) {
|
||||
// if( relativePath.Extent() == 1 ) { //it has reached the end of the relative path
|
||||
// name = Ncurrent;
|
||||
// return Standard_True;
|
||||
// }
|
||||
// else {
|
||||
// if (tmpPath.Extent() > 0) tmpPath.RemoveFirst();
|
||||
// if (Ncurrent->Find(tmpPath, name)) return Standard_True;
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if (!Ncurrent->IsEmpty()) {
|
||||
// ChItr.NextBrother(); continue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ChItr.Next();
|
||||
// }
|
||||
// return Standard_False;
|
||||
// }
|
||||
|
||||
//=======================================================================
|
||||
//function : ChildNames
|
||||
//purpose : NameTool
|
||||
//=======================================================================
|
||||
// Standard_Boolean TDataStd_Name::ChildNames (TDF_AttributeList& list) const
|
||||
// {
|
||||
// Standard_Boolean found = Standard_False;
|
||||
// TDF_ChildIterator ChItr (Label(), Standard_True);
|
||||
// Handle(TDataStd_Name) N;
|
||||
// list.Clear();
|
||||
// for(; ChItr.More(); ChItr.Next()) {
|
||||
// if( ChItr.Value().FindAttribute(TDataStd_Name::GetID(), N) ) {
|
||||
// list.Append(N);
|
||||
// found = Standard_True;
|
||||
// cout << N->Get() << endl;
|
||||
// }
|
||||
// }
|
||||
// return found;
|
||||
// }
|
312
src/TDataStd/TDataStd_NamedData.cdl
Executable file
312
src/TDataStd/TDataStd_NamedData.cdl
Executable file
@@ -0,0 +1,312 @@
|
||||
-- File: TDataStd_NamedData.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class NamedData from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains a named data.
|
||||
|
||||
uses
|
||||
|
||||
GUID from Standard,
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
ExtendedString from TCollection,
|
||||
HArray1OfInteger from TColStd,
|
||||
HArray1OfReal from TColStd,
|
||||
DataMapOfStringInteger from TColStd,
|
||||
DataMapOfStringReal from TDataStd,
|
||||
DataMapOfStringString from TDataStd,
|
||||
DataMapOfStringByte from TDataStd,
|
||||
DataMapOfStringHArray1OfInteger from TDataStd,
|
||||
DataMapOfStringHArray1OfReal from TDataStd,
|
||||
HDataMapOfStringInteger from TDataStd,
|
||||
HDataMapOfStringReal from TDataStd,
|
||||
HDataMapOfStringString from TDataStd,
|
||||
HDataMapOfStringByte from TDataStd,
|
||||
HDataMapOfStringHArray1OfInteger from TDataStd,
|
||||
HDataMapOfStringHArray1OfReal from TDataStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the named data attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Finds or creates a named data attribute.
|
||||
returns NamedData from TDataStd;
|
||||
|
||||
|
||||
---Category: NamedData methods
|
||||
-- =================
|
||||
|
||||
Create
|
||||
returns mutable NamedData from TDataStd;
|
||||
|
||||
|
||||
---Category: Integers
|
||||
-- ========
|
||||
|
||||
HasIntegers (me)
|
||||
---Purpose: Returns true if at least one named integer value is
|
||||
-- kept in the attribute.
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasInteger (me;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns true if the attribute contains specified by Name
|
||||
-- integer value.
|
||||
returns Boolean from Standard;
|
||||
|
||||
-- InitIntegers(me : mutable)
|
||||
-- ---Purpose: Initializes internal container of Integers (to be used before access).
|
||||
-- -- Returns True if succeed.
|
||||
-- returns Boolean from Standard;
|
||||
|
||||
GetInteger (me : mutable;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns the integer value specified by the Name.
|
||||
-- It returns 0 if internal map doesn't contain the specified
|
||||
-- integer (use HasInteger() to check before).
|
||||
returns Integer from Standard;
|
||||
|
||||
SetInteger (me : mutable;
|
||||
theName : ExtendedString from TCollection;
|
||||
theInteger : Integer from Standard);
|
||||
---Purpose: Defines a named integer.
|
||||
-- If the integer already exists, it changes its value to <theInteger>.
|
||||
|
||||
GetIntegersContainer (me : mutable)
|
||||
---Purpose: Returns the internal container of named integers.
|
||||
---C++: return const &
|
||||
returns DataMapOfStringInteger from TColStd;
|
||||
|
||||
ChangeIntegers (me : mutable;
|
||||
theIntegers : DataMapOfStringInteger from TColStd);
|
||||
---Purpose: Replace the container content by new content of the <theIntegers>.
|
||||
|
||||
|
||||
---Category: Reals
|
||||
-- =====
|
||||
|
||||
HasReals (me)
|
||||
---Purpose: Returns true if at least one named real value is
|
||||
-- kept in the attribute.
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasReal (me;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns true if the attribute contains a real specified by Name.
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetReal (me : mutable;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns the named real.
|
||||
-- It returns 0.0 if there is no such a named real
|
||||
-- (use HasReal()).
|
||||
returns Real from Standard;
|
||||
|
||||
SetReal (me : mutable;
|
||||
theName : ExtendedString from TCollection;
|
||||
theReal : Real from Standard);
|
||||
---Purpose: Defines a named real.
|
||||
-- If the real already exists, it changes its value to <theReal>.
|
||||
|
||||
GetRealsContainer (me: mutable)
|
||||
---Purpose: Returns the internal container of named reals.
|
||||
---C++: return const &
|
||||
returns DataMapOfStringReal from TDataStd;
|
||||
|
||||
ChangeReals (me : mutable;
|
||||
theReals : DataMapOfStringReal from TDataStd);
|
||||
---Purpose: Replace the container content by new content of the <theReals>.
|
||||
|
||||
---Category: Strings
|
||||
-- =======
|
||||
|
||||
HasStrings (me)
|
||||
---Purpose: Returns true if there are some named strings in the attribute.
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasString (me;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns true if the attribute contains this named string.
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetString (me : mutable;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns the named string.
|
||||
-- It returns an empty string if there is no such a named string
|
||||
-- (use HasString()).
|
||||
---C++: return const &
|
||||
returns ExtendedString from TCollection;
|
||||
|
||||
SetString (me : mutable;
|
||||
theName : ExtendedString from TCollection;
|
||||
theString : ExtendedString from TCollection);
|
||||
---Purpose: Defines a named string.
|
||||
-- If the string already exists, it changes its value to <theString>.
|
||||
|
||||
GetStringsContainer (me : mutable)
|
||||
---Purpose: Returns the internal container of named strings.
|
||||
---C++: return const &
|
||||
returns DataMapOfStringString from TDataStd;
|
||||
|
||||
ChangeStrings (me : mutable;
|
||||
theStrings : DataMapOfStringString from TDataStd);
|
||||
---Purpose: Replace the container content by new content of the <theStrings>.
|
||||
|
||||
|
||||
---Category: Bytes (unsigned chars)
|
||||
-- ======================
|
||||
|
||||
HasBytes (me)
|
||||
---Purpose: Returns true if there are some named bytes in the attribute.
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasByte (me;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns true if the attribute contains this named byte.
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetByte (me : mutable;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns the named byte.
|
||||
-- It returns 0 if there is no such a named byte
|
||||
-- (use HasByte()).
|
||||
returns Byte from Standard;
|
||||
|
||||
SetByte (me : mutable;
|
||||
theName : ExtendedString from TCollection;
|
||||
theByte : Byte from Standard);
|
||||
---Purpose: Defines a named byte.
|
||||
-- If the byte already exists, it changes its value to <theByte>.
|
||||
|
||||
GetBytesContainer (me : mutable)
|
||||
---Purpose: Returns the internal container of named bytes.
|
||||
---C++: return const &
|
||||
returns DataMapOfStringByte from TDataStd;
|
||||
|
||||
ChangeBytes (me : mutable;
|
||||
theBytes : DataMapOfStringByte from TDataStd);
|
||||
---Purpose: Replace the container content by new content of the <theBytes>.
|
||||
|
||||
|
||||
---Category: Arrays of integers
|
||||
-- ==================
|
||||
|
||||
HasArraysOfIntegers (me)
|
||||
---Purpose: Returns true if there are some named arrays of integer values in the attribute.
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasArrayOfIntegers (me;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns true if the attribute contains this named array of integer values.
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetArrayOfIntegers (me : mutable;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns the named array of integer values.
|
||||
-- It returns a NULL Handle if there is no such a named array of integers
|
||||
-- (use HasArrayOfIntegers()).
|
||||
---C++: return const &
|
||||
returns HArray1OfInteger from TColStd;
|
||||
|
||||
SetArrayOfIntegers (me : mutable;
|
||||
theName : ExtendedString from TCollection;
|
||||
theArrayOfIntegers : HArray1OfInteger from TColStd);
|
||||
---Purpose: Defines a named array of integer values.
|
||||
-- If the array already exists, it changes its value to <theArrayOfIntegers>.
|
||||
|
||||
GetArraysOfIntegersContainer (me : mutable)
|
||||
---Purpose: Returns the internal container of named arrays of integer values.
|
||||
---C++: return const &
|
||||
returns DataMapOfStringHArray1OfInteger from TDataStd;
|
||||
|
||||
ChangeArraysOfIntegers (me : mutable;
|
||||
theArraysOfIntegers : DataMapOfStringHArray1OfInteger from TDataStd);
|
||||
---Purpose: Replace the container content by new content of the <theArraysOfIntegers>.
|
||||
|
||||
|
||||
---Category: Arrays of reals
|
||||
-- ===============
|
||||
|
||||
HasArraysOfReals (me)
|
||||
---Purpose: Returns true if there are some named arrays of real values in the attribute.
|
||||
---C++: inline
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasArrayOfReals (me;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns true if the attribute contains this named array of real values.
|
||||
returns Boolean from Standard;
|
||||
|
||||
GetArrayOfReals (me : mutable;
|
||||
theName : ExtendedString from TCollection)
|
||||
---Purpose: Returns the named array of real values.
|
||||
-- It returns a NULL Handle if there is no such a named array of reals
|
||||
-- (use HasArrayOfReals()).
|
||||
---C++: return const &
|
||||
returns HArray1OfReal from TColStd;
|
||||
|
||||
SetArrayOfReals (me : mutable;
|
||||
theName : ExtendedString from TCollection;
|
||||
theArrayOfReals : HArray1OfReal from TColStd);
|
||||
---Purpose: Defines a named array of real values.
|
||||
-- If the array already exists, it changes its value to <theArrayOfReals>.
|
||||
|
||||
GetArraysOfRealsContainer (me : mutable)
|
||||
---Purpose: Returns the internal container of named arrays of real values.
|
||||
---C++: return const &
|
||||
returns DataMapOfStringHArray1OfReal from TDataStd;
|
||||
|
||||
ChangeArraysOfReals (me : mutable;
|
||||
theArraysOfReals : DataMapOfStringHArray1OfReal from TDataStd);
|
||||
---Purpose: Replace the container content by new content of the <theArraysOfReals>.
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myIntegers : HDataMapOfStringInteger from TDataStd;
|
||||
myReals : HDataMapOfStringReal from TDataStd;
|
||||
myStrings : HDataMapOfStringString from TDataStd;
|
||||
myBytes : HDataMapOfStringByte from TDataStd;
|
||||
|
||||
myArraysOfIntegers : HDataMapOfStringHArray1OfInteger from TDataStd;
|
||||
myArraysOfReals : HDataMapOfStringHArray1OfReal from TDataStd;
|
||||
|
||||
end NamedData;
|
789
src/TDataStd/TDataStd_NamedData.cxx
Executable file
789
src/TDataStd/TDataStd_NamedData.cxx
Executable file
@@ -0,0 +1,789 @@
|
||||
// File: TDataStd_NamedData.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE SA 2007
|
||||
|
||||
#include <TDataStd_NamedData.ixx>
|
||||
|
||||
#include <TColStd_DataMapIteratorOfDataMapOfStringInteger.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringReal.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringString.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringByte.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger.hxx>
|
||||
#include <TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#define EXCEPTION ...
|
||||
#else
|
||||
#define EXCEPTION Standard_Failure
|
||||
#endif
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_NamedData::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_NamedDataID ("F170FD21-CBAE-4e7d-A4B4-0560A4DA2D16");
|
||||
return TDataStd_NamedDataID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_NamedData
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_NamedData::TDataStd_NamedData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_NamedData) TDataStd_NamedData::Set(const TDF_Label& label)
|
||||
{
|
||||
Handle(TDataStd_NamedData) A;
|
||||
if (!label.FindAttribute (TDataStd_NamedData::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_NamedData;
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//Category: Integers
|
||||
|
||||
//=======================================================================
|
||||
//function : HasInteger
|
||||
//purpose : Returns true if the attribute contains this named integer.
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_NamedData::HasInteger(const TCollection_ExtendedString& theName) const
|
||||
{
|
||||
if(!HasIntegers()) return Standard_False;
|
||||
return myIntegers->Map().IsBound(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetInteger
|
||||
//purpose : Returns the named integer. It returns 0 if there is no such
|
||||
// : a named integer(use HasInteger()).
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_NamedData::GetInteger(const TCollection_ExtendedString& theName)
|
||||
{
|
||||
if(!HasIntegers()) {
|
||||
TColStd_DataMapOfStringInteger aMap;
|
||||
myIntegers = new TDataStd_HDataMapOfStringInteger(aMap);
|
||||
}
|
||||
return myIntegers->Map()(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetInteger
|
||||
//purpose : Defines a named integer. If the integer already exists,
|
||||
// : it changes its value to <theInteger>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::SetInteger(const TCollection_ExtendedString& theName,
|
||||
const Standard_Integer theInteger)
|
||||
{
|
||||
if(!HasIntegers()) {
|
||||
TColStd_DataMapOfStringInteger aMap;
|
||||
myIntegers = new TDataStd_HDataMapOfStringInteger(aMap);
|
||||
}
|
||||
if (!myIntegers->Map().IsBound(theName) || myIntegers->Map().Find(theName) != theInteger)
|
||||
{
|
||||
Backup();
|
||||
if (myIntegers->Map().IsBound(theName))
|
||||
myIntegers->ChangeMap().ChangeFind(theName) = theInteger;
|
||||
else
|
||||
myIntegers->ChangeMap().Bind(theName, theInteger);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetIntegersContainer
|
||||
//purpose : Returns the internal container of named integers.
|
||||
// : Use before HasIntegers()
|
||||
//=======================================================================
|
||||
const TColStd_DataMapOfStringInteger& TDataStd_NamedData::GetIntegersContainer()
|
||||
{
|
||||
if(!HasIntegers()) {
|
||||
TColStd_DataMapOfStringInteger aMap;
|
||||
myIntegers = new TDataStd_HDataMapOfStringInteger(aMap);
|
||||
}
|
||||
return myIntegers->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeIntegers
|
||||
//purpose : Replace the container content by new content of the <theIntegers>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::ChangeIntegers(const TColStd_DataMapOfStringInteger& theIntegers)
|
||||
{
|
||||
if(!HasIntegers()) {
|
||||
TColStd_DataMapOfStringInteger aMap;
|
||||
myIntegers = new TDataStd_HDataMapOfStringInteger(aMap);
|
||||
};
|
||||
if (&myIntegers->Map() == &theIntegers) return;
|
||||
Backup();
|
||||
myIntegers->ChangeMap().Assign(theIntegers);
|
||||
}
|
||||
|
||||
|
||||
//Category: Reals
|
||||
// =====
|
||||
|
||||
//=======================================================================
|
||||
//function : HasReal
|
||||
//purpose : Returns true if the attribute contains this named real.
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_NamedData::HasReal(const TCollection_ExtendedString& theName) const
|
||||
{
|
||||
if(!HasReals()) return Standard_False;
|
||||
return myReals->Map().IsBound(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetReal
|
||||
//purpose : Returns the named real. It returns 0 if there is no such
|
||||
// : a named real (use HasReal()).
|
||||
//=======================================================================
|
||||
Standard_Real TDataStd_NamedData::GetReal(const TCollection_ExtendedString& theName)
|
||||
{
|
||||
if(!HasReals()) {
|
||||
TDataStd_DataMapOfStringReal aMap;
|
||||
myReals = new TDataStd_HDataMapOfStringReal(aMap);
|
||||
}
|
||||
return myReals->Map()(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetReal
|
||||
//purpose : Defines a named real. If the real already exists,
|
||||
// : it changes its value to <theReal>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::SetReal(const TCollection_ExtendedString& theName,
|
||||
const Standard_Real theReal)
|
||||
{
|
||||
if(!HasReals()) {
|
||||
TDataStd_DataMapOfStringReal aMap;
|
||||
myReals = new TDataStd_HDataMapOfStringReal(aMap);
|
||||
}
|
||||
if (!myReals->Map().IsBound(theName) || myReals->Map().Find(theName) != theReal)
|
||||
{
|
||||
Backup();
|
||||
if (myReals->Map().IsBound(theName))
|
||||
myReals->ChangeMap().ChangeFind(theName) = theReal;
|
||||
else
|
||||
myReals->ChangeMap().Bind(theName, theReal);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetRealsContainer
|
||||
//purpose : Returns the internal container of named reals.
|
||||
//=======================================================================
|
||||
const TDataStd_DataMapOfStringReal& TDataStd_NamedData::GetRealsContainer()
|
||||
{
|
||||
if(!HasReals()) {
|
||||
TDataStd_DataMapOfStringReal aMap;
|
||||
myReals = new TDataStd_HDataMapOfStringReal(aMap);
|
||||
}
|
||||
return myReals->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeReals
|
||||
//purpose : Replace the container content by new content of the <theReals>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::ChangeReals(const TDataStd_DataMapOfStringReal& theReals)
|
||||
{
|
||||
if(!HasReals()) {
|
||||
TDataStd_DataMapOfStringReal aMap;
|
||||
myReals = new TDataStd_HDataMapOfStringReal(aMap);
|
||||
}
|
||||
if (&myReals->Map() == &theReals) return;
|
||||
Backup();
|
||||
myReals->ChangeMap().Assign(theReals);
|
||||
}
|
||||
|
||||
|
||||
//Category: Strings
|
||||
// =======
|
||||
//=======================================================================
|
||||
//function : HasString
|
||||
//purpose : Returns true if the attribute contains this named string.
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_NamedData::HasString(const TCollection_ExtendedString& theName) const
|
||||
{
|
||||
if(!HasStrings()) return Standard_False;
|
||||
return myStrings->Map().IsBound(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetString
|
||||
//purpose : Returns the named string.It returns empty string if there is
|
||||
// : string specified by the Name(use HasString()).
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& TDataStd_NamedData::GetString(const TCollection_ExtendedString& theName)
|
||||
{
|
||||
if(!HasStrings()) {
|
||||
TDataStd_DataMapOfStringString aMap;
|
||||
myStrings = new TDataStd_HDataMapOfStringString(aMap);
|
||||
}
|
||||
return myStrings->Map()(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetString
|
||||
//purpose : Defines a named string. If the string already exists,
|
||||
// : it changes its value to <theString>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::SetString(const TCollection_ExtendedString& theName,
|
||||
const TCollection_ExtendedString& theString)
|
||||
{
|
||||
if(!HasStrings()) {
|
||||
TDataStd_DataMapOfStringString aMap;
|
||||
myStrings = new TDataStd_HDataMapOfStringString(aMap);
|
||||
}
|
||||
if (!myStrings->Map().IsBound(theName) || myStrings->Map().Find(theName) != theString)
|
||||
{
|
||||
Backup();
|
||||
if (myStrings->Map().IsBound(theName))
|
||||
myStrings->ChangeMap().ChangeFind(theName) = theString;
|
||||
else
|
||||
myStrings->ChangeMap().Bind(theName, theString);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetStringsContainer
|
||||
//purpose : Returns the internal container of named strings.
|
||||
//=======================================================================
|
||||
const TDataStd_DataMapOfStringString& TDataStd_NamedData::GetStringsContainer()
|
||||
{
|
||||
if(!HasStrings()) {
|
||||
TDataStd_DataMapOfStringString aMap;
|
||||
myStrings = new TDataStd_HDataMapOfStringString(aMap);
|
||||
}
|
||||
return myStrings->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeStrings
|
||||
//purpose : Replace the container content by new content of the <theStrings>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::ChangeStrings(const TDataStd_DataMapOfStringString& theStrings)
|
||||
{
|
||||
if(!HasStrings()) {
|
||||
TDataStd_DataMapOfStringString aMap;
|
||||
myStrings = new TDataStd_HDataMapOfStringString(aMap);
|
||||
}
|
||||
if (&myStrings->Map() == &theStrings) return;
|
||||
Backup();
|
||||
myStrings->ChangeMap().Assign(theStrings);
|
||||
}
|
||||
|
||||
|
||||
//Category: Bytes
|
||||
// =====
|
||||
//=======================================================================
|
||||
//function : HasByte
|
||||
//purpose : Returns true if the attribute contains this named byte.
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_NamedData::HasByte(const TCollection_ExtendedString& theName) const
|
||||
{
|
||||
if(!HasBytes()) return Standard_False;
|
||||
return myBytes->Map().IsBound(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetByte
|
||||
//purpose : Returns the named byte. It returns 0 if there is no such
|
||||
// : a named byte (use HasByte()).
|
||||
//=======================================================================
|
||||
Standard_Byte TDataStd_NamedData::GetByte(const TCollection_ExtendedString& theName)
|
||||
{
|
||||
if(!HasBytes()) {
|
||||
TDataStd_DataMapOfStringByte aMap;
|
||||
myBytes = new TDataStd_HDataMapOfStringByte(aMap);
|
||||
}
|
||||
return myBytes->Map()(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetByte
|
||||
//purpose : Defines a named byte. If the byte already exists,
|
||||
// : it changes its value to <theByte>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::SetByte(const TCollection_ExtendedString& theName,
|
||||
const Standard_Byte theByte)
|
||||
{
|
||||
if(!HasBytes()) {
|
||||
TDataStd_DataMapOfStringByte aMap;
|
||||
myBytes = new TDataStd_HDataMapOfStringByte(aMap);
|
||||
}
|
||||
if (!myBytes->Map().IsBound(theName) || myBytes->Map().Find(theName) != theByte)
|
||||
{
|
||||
Backup();
|
||||
if (myBytes->Map().IsBound(theName))
|
||||
myBytes->ChangeMap().ChangeFind(theName) = theByte;
|
||||
else
|
||||
myBytes->ChangeMap().Bind(theName, theByte);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetBytesContainer
|
||||
//purpose : Returns the internal container of named bytes.
|
||||
//=======================================================================
|
||||
const TDataStd_DataMapOfStringByte& TDataStd_NamedData::GetBytesContainer()
|
||||
{
|
||||
if(!HasBytes()) {
|
||||
TDataStd_DataMapOfStringByte aMap;
|
||||
myBytes = new TDataStd_HDataMapOfStringByte(aMap);
|
||||
}
|
||||
return myBytes->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeBytes
|
||||
//purpose : Replace the container content by new content of the <theBytes>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::ChangeBytes(const TDataStd_DataMapOfStringByte& theBytes)
|
||||
{
|
||||
if(!HasBytes()) {
|
||||
TDataStd_DataMapOfStringByte aMap;
|
||||
myBytes = new TDataStd_HDataMapOfStringByte(aMap);
|
||||
}
|
||||
if (&myBytes->Map() == &theBytes) return;
|
||||
Backup();
|
||||
myBytes->ChangeMap().Assign(theBytes);
|
||||
}
|
||||
|
||||
|
||||
//Category: Arrays of integers
|
||||
// ==================
|
||||
//=======================================================================
|
||||
//function : HasArrayOfIntegers
|
||||
//purpose : Returns true if the attribute contains this named array
|
||||
// : of integer values.
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_NamedData::HasArrayOfIntegers
|
||||
(const TCollection_ExtendedString& theName) const
|
||||
{
|
||||
if(!HasArraysOfIntegers()) return Standard_False;
|
||||
return myArraysOfIntegers->Map().IsBound(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetArrayOfIntegers
|
||||
//purpose : Returns the named array of integer values. It returns a NULL
|
||||
// : Handle if there is no such a named array of integers
|
||||
//=======================================================================
|
||||
const Handle(TColStd_HArray1OfInteger)& TDataStd_NamedData::GetArrayOfIntegers
|
||||
(const TCollection_ExtendedString& theName)
|
||||
{
|
||||
if(!HasArraysOfIntegers()) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger aMap;
|
||||
myArraysOfIntegers = new TDataStd_HDataMapOfStringHArray1OfInteger(aMap);
|
||||
}
|
||||
return myArraysOfIntegers->Map().Find(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetArrayOfIntegers
|
||||
//purpose : Defines a named array of integer values.
|
||||
// : If the array already exists, it changes its value to <theArrayOfIntegers>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::SetArrayOfIntegers(const TCollection_ExtendedString& theName,
|
||||
const Handle(TColStd_HArray1OfInteger)& theArrayOfIntegers)
|
||||
{
|
||||
if(!HasArraysOfIntegers()) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger aMap;
|
||||
myArraysOfIntegers = new TDataStd_HDataMapOfStringHArray1OfInteger(aMap);
|
||||
}
|
||||
|
||||
Backup();
|
||||
// Deep copy of the array
|
||||
Handle(TColStd_HArray1OfInteger) arr;
|
||||
if (!theArrayOfIntegers.IsNull())
|
||||
{
|
||||
Standard_Integer lower = theArrayOfIntegers->Lower(), i = lower, upper = theArrayOfIntegers->Upper();
|
||||
arr = new TColStd_HArray1OfInteger(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
arr->SetValue(i, theArrayOfIntegers->Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (myArraysOfIntegers->Map().IsBound(theName))
|
||||
myArraysOfIntegers->ChangeMap().ChangeFind(theName) = arr;
|
||||
else
|
||||
myArraysOfIntegers->ChangeMap().Bind(theName, arr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetArraysOfIntegersContainer
|
||||
//purpose : Returns the internal container of named arrays of integer values.
|
||||
//=======================================================================
|
||||
const TDataStd_DataMapOfStringHArray1OfInteger& TDataStd_NamedData::
|
||||
GetArraysOfIntegersContainer()
|
||||
{
|
||||
if(!HasArraysOfIntegers()) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger aMap;
|
||||
myArraysOfIntegers = new TDataStd_HDataMapOfStringHArray1OfInteger(aMap);
|
||||
}
|
||||
return myArraysOfIntegers->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeArraysOfIntegers
|
||||
//purpose : Replace the container content by new content of the <theIntegers>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::ChangeArraysOfIntegers
|
||||
(const TDataStd_DataMapOfStringHArray1OfInteger& theIntegers)
|
||||
{
|
||||
if(!HasArraysOfIntegers()) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger aMap;
|
||||
myArraysOfIntegers = new TDataStd_HDataMapOfStringHArray1OfInteger(aMap);
|
||||
}
|
||||
if (&myArraysOfIntegers->Map() == &theIntegers) return;
|
||||
Backup();
|
||||
myArraysOfIntegers->ChangeMap().Assign(theIntegers);
|
||||
}
|
||||
|
||||
|
||||
//Category: Arrays of reals
|
||||
// ===============
|
||||
//=======================================================================
|
||||
//function : HasArrayOfReals
|
||||
//purpose : Returns true if the attribute contains this named array of
|
||||
// : real values.
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_NamedData::HasArrayOfReals
|
||||
(const TCollection_ExtendedString& theName) const
|
||||
{
|
||||
if(!HasArraysOfReals()) return Standard_False;
|
||||
return myArraysOfReals->Map().IsBound(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetArrayOfReals
|
||||
//purpose : Returns the named array of real values. It returns a NULL
|
||||
// : Handle if there is no such a named array of reals.
|
||||
//=======================================================================
|
||||
const Handle(TColStd_HArray1OfReal)& TDataStd_NamedData::GetArrayOfReals
|
||||
(const TCollection_ExtendedString& theName)
|
||||
{
|
||||
if(!HasArraysOfReals()) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aMap;
|
||||
myArraysOfReals = new TDataStd_HDataMapOfStringHArray1OfReal(aMap);
|
||||
}
|
||||
return myArraysOfReals->Map().Find(theName);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetArrayOfReals
|
||||
//purpose : Defines a named array of real values.
|
||||
// : If the array already exists, it changes its value to <theArrayOfReals>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::SetArrayOfReals(const TCollection_ExtendedString& theName,
|
||||
const Handle(TColStd_HArray1OfReal)& theArrayOfReals)
|
||||
{
|
||||
if(!HasArraysOfReals()) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aMap;
|
||||
myArraysOfReals = new TDataStd_HDataMapOfStringHArray1OfReal(aMap);
|
||||
}
|
||||
Backup();
|
||||
|
||||
// Deep copy of the array
|
||||
Handle(TColStd_HArray1OfReal) arr;
|
||||
if (!theArrayOfReals.IsNull())
|
||||
{
|
||||
Standard_Integer lower = theArrayOfReals->Lower(), i = lower, upper = theArrayOfReals->Upper();
|
||||
arr = new TColStd_HArray1OfReal(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
arr->SetValue(i, theArrayOfReals->Value(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (myArraysOfReals->Map().IsBound(theName))
|
||||
myArraysOfReals->ChangeMap().ChangeFind(theName) = arr;
|
||||
else
|
||||
myArraysOfReals->ChangeMap().Bind(theName, arr);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetArraysOfRealsContainer
|
||||
//purpose : Returns the internal container of named arrays of real values.
|
||||
//=======================================================================
|
||||
const TDataStd_DataMapOfStringHArray1OfReal& TDataStd_NamedData::
|
||||
GetArraysOfRealsContainer()
|
||||
{
|
||||
if(!HasArraysOfReals()) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aMap;
|
||||
myArraysOfReals = new TDataStd_HDataMapOfStringHArray1OfReal(aMap);
|
||||
}
|
||||
return myArraysOfReals->Map();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeArraysOfReals
|
||||
//purpose : Replace the container content by new content of the <theReals>.
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::ChangeArraysOfReals
|
||||
(const TDataStd_DataMapOfStringHArray1OfReal& theReals)
|
||||
{
|
||||
if(!HasArraysOfReals()) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aMap;
|
||||
myArraysOfReals = new TDataStd_HDataMapOfStringHArray1OfReal(aMap);
|
||||
}
|
||||
if (&myArraysOfReals->Map() == &theReals) return;
|
||||
Backup();
|
||||
myArraysOfReals->ChangeMap().Assign(theReals);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_NamedData::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_NamedData::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_NamedData();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
|
||||
Handle(TDataStd_NamedData) ND = Handle(TDataStd_NamedData)::DownCast(With);
|
||||
if(ND.IsNull()) return;
|
||||
// Integers
|
||||
if (!ND->GetIntegersContainer().IsEmpty())
|
||||
{
|
||||
if(!HasIntegers()) {
|
||||
TColStd_DataMapOfStringInteger aMap;
|
||||
myIntegers = new TDataStd_HDataMapOfStringInteger(aMap);
|
||||
}
|
||||
myIntegers->ChangeMap().Assign(ND->GetIntegersContainer());
|
||||
}
|
||||
|
||||
// Reals
|
||||
if (!ND->GetRealsContainer().IsEmpty())
|
||||
{
|
||||
if(!HasReals()) {
|
||||
TDataStd_DataMapOfStringReal aMap;
|
||||
myReals = new TDataStd_HDataMapOfStringReal(aMap);
|
||||
}
|
||||
myReals->ChangeMap().Assign(ND->GetRealsContainer());
|
||||
|
||||
}
|
||||
|
||||
// Strings
|
||||
if (!ND->GetStringsContainer().IsEmpty())
|
||||
{
|
||||
if(!HasStrings()) {
|
||||
TDataStd_DataMapOfStringString aMap;
|
||||
myStrings = new TDataStd_HDataMapOfStringString(aMap);
|
||||
}
|
||||
myStrings->ChangeMap().Assign(ND->GetStringsContainer());
|
||||
|
||||
}
|
||||
|
||||
// Bytes
|
||||
if (!ND->GetBytesContainer().IsEmpty())
|
||||
{
|
||||
if(!HasBytes()) {
|
||||
TDataStd_DataMapOfStringByte aMap;
|
||||
myBytes = new TDataStd_HDataMapOfStringByte(aMap);
|
||||
}
|
||||
myBytes->ChangeMap().Assign(ND->GetBytesContainer());
|
||||
|
||||
}
|
||||
|
||||
// Arrays of integers
|
||||
if (!ND->GetArraysOfIntegersContainer().IsEmpty())
|
||||
{
|
||||
if(!HasArraysOfIntegers()) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger aMap;
|
||||
myArraysOfIntegers = new TDataStd_HDataMapOfStringHArray1OfInteger(aMap);
|
||||
}
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger itr(ND->GetArraysOfIntegersContainer());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
// Deep copy of the arrays
|
||||
const Handle(TColStd_HArray1OfInteger)& ints = itr.Value();
|
||||
Handle(TColStd_HArray1OfInteger) copied_ints;
|
||||
if (!ints.IsNull())
|
||||
{
|
||||
Standard_Integer lower = ints->Lower(), i = lower, upper = ints->Upper();
|
||||
copied_ints = new TColStd_HArray1OfInteger(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
copied_ints->SetValue(i, ints->Value(i));
|
||||
}
|
||||
}
|
||||
myArraysOfIntegers->ChangeMap().Bind(itr.Key(), copied_ints);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrays of realss
|
||||
if (!ND->GetArraysOfRealsContainer().IsEmpty())
|
||||
{
|
||||
if(!HasArraysOfReals()) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aMap;
|
||||
myArraysOfReals = new TDataStd_HDataMapOfStringHArray1OfReal(aMap);
|
||||
}
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal itr(ND->GetArraysOfRealsContainer());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
// Deep copy of the arrays
|
||||
const Handle(TColStd_HArray1OfReal)& dbls = itr.Value();
|
||||
Handle(TColStd_HArray1OfReal) copied_dbls;
|
||||
if (!dbls.IsNull())
|
||||
{
|
||||
Standard_Integer lower = dbls->Lower(), i = lower, upper = dbls->Upper();
|
||||
copied_dbls = new TColStd_HArray1OfReal(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
copied_dbls->SetValue(i, dbls->Value(i));
|
||||
}
|
||||
}
|
||||
myArraysOfReals->ChangeMap().Bind(itr.Key(), copied_dbls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_NamedData::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(TDataStd_NamedData) ND = Handle(TDataStd_NamedData)::DownCast(Into);
|
||||
if (ND.IsNull()) return;
|
||||
|
||||
// Integers
|
||||
if (HasIntegers() && !myIntegers->Map().IsEmpty())
|
||||
{
|
||||
if(!ND->HasIntegers()) {
|
||||
TColStd_DataMapOfStringInteger aMap;
|
||||
ND->myIntegers = new TDataStd_HDataMapOfStringInteger(aMap);
|
||||
};
|
||||
ND->myIntegers->ChangeMap().Assign(myIntegers->Map());
|
||||
}
|
||||
|
||||
// Reals
|
||||
if (HasReals() && !myReals->Map().IsEmpty())
|
||||
{
|
||||
if(!ND->HasReals()) {
|
||||
TDataStd_DataMapOfStringReal aMap;
|
||||
ND->myReals = new TDataStd_HDataMapOfStringReal(aMap);
|
||||
};
|
||||
ND->myReals->ChangeMap().Assign(myReals->Map());
|
||||
|
||||
}
|
||||
|
||||
// Strings
|
||||
if (HasStrings() && !myStrings->Map().IsEmpty())
|
||||
{
|
||||
if(!ND->HasStrings()) {
|
||||
TDataStd_DataMapOfStringString aMap;
|
||||
ND->myStrings = new TDataStd_HDataMapOfStringString(aMap);
|
||||
};
|
||||
ND->myStrings->ChangeMap().Assign(myStrings->Map());
|
||||
}
|
||||
|
||||
// Bytes
|
||||
if (HasBytes() && !myBytes->Map().IsEmpty())
|
||||
{
|
||||
if(!ND->HasBytes()) {
|
||||
TDataStd_DataMapOfStringByte aMap;
|
||||
ND->myBytes = new TDataStd_HDataMapOfStringByte(aMap);
|
||||
};
|
||||
ND->myBytes->ChangeMap().Assign(myBytes->Map());
|
||||
}
|
||||
|
||||
// Arrays of integers
|
||||
if (HasArraysOfIntegers() && !myArraysOfIntegers->Map().IsEmpty())
|
||||
{
|
||||
if(!ND->HasArraysOfIntegers()) {
|
||||
TDataStd_DataMapOfStringHArray1OfInteger aMap;
|
||||
ND->myArraysOfIntegers = new TDataStd_HDataMapOfStringHArray1OfInteger(aMap);
|
||||
}
|
||||
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfInteger itr(myArraysOfIntegers->Map());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
const Handle(TColStd_HArray1OfInteger)& ints = itr.Value();
|
||||
Handle(TColStd_HArray1OfInteger) copied_ints;
|
||||
if (!ints.IsNull())
|
||||
{
|
||||
Standard_Integer lower = ints->Lower(), i = lower, upper = ints->Upper();
|
||||
copied_ints = new TColStd_HArray1OfInteger(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
copied_ints->SetValue(i, ints->Value(i));
|
||||
}
|
||||
}
|
||||
ND->myArraysOfIntegers->ChangeMap().Bind(itr.Key(), copied_ints);
|
||||
}
|
||||
}
|
||||
|
||||
// Arrays of reals
|
||||
if (HasArraysOfReals() && !myArraysOfReals->Map().IsEmpty())
|
||||
{
|
||||
if(!ND->HasArraysOfReals()) {
|
||||
TDataStd_DataMapOfStringHArray1OfReal aMap;
|
||||
ND->myArraysOfReals = new TDataStd_HDataMapOfStringHArray1OfReal(aMap);
|
||||
}
|
||||
TDataStd_DataMapIteratorOfDataMapOfStringHArray1OfReal itr(myArraysOfReals->Map());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
const Handle(TColStd_HArray1OfReal)& dbls = itr.Value();
|
||||
Handle(TColStd_HArray1OfReal) copied_dbls;
|
||||
if (!dbls.IsNull())
|
||||
{
|
||||
Standard_Integer lower = dbls->Lower(), i = lower, upper = dbls->Upper();
|
||||
copied_dbls = new TColStd_HArray1OfReal(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
copied_dbls->SetValue(i, dbls->Value(i));
|
||||
}
|
||||
}
|
||||
ND->myArraysOfReals->ChangeMap().Bind(itr.Key(), copied_dbls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_NamedData::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "NamedData: ";
|
||||
anOS << "\tIntegers = " << HasIntegers() ? myIntegers->Map().Extent() : 0;
|
||||
anOS << "\tReals = " << HasReals() ? myReals->Map().Extent() : 0;
|
||||
anOS << "\tStrings = " << HasStrings() ? myStrings->Map().Extent() : 0;
|
||||
anOS << "\tBytes = " << HasBytes() ? myBytes->Map().Extent() : 0;
|
||||
anOS << "\tArraysOfIntegers = " << HasArraysOfIntegers() ? myArraysOfIntegers->Map().Extent() : 0;
|
||||
anOS << "\tArraysOfReals = " << HasArraysOfReals() ? myArraysOfReals->Map().Extent() : 0;
|
||||
return anOS;
|
||||
}
|
62
src/TDataStd/TDataStd_NamedData.lxx
Executable file
62
src/TDataStd/TDataStd_NamedData.lxx
Executable file
@@ -0,0 +1,62 @@
|
||||
// File: TDataStd_NamedData.lxx
|
||||
// Created: Mon Aug 20 11:34:13 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <szy@popox.nnov.matra-dtv.fr>
|
||||
// Copyright: Open CASCADE SA 2007
|
||||
|
||||
//=======================================================================
|
||||
//function : HasIntegers
|
||||
//purpose : Returns true if there are some named integers in the attribute.
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Boolean TDataStd_NamedData::HasIntegers() const
|
||||
{
|
||||
return !myIntegers.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasReals
|
||||
//purpose : Returns true if there are some named reals in the attribute.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_NamedData::HasReals() const
|
||||
{
|
||||
return !myReals.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasStrings
|
||||
//purpose : Returns true if there are some named strings in the attribute.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_NamedData::HasStrings() const
|
||||
{
|
||||
return !myStrings.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasBytes
|
||||
//purpose : Returns true if there are some named bytes in the attribute.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_NamedData::HasBytes() const
|
||||
{
|
||||
return !myBytes.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasArraysOfIntegers
|
||||
//purpose : Returns true if there are at least one array of integer
|
||||
// : values in the internal container of the attribute.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_NamedData::HasArraysOfIntegers() const
|
||||
{
|
||||
return !myArraysOfIntegers.IsNull();
|
||||
}
|
||||
//=======================================================================
|
||||
//function : HasArraysOfReals
|
||||
//purpose : Returns true if there are some named arrays of real values
|
||||
// : in the attribute.
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_NamedData::HasArraysOfReals() const
|
||||
{
|
||||
return !myArraysOfReals.IsNull();
|
||||
}
|
||||
|
81
src/TDataStd/TDataStd_NoteBook.cdl
Executable file
81
src/TDataStd/TDataStd_NoteBook.cdl
Executable file
@@ -0,0 +1,81 @@
|
||||
-- File: TDataStd_NoteBook.cdl
|
||||
-- Created: Tue Jul 29 14:32:05 1997
|
||||
-- Author: Denis PASCAL
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class NoteBook from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: NoteBook Object attribute
|
||||
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
Real from TDataStd,
|
||||
Integer from TDataStd,
|
||||
GUID from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
Find (myclass; current : Label from TDF; N : in out NoteBook from TDataStd)
|
||||
---Purpose: try to retrieve a NoteBook attribute at <current> label
|
||||
-- or in fathers label of <current>. Returns True if
|
||||
-- found and set <N>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
New (myclass; label : Label from TDF)
|
||||
---Purpose: Create an enpty NoteBook attribute, located at
|
||||
-- <label>. Raises if <label> has attribute
|
||||
returns NoteBook from TDataStd;
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
---Purpose: NoteBook methods
|
||||
-- ===============
|
||||
|
||||
Create
|
||||
returns mutable NoteBook from TDataStd;
|
||||
|
||||
|
||||
Append (me : mutable; value : Real from Standard;
|
||||
isExported : Boolean from Standard = Standard_False)
|
||||
---Purpose: Tool to Create an Integer attribute from <value>,
|
||||
-- Insert it in a new son label of <me>. The Real
|
||||
-- attribute is returned.
|
||||
returns Real from TDataStd;
|
||||
|
||||
Append (me : mutable; value : Integer from Standard;
|
||||
isExported : Boolean from Standard = Standard_False)
|
||||
---Purpose: Tool to Create an Real attribute from <value>, Insert
|
||||
-- it in a new son label of <me>. The Integer attribute
|
||||
-- is returned.
|
||||
returns Integer from TDataStd;
|
||||
|
||||
|
||||
---Category: methodes de TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
end NoteBook;
|
152
src/TDataStd/TDataStd_NoteBook.cxx
Executable file
152
src/TDataStd/TDataStd_NoteBook.cxx
Executable file
@@ -0,0 +1,152 @@
|
||||
// File: TDataStd_NoteBook.cxx
|
||||
// Created: Tue Jul 29 14:43:24 1997
|
||||
// Author: Denis PASCAL
|
||||
|
||||
|
||||
#include <TDataStd_NoteBook.ixx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Find
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_NoteBook::Find (const TDF_Label& current,
|
||||
Handle(TDataStd_NoteBook)& N)
|
||||
{
|
||||
TDF_Label L = current;
|
||||
Handle(TDataStd_NoteBook) NB;
|
||||
if (L.IsNull()) return Standard_False;
|
||||
|
||||
while (1) {
|
||||
if(L.FindAttribute(TDataStd_NoteBook::GetID(), NB)) break;
|
||||
L = L.Father();
|
||||
if (L.IsNull()) break;
|
||||
}
|
||||
|
||||
if (!NB.IsNull()) {
|
||||
N = NB;
|
||||
return Standard_True;
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : New
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_NoteBook) TDataStd_NoteBook::New (const TDF_Label& label)
|
||||
{
|
||||
if (label.HasAttribute()) {
|
||||
Standard_DomainError::Raise("TDataStd_NoteBook::New : not an empty label");
|
||||
}
|
||||
Handle(TDataStd_NoteBook) NB = new TDataStd_NoteBook ();
|
||||
label.AddAttribute(NB);
|
||||
TDF_TagSource::Set(label); // distributeur de sous label
|
||||
return NB;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_NoteBook::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_NoteBookID("2a96b609-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_NoteBookID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_NoteBook
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_NoteBook::TDataStd_NoteBook()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Append Real Variable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Real) TDataStd_NoteBook::Append(const Standard_Real value,
|
||||
const Standard_Boolean )
|
||||
{
|
||||
TDF_Label newlabel = TDF_TagSource::NewChild (Label());
|
||||
Handle(TDataStd_Real) variable = TDataStd_Real::Set ( newlabel, value);
|
||||
return variable;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append Integer Variable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Integer) TDataStd_NoteBook::Append(const Standard_Integer value,
|
||||
const Standard_Boolean )
|
||||
{
|
||||
TDF_Label newlabel = TDF_TagSource::NewChild (Label());
|
||||
Handle(TDataStd_Integer) variable = TDataStd_Integer::Set ( newlabel, value);
|
||||
return variable;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_NoteBook::ID() const
|
||||
{ return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_NoteBook::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_NoteBook();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_NoteBook::Restore(const Handle(TDF_Attribute)& )
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_NoteBook::Paste (const Handle(TDF_Attribute)& ,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_NoteBook::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "NoteBook";
|
||||
return anOS;
|
||||
}
|
||||
|
||||
|
85
src/TDataStd/TDataStd_Real.cdl
Executable file
85
src/TDataStd/TDataStd_Real.cdl
Executable file
@@ -0,0 +1,85 @@
|
||||
-- File: TDataStd_Real.cdl
|
||||
-- Created: Thu Feb 6 16:48:25 1997
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class Real from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: The basis to define a real number attribute.
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
Real from Standard,
|
||||
RelocationTable from TDF,
|
||||
RealEnum from TDataStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for real numbers.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass ; label : Label from TDF; value : Real from Standard)
|
||||
---Purpose: Finds, or creates, an Real attribute and sets <value> the
|
||||
-- Real attribute is returned. the Real dimension is
|
||||
-- Scalar by default. use SetDimension to overwrite.
|
||||
returns Real from TDataStd;
|
||||
|
||||
---Purpose: Real methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Real from TDataStd;
|
||||
|
||||
SetDimension (me : mutable; DIM : RealEnum from TDataStd);
|
||||
|
||||
|
||||
GetDimension (me)
|
||||
returns RealEnum from TDataStd;
|
||||
|
||||
|
||||
Set (me : mutable; V : Real from Standard);
|
||||
---Purpose:
|
||||
-- Finds or creates the real number V.
|
||||
|
||||
Get (me)
|
||||
returns Real from Standard;
|
||||
---Purpose:
|
||||
-- Returns the real number value contained in the attribute.
|
||||
IsCaptured(me) returns Boolean;
|
||||
---Purpose: Returns True if there is a reference on the same label
|
||||
|
||||
---Category: TDF_Attribute methods
|
||||
-- =====================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty(me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
fields
|
||||
|
||||
myValue : Real from Standard;
|
||||
myDimension : RealEnum from TDataStd;
|
||||
|
||||
end Real;
|
175
src/TDataStd/TDataStd_Real.cxx
Executable file
175
src/TDataStd/TDataStd_Real.cxx
Executable file
@@ -0,0 +1,175 @@
|
||||
// File: TDataStd_Real.cxx
|
||||
// Created: Thu Mar 6 10:31:18 1997
|
||||
// Author: Denis PASCAL
|
||||
|
||||
|
||||
#include <TDataStd_Real.ixx>
|
||||
#include <TDF_Reference.hxx>
|
||||
#include <TDataStd.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Real::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_RealID("2a96b60f-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_RealID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Real) TDataStd_Real::Set (const TDF_Label& L,
|
||||
const Standard_Real V)
|
||||
{
|
||||
Handle(TDataStd_Real) A;
|
||||
if (!L.FindAttribute(TDataStd_Real::GetID(), A)) {
|
||||
A = new TDataStd_Real ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
A->Set (V);
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Real
|
||||
//purpose : Empty constructor
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Real::TDataStd_Real ()
|
||||
: myValue (RealFirst()),
|
||||
myDimension (TDataStd_SCALAR)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCaptured
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Real::IsCaptured() const
|
||||
{
|
||||
Handle(TDF_Reference) reference;
|
||||
// pour test
|
||||
|
||||
if (Label().FindAttribute(TDF_Reference::GetID(),reference)) {
|
||||
const TDF_Label& label = reference->Get();
|
||||
return label.IsAttribute (TDataStd_Real::GetID());
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Real::Set(const Standard_Real v)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if( myValue == v) return;
|
||||
|
||||
Backup();
|
||||
myValue = v;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real TDataStd_Real::Get() const { return myValue; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDimension
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Real::SetDimension (const TDataStd_RealEnum DIM)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myDimension == DIM) return;
|
||||
|
||||
Backup();
|
||||
myDimension = DIM;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetDimension
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_RealEnum TDataStd_Real::GetDimension () const
|
||||
{
|
||||
return myDimension;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Real::ID() const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Real::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_Real();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Real::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (With);
|
||||
myValue = R->Get();
|
||||
myDimension = R->GetDimension();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Real::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_Real) R = Handle(TDataStd_Real)::DownCast (Into);
|
||||
R->Set(myValue);
|
||||
R->SetDimension(myDimension);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Real::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Real ";
|
||||
TDataStd::Print(GetDimension(),anOS);
|
||||
return anOS;
|
||||
}
|
||||
|
126
src/TDataStd/TDataStd_RealArray.cdl
Executable file
126
src/TDataStd/TDataStd_RealArray.cdl
Executable file
@@ -0,0 +1,126 @@
|
||||
-- File: TDataStd_RealArray.cdl
|
||||
-- Created: Wed Jun 16 17:04:48 1999
|
||||
-- Author: Sergey RUIN
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
class RealArray from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: A framework for an attribute composed of a real number array.
|
||||
|
||||
uses
|
||||
HArray1OfReal from TColStd,
|
||||
GUID from Standard,
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
DeltaOnModification from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the GUID for arrays of reals.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF; lower, upper : Integer from Standard;
|
||||
isDelta : Boolean from Standard = Standard_False)
|
||||
---Purpose: Finds or creates on the <label> a real array attribute
|
||||
-- with the specified <lower> and <upper> boundaries.
|
||||
-- If attribute is already set, all input parameters are refused and the found
|
||||
-- attribute is returned.
|
||||
returns RealArray from TDataStd;
|
||||
|
||||
|
||||
---Category: RealArray methods
|
||||
-- ===============
|
||||
|
||||
Init(me : mutable; lower, upper : Integer from Standard);
|
||||
---Purpose: Initialize the inner array with bounds from <lower> to <upper>
|
||||
|
||||
SetValue (me : mutable; Index :Integer from Standard; Value : Real from Standard);
|
||||
---Purpose: Sets the <Index>th element of the array to <Value>
|
||||
|
||||
Value (me; Index : Integer from Standard)
|
||||
---Purpose: Return the value of the <Index>th element of the array
|
||||
--
|
||||
---C++: alias operator ()
|
||||
returns Real from Standard;
|
||||
|
||||
Lower (me) returns Integer from Standard;
|
||||
---Purpose: Returns the lower boundary of the array.
|
||||
|
||||
Upper (me) returns Integer from Standard;
|
||||
---Purpose: Returns the upper boundary of the array.
|
||||
|
||||
Length (me) returns Integer from Standard;
|
||||
---Purpose: Returns the number of elements of the array of reals
|
||||
-- in terms of the number of elements it contains.
|
||||
|
||||
ChangeArray(me : mutable; newArray : HArray1OfReal from TColStd;
|
||||
isCheckItems : Boolean = Standard_True);
|
||||
---Purpose: Sets the inner array <myValue> of the RealArray attribute
|
||||
-- to <newArray>. If value of <newArray> differs from <myValue>,
|
||||
-- Backup performed and myValue refers to new instance of HArray1OfReal
|
||||
-- that holds <newArray> values
|
||||
-- If <isCheckItems> equal True each item of <newArray> will be checked with each
|
||||
-- item of <myValue> for coincidence (to avoid backup).
|
||||
|
||||
Array(me) returns HArray1OfReal from TColStd;
|
||||
---Purpose: Returns the handle of this array of reals.
|
||||
---C++: inline
|
||||
---C++: return const
|
||||
|
||||
GetDelta(me) returns Boolean from Standard;
|
||||
---C++: inline
|
||||
|
||||
SetDelta(me : mutable; isDelta : Boolean from Standard);
|
||||
---C++: inline
|
||||
---Purpose: for internal use only!
|
||||
|
||||
RemoveArray(me : mutable) is private;
|
||||
---C++: inline
|
||||
|
||||
---Category: methodes of TDF_Attribute
|
||||
-- =========================
|
||||
Create
|
||||
returns mutable RealArray from TDataStd;
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
---Purpose: Note. Uses inside ChangeArray() method
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
---Category: methods to be added for using in DeltaOnModification
|
||||
-- =====================================================
|
||||
DeltaOnModification(me; anOldAttribute : Attribute from TDF)
|
||||
returns DeltaOnModification from TDF
|
||||
---Purpose : Makes a DeltaOnModification between <me> and
|
||||
-- <anOldAttribute>.
|
||||
is redefined virtual;
|
||||
fields
|
||||
|
||||
myValue : HArray1OfReal from TColStd;
|
||||
myIsDelta : Boolean from Standard;
|
||||
|
||||
friends
|
||||
|
||||
class DeltaOnModificationOfRealArray from TDataStd
|
||||
|
||||
end RealArray;
|
261
src/TDataStd/TDataStd_RealArray.cxx
Executable file
261
src/TDataStd/TDataStd_RealArray.cxx
Executable file
@@ -0,0 +1,261 @@
|
||||
// File: TDataStd_RealArray.cxx
|
||||
// Created: Wed Jun 16 10:32:25 1999
|
||||
// Author: Sergey RUIN
|
||||
|
||||
|
||||
#include <TDataStd_RealArray.ixx>
|
||||
#include <TDataStd_DeltaOnModificationOfRealArray.hxx>
|
||||
#include <TDF_DefaultDeltaOnModification.hxx>
|
||||
#define OCC2932
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_RealArray::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_RealArrayID ("2a96b61e-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_RealArrayID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_RealArray
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_RealArray::TDataStd_RealArray() : myIsDelta(Standard_False){}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_RealArray::Init(const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Backup(); // jfa 15.01.2003 for LH3D1378
|
||||
|
||||
myValue = new TColStd_HArray1OfReal(lower, upper, 0.);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_RealArray) TDataStd_RealArray::Set
|
||||
(const TDF_Label& label,
|
||||
const Standard_Integer lower,
|
||||
const Standard_Integer upper,
|
||||
const Standard_Boolean isDelta)
|
||||
{
|
||||
Handle(TDataStd_RealArray) A;
|
||||
if (!label.FindAttribute (TDataStd_RealArray::GetID(), A)) {
|
||||
A = new TDataStd_RealArray;
|
||||
A->Init (lower, upper);
|
||||
A->SetDelta(isDelta);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
else if (lower != A->Lower() || upper != A->Upper())
|
||||
{
|
||||
A->Init (lower, upper);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_RealArray::SetValue (const Standard_Integer index,
|
||||
const Standard_Real value)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myValue.IsNull()) return;
|
||||
if(myValue->Value(index) == value)
|
||||
return;
|
||||
|
||||
Backup();
|
||||
myValue->SetValue(index, value);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real TDataStd_RealArray::Value (const Standard_Integer index) const
|
||||
{
|
||||
if(myValue.IsNull()) return RealFirst();
|
||||
return myValue->Value(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Lower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_RealArray::Lower (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Lower();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Upper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_RealArray::Upper (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Upper();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_RealArray::Length (void) const
|
||||
{
|
||||
if(myValue.IsNull()) return 0;
|
||||
return myValue->Length();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeArray
|
||||
//purpose : If value of <newArray> differs from <myValue>, Backup
|
||||
// : performed and myValue refers to new instance of HArray1OfReal
|
||||
// : that holds <newArray>
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_RealArray::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArray,
|
||||
const Standard_Boolean isCheckItems)
|
||||
{
|
||||
Standard_Integer aLower = newArray->Lower();
|
||||
Standard_Integer anUpper = newArray->Upper();
|
||||
Standard_Boolean aDimEqual = Standard_False;
|
||||
Standard_Integer i;
|
||||
|
||||
#ifdef OCC2932
|
||||
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
|
||||
aDimEqual = Standard_True;
|
||||
Standard_Boolean isEqual = Standard_True;
|
||||
if(isCheckItems) {
|
||||
for(i = aLower; i <= anUpper; i++) {
|
||||
if(myValue->Value(i) != newArray->Value(i)) {
|
||||
isEqual = Standard_False;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(isEqual)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Backup();
|
||||
|
||||
if(!aDimEqual)
|
||||
myValue = new TColStd_HArray1OfReal(aLower, anUpper);
|
||||
|
||||
for(i = aLower; i <= anUpper; i++)
|
||||
myValue->SetValue(i, newArray->Value(i));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_RealArray::ID () const { return GetID(); }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_RealArray::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_RealArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_RealArray::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Standard_Integer i, lower, upper;
|
||||
Handle(TDataStd_RealArray) anArray = Handle(TDataStd_RealArray)::DownCast(With);
|
||||
if(!anArray->myValue.IsNull()) {
|
||||
lower = anArray->Lower();
|
||||
upper = anArray->Upper();
|
||||
myIsDelta = anArray->myIsDelta;
|
||||
myValue = new TColStd_HArray1OfReal(lower, upper);
|
||||
for(i = lower; i<=upper; i++)
|
||||
myValue->SetValue(i, anArray->Value(i));
|
||||
}
|
||||
else
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_RealArray::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
if(!myValue.IsNull()) {
|
||||
Handle(TDataStd_RealArray) anAtt = Handle(TDataStd_RealArray)::DownCast(Into);
|
||||
if(!anAtt.IsNull()) {
|
||||
anAtt->ChangeArray( myValue, Standard_False );
|
||||
anAtt->SetDelta(myIsDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_RealArray::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "\nRealArray::" << this <<" :";
|
||||
if(!myValue.IsNull()) {
|
||||
Standard_Integer i, lower, upper;
|
||||
lower = myValue->Lower();
|
||||
upper = myValue->Upper();
|
||||
for(i = lower; i<=upper; i++)
|
||||
anOS << " " <<myValue->Value(i);
|
||||
}
|
||||
anOS << " Delta is " << myIsDelta ? "ON":"OFF";
|
||||
anOS << endl;
|
||||
return anOS;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : DeltaOnModification
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_DeltaOnModification) TDataStd_RealArray::DeltaOnModification
|
||||
(const Handle(TDF_Attribute)& OldAtt) const
|
||||
{
|
||||
if(myIsDelta)
|
||||
return new TDataStd_DeltaOnModificationOfRealArray(*((Handle(TDataStd_RealArray)*)&OldAtt));
|
||||
else return new TDF_DefaultDeltaOnModification(OldAtt);
|
||||
}
|
42
src/TDataStd/TDataStd_RealArray.lxx
Executable file
42
src/TDataStd/TDataStd_RealArray.lxx
Executable file
@@ -0,0 +1,42 @@
|
||||
// File: TDataStd_RealArray.lxx
|
||||
// Created: Tue Oct 30 17:12:09 2007
|
||||
// Author: Sergey ZARITCHNY
|
||||
// <sergey.zaritchny@opencascade.com>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Array
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline const Handle(TColStd_HArray1OfReal) TDataStd_RealArray::Array(void) const
|
||||
{
|
||||
return myValue;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_RealArray::RemoveArray(void)
|
||||
{
|
||||
myValue.Nullify();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline void TDataStd_RealArray::SetDelta(const Standard_Boolean isDelta)
|
||||
{
|
||||
myIsDelta = isDelta;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : GetDelta
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Boolean TDataStd_RealArray::GetDelta(void) const
|
||||
{
|
||||
return myIsDelta;
|
||||
}
|
108
src/TDataStd/TDataStd_RealList.cdl
Executable file
108
src/TDataStd/TDataStd_RealList.cdl
Executable file
@@ -0,0 +1,108 @@
|
||||
-- File: TDataStd_RealList.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class RealList from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains a list of doubles.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
RelocationTable from TDF,
|
||||
ListOfReal from TColStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the list of doubles attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Finds or creates a list of double values attribute.
|
||||
returns RealList from TDataStd;
|
||||
|
||||
|
||||
---Category: RealList methods
|
||||
-- ===================
|
||||
|
||||
Create
|
||||
returns mutable RealList from TDataStd;
|
||||
|
||||
IsEmpty (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Extent (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
Prepend (me : mutable;
|
||||
value : Real from Standard);
|
||||
|
||||
Append (me : mutable;
|
||||
value : Real from Standard);
|
||||
|
||||
InsertBefore (me : mutable;
|
||||
value : Real from Standard;
|
||||
before_value : Real from Standard)
|
||||
---Purpose: Inserts the <value> before the first meet of <before_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
InsertAfter (me : mutable;
|
||||
value : Real from Standard;
|
||||
after_value : Real from Standard)
|
||||
---Purpose: Inserts the <value> after the first meet of <after_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Remove (me : mutable;
|
||||
value : Real from Standard)
|
||||
---Purpose: Removes the first meet of the <value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Clear (me : mutable);
|
||||
|
||||
First (me)
|
||||
returns Real from Standard;
|
||||
|
||||
Last (me)
|
||||
returns Real from Standard;
|
||||
|
||||
List (me)
|
||||
---C++: return const &
|
||||
returns ListOfReal from TColStd;
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myList : ListOfReal from TColStd;
|
||||
|
||||
|
||||
end RealList;
|
235
src/TDataStd/TDataStd_RealList.cxx
Executable file
235
src/TDataStd/TDataStd_RealList.cxx
Executable file
@@ -0,0 +1,235 @@
|
||||
// File: TDataStd_RealList.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_RealList.ixx>
|
||||
#include <TColStd_ListIteratorOfListOfReal.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_RealList::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_RealListID ("349ACE18-7CD6-4525-9938-FBBF22AA54D3");
|
||||
return TDataStd_RealListID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_RealList
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_RealList::TDataStd_RealList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_RealList) TDataStd_RealList::Set(const TDF_Label& label)
|
||||
{
|
||||
Handle(TDataStd_RealList) A;
|
||||
if (!label.FindAttribute (TDataStd_RealList::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_RealList;
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_RealList::IsEmpty() const
|
||||
{
|
||||
return myList.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_RealList::Extent() const
|
||||
{
|
||||
return myList.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_RealList::Prepend(const Standard_Real value)
|
||||
{
|
||||
Backup();
|
||||
myList.Prepend(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_RealList::Append(const Standard_Real value)
|
||||
{
|
||||
Backup();
|
||||
myList.Append(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertBefore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_RealList::InsertBefore(const Standard_Real value,
|
||||
const Standard_Real before_value)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfReal itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == before_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertBefore(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertAfter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_RealList::InsertAfter(const Standard_Real value,
|
||||
const Standard_Real after_value)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfReal itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == after_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertAfter(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_RealList::Remove(const Standard_Real value)
|
||||
{
|
||||
TColStd_ListIteratorOfListOfReal itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == value)
|
||||
{
|
||||
Backup();
|
||||
myList.Remove(itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_RealList::Clear()
|
||||
{
|
||||
Backup();
|
||||
myList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real TDataStd_RealList::First() const
|
||||
{
|
||||
return myList.First();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Real TDataStd_RealList::Last() const
|
||||
{
|
||||
return myList.Last();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : List
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TColStd_ListOfReal& TDataStd_RealList::List() const
|
||||
{
|
||||
return myList;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_RealList::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_RealList::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_RealList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_RealList::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myList.Clear();
|
||||
Handle(TDataStd_RealList) aList = Handle(TDataStd_RealList)::DownCast(With);
|
||||
TColStd_ListIteratorOfListOfReal itr(aList->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
myList.Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_RealList::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& ) const
|
||||
{
|
||||
Handle(TDataStd_RealList) aList = Handle(TDataStd_RealList)::DownCast(Into);
|
||||
aList->Clear();
|
||||
TColStd_ListIteratorOfListOfReal itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
aList->Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_RealList::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "RealList";
|
||||
return anOS;
|
||||
}
|
111
src/TDataStd/TDataStd_ReferenceArray.cdl
Executable file
111
src/TDataStd/TDataStd_ReferenceArray.cdl
Executable file
@@ -0,0 +1,111 @@
|
||||
-- File: TDataStd_ReferenceArray.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ReferenceArray from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains an array of references to the labels.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
HLabelArray1 from TDataStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the array of references (labels) attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass;
|
||||
label : Label from TDF;
|
||||
lower, upper : Integer from Standard)
|
||||
---Purpose: Finds or creates an array of reference values (labels) attribute.
|
||||
returns ReferenceArray from TDataStd;
|
||||
|
||||
|
||||
---Category: ReferenceArray methods
|
||||
-- ======================
|
||||
|
||||
Init (me : mutable;
|
||||
lower, upper : Integer from Standard);
|
||||
---Purpose: Initialize the inner array with bounds from <lower> to <upper>
|
||||
|
||||
SetValue (me : mutable;
|
||||
index :Integer from Standard;
|
||||
value : Label from TDF);
|
||||
---Purpose: Sets the <Index>th element of the array to <Value>
|
||||
|
||||
Value (me;
|
||||
Index : Integer from Standard)
|
||||
---Purpose: Returns the value of the <Index>th element of the array.
|
||||
---C++: alias operator ()
|
||||
returns Label from TDF;
|
||||
|
||||
Lower (me)
|
||||
---Purpose: Returns the lower boundary of the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
Upper (me)
|
||||
---Purpose: Returns the upper boundary of the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
Length (me)
|
||||
---Purpose: Returns the number of elements in the array.
|
||||
returns Integer from Standard;
|
||||
|
||||
|
||||
---Category: Advanced area
|
||||
-- =============
|
||||
|
||||
InternalArray (me)
|
||||
---C++: return const &
|
||||
returns HLabelArray1 from TDataStd;
|
||||
|
||||
SetInternalArray (me : mutable;
|
||||
values : HLabelArray1 from TDataStd);
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
Create
|
||||
returns mutable ReferenceArray from TDataStd;
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable 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 &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myArray : HLabelArray1 from TDataStd;
|
||||
|
||||
|
||||
end ReferenceArray;
|
234
src/TDataStd/TDataStd_ReferenceArray.cxx
Executable file
234
src/TDataStd/TDataStd_ReferenceArray.cxx
Executable file
@@ -0,0 +1,234 @@
|
||||
// File: TDataStd_ReferenceArray.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_ReferenceArray.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ReferenceArray::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_ReferenceArrayID ("7EE745A6-BB50-446c-BB0B-C195B23AB5CA");
|
||||
return TDataStd_ReferenceArrayID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ReferenceArray
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_ReferenceArray::TDataStd_ReferenceArray()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceArray::Init(const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Backup();
|
||||
|
||||
if (upper >= lower)
|
||||
myArray = new TDataStd_HLabelArray1(lower, upper);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_ReferenceArray) TDataStd_ReferenceArray::Set(const TDF_Label& label,
|
||||
const Standard_Integer lower,
|
||||
const Standard_Integer upper)
|
||||
{
|
||||
Handle(TDataStd_ReferenceArray) A;
|
||||
if (!label.FindAttribute (TDataStd_ReferenceArray::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_ReferenceArray;
|
||||
A->Init (lower, upper);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
else if (lower != A->Lower() || upper != A->Upper())
|
||||
{
|
||||
A->Init(lower, upper);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetValue
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceArray::SetValue (const Standard_Integer index,
|
||||
const TDF_Label& value)
|
||||
{
|
||||
if (value == myArray->Value(index))
|
||||
return;
|
||||
|
||||
Backup();
|
||||
|
||||
myArray->SetValue(index, value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TDF_Label TDataStd_ReferenceArray::Value (const Standard_Integer index) const
|
||||
{
|
||||
return myArray->Value(index);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Lower
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ReferenceArray::Lower () const
|
||||
{
|
||||
if (myArray.IsNull())
|
||||
return 0;
|
||||
return myArray->Lower();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Upper
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ReferenceArray::Upper () const
|
||||
{
|
||||
if (myArray.IsNull())
|
||||
return -1;
|
||||
return myArray->Upper();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Length
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ReferenceArray::Length () const
|
||||
{
|
||||
if (myArray.IsNull())
|
||||
return 0;
|
||||
return myArray->Length();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InternalArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(TDataStd_HLabelArray1)& TDataStd_ReferenceArray::InternalArray () const
|
||||
{
|
||||
return myArray;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetInternalArray
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArray1)& values)
|
||||
{
|
||||
myArray = values;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ReferenceArray::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_ReferenceArray::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_ReferenceArray();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceArray::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_ReferenceArray) anArray = Handle(TDataStd_ReferenceArray)::DownCast(With);
|
||||
if (!anArray->myArray.IsNull())
|
||||
{
|
||||
const TDataStd_LabelArray1& arr = anArray->myArray->Array1();
|
||||
Standard_Integer lower = arr.Lower(), i = lower, upper = arr.Upper();
|
||||
Init(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
myArray->SetValue(i, arr.Value(i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myArray.Nullify();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceArray::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_ReferenceArray) anArray = Handle(TDataStd_ReferenceArray)::DownCast(Into);
|
||||
if (myArray.IsNull())
|
||||
{
|
||||
anArray->myArray.Nullify();
|
||||
return;
|
||||
}
|
||||
const TDataStd_LabelArray1& arr = myArray->Array1();
|
||||
Standard_Integer lower = arr.Lower(), i = lower, upper = arr.Upper();
|
||||
if (lower != anArray->Lower() || upper != anArray->Upper())
|
||||
anArray->Init(lower, upper);
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
TDF_Label L = arr.Value(i), rL;
|
||||
if (!L.IsNull())
|
||||
{
|
||||
if (!RT->HasRelocation(L, rL))
|
||||
rL = L;
|
||||
anArray->myArray->SetValue(i, rL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : References
|
||||
//purpose : Adds the referenced attributes or labels.
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceArray::References(const Handle(TDF_DataSet)& aDataSet) const
|
||||
{
|
||||
if (!Label().IsImported() && !myArray.IsNull())
|
||||
{
|
||||
const TDataStd_LabelArray1& arr = myArray->Array1();
|
||||
Standard_Integer lower = arr.Lower(), i = lower, upper = arr.Upper();
|
||||
for (; i <= upper; i++)
|
||||
{
|
||||
if (!arr.Value(i).IsNull())
|
||||
aDataSet->AddLabel(arr.Value(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_ReferenceArray::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "ReferenceArray";
|
||||
return anOS;
|
||||
}
|
114
src/TDataStd/TDataStd_ReferenceList.cdl
Executable file
114
src/TDataStd/TDataStd_ReferenceList.cdl
Executable file
@@ -0,0 +1,114 @@
|
||||
-- File: TDataStd_ReferenceList.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class ReferenceList from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Contains a list of references.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
GUID from Standard,
|
||||
Label from TDF,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
LabelList from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
---Purpose: Returns the ID of the list of references (labels) attribute.
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Finds or creates a list of reference values (labels) attribute.
|
||||
returns ReferenceList from TDataStd;
|
||||
|
||||
|
||||
---Category: ReferenceList methods
|
||||
-- =====================
|
||||
|
||||
Create
|
||||
returns mutable ReferenceList from TDataStd;
|
||||
|
||||
IsEmpty (me)
|
||||
returns Boolean from Standard;
|
||||
|
||||
Extent (me)
|
||||
returns Integer from Standard;
|
||||
|
||||
Prepend (me : mutable;
|
||||
value : Label from TDF);
|
||||
|
||||
Append (me : mutable;
|
||||
value : Label from TDF);
|
||||
|
||||
InsertBefore (me : mutable;
|
||||
value : Label from TDF;
|
||||
before_value : Label from TDF)
|
||||
---Purpose: Inserts the <value> before the first meet of <before_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
InsertAfter (me : mutable;
|
||||
value : Label from TDF;
|
||||
after_value : Label from TDF)
|
||||
---Purpose: Inserts the <value> after the first meet of <after_value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Remove (me : mutable;
|
||||
value : Label from TDF)
|
||||
---Purpose: Removes the first meet of the <value>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Clear (me : mutable);
|
||||
|
||||
First (me)
|
||||
---C++: return const &
|
||||
returns Label from TDF;
|
||||
|
||||
Last (me)
|
||||
---C++: return const &
|
||||
returns Label from TDF;
|
||||
|
||||
List (me)
|
||||
---C++: return const &
|
||||
returns LabelList from TDF;
|
||||
|
||||
|
||||
---Category: Methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable 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 &
|
||||
|
||||
|
||||
fields
|
||||
|
||||
myList : LabelList from TDF;
|
||||
|
||||
|
||||
end ReferenceList;
|
257
src/TDataStd/TDataStd_ReferenceList.cxx
Executable file
257
src/TDataStd/TDataStd_ReferenceList.cxx
Executable file
@@ -0,0 +1,257 @@
|
||||
// File: TDataStd_ReferenceList.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_ReferenceList.ixx>
|
||||
#include <TDF_ListIteratorOfLabelList.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ReferenceList::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_ReferenceListID ("FCC1A658-59FF-4218-931B-0320A2B469A7");
|
||||
return TDataStd_ReferenceListID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_ReferenceList
|
||||
//purpose : Empty Constructor
|
||||
//=======================================================================
|
||||
TDataStd_ReferenceList::TDataStd_ReferenceList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_ReferenceList) TDataStd_ReferenceList::Set(const TDF_Label& label)
|
||||
{
|
||||
Handle(TDataStd_ReferenceList) A;
|
||||
if (!label.FindAttribute (TDataStd_ReferenceList::GetID(), A))
|
||||
{
|
||||
A = new TDataStd_ReferenceList;
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ReferenceList::IsEmpty() const
|
||||
{
|
||||
return myList.IsEmpty();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Extent
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_ReferenceList::Extent() const
|
||||
{
|
||||
return myList.Extent();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceList::Prepend(const TDF_Label& value)
|
||||
{
|
||||
Backup();
|
||||
myList.Prepend(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceList::Append(const TDF_Label& value)
|
||||
{
|
||||
Backup();
|
||||
myList.Append(value);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertBefore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ReferenceList::InsertBefore(const TDF_Label& value,
|
||||
const TDF_Label& before_value)
|
||||
{
|
||||
TDF_ListIteratorOfLabelList itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == before_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertBefore(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertAfter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ReferenceList::InsertAfter(const TDF_Label& value,
|
||||
const TDF_Label& after_value)
|
||||
{
|
||||
TDF_ListIteratorOfLabelList itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == after_value)
|
||||
{
|
||||
Backup();
|
||||
myList.InsertAfter(value, itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean TDataStd_ReferenceList::Remove(const TDF_Label& value)
|
||||
{
|
||||
TDF_ListIteratorOfLabelList itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
if (itr.Value() == value)
|
||||
{
|
||||
Backup();
|
||||
myList.Remove(itr);
|
||||
return Standard_True;
|
||||
}
|
||||
}
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceList::Clear()
|
||||
{
|
||||
Backup();
|
||||
myList.Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : First
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TDF_Label& TDataStd_ReferenceList::First() const
|
||||
{
|
||||
return myList.First();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Last
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TDF_Label& TDataStd_ReferenceList::Last() const
|
||||
{
|
||||
return myList.Last();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : List
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TDF_LabelList& TDataStd_ReferenceList::List() const
|
||||
{
|
||||
return myList;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_ReferenceList::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_ReferenceList::NewEmpty () const
|
||||
{
|
||||
return new TDataStd_ReferenceList();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceList::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
myList.Clear();
|
||||
Handle(TDataStd_ReferenceList) aList = Handle(TDataStd_ReferenceList)::DownCast(With);
|
||||
TDF_ListIteratorOfLabelList itr(aList->List());
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
myList.Append(itr.Value());
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceList::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_ReferenceList) aList = Handle(TDataStd_ReferenceList)::DownCast(Into);
|
||||
aList->Clear();
|
||||
TDF_ListIteratorOfLabelList itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
TDF_Label L = itr.Value(), rL;
|
||||
if (!L.IsNull())
|
||||
{
|
||||
if (!RT->HasRelocation(L, rL))
|
||||
rL = L;
|
||||
aList->Append(rL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : References
|
||||
//purpose : Adds the referenced attributes or labels.
|
||||
//=======================================================================
|
||||
void TDataStd_ReferenceList::References(const Handle(TDF_DataSet)& aDataSet) const
|
||||
{
|
||||
if (!Label().IsImported())
|
||||
{
|
||||
TDF_ListIteratorOfLabelList itr(myList);
|
||||
for (; itr.More(); itr.Next())
|
||||
{
|
||||
aDataSet->AddLabel(itr.Value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_ReferenceList::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "ReferenceList";
|
||||
return anOS;
|
||||
}
|
90
src/TDataStd/TDataStd_Relation.cdl
Executable file
90
src/TDataStd/TDataStd_Relation.cdl
Executable file
@@ -0,0 +1,90 @@
|
||||
-- File: TDataStd_Relation.cdl
|
||||
-- Created: Wed Dec 10 11:05:48 1997
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
|
||||
class Relation from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Relation attribute.
|
||||
-- ==================
|
||||
--
|
||||
-- * Data Structure of the Expression is stored in a
|
||||
-- string and references to variables used by the string
|
||||
--
|
||||
-- Warning: To be consistent, each Variable referenced by the
|
||||
-- relation must have its equivalent in the string
|
||||
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
Real from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
ExtendedString from TCollection,
|
||||
AttributeList 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, an Relation attribute.
|
||||
returns Relation from TDataStd;
|
||||
|
||||
---Purpose: Real methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Relation from TDataStd;
|
||||
|
||||
Name (me)
|
||||
---Purpose: build and return the relation name
|
||||
returns ExtendedString from TCollection;
|
||||
|
||||
SetRelation (me : mutable; E : ExtendedString from TCollection);
|
||||
|
||||
GetRelation (me)
|
||||
returns ExtendedString from TCollection;
|
||||
---C++: return const &
|
||||
|
||||
GetVariables (me : mutable)
|
||||
---C++: return &
|
||||
returns AttributeList 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 mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
fields
|
||||
|
||||
myRelation : ExtendedString from TCollection;
|
||||
myVariables : AttributeList from TDF;
|
||||
|
||||
end Relation;
|
160
src/TDataStd/TDataStd_Relation.cxx
Executable file
160
src/TDataStd/TDataStd_Relation.cxx
Executable file
@@ -0,0 +1,160 @@
|
||||
// File: TDataStd_Relation.cxx
|
||||
// Created: Wed Dec 10 11:26:08 1997
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_Relation.ixx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TDataStd_Variable.hxx>
|
||||
#include <TDF_ListIteratorOfAttributeList.hxx>
|
||||
|
||||
#define OCC387
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Relation::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_RelationID("ce24146b-8e57-11d1-8953-080009dc4425");
|
||||
return TDataStd_RelationID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Relation) TDataStd_Relation::Set(const TDF_Label& L)
|
||||
{
|
||||
Handle(TDataStd_Relation) A;
|
||||
if (!L.FindAttribute (TDataStd_Relation::GetID(), A)) {
|
||||
A = new TDataStd_Relation ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Relation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Relation::TDataStd_Relation()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TCollection_ExtendedString TDataStd_Relation::Name () const
|
||||
{
|
||||
return myRelation; // ->String();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetRelation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Relation::SetRelation(const TCollection_ExtendedString& R)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myRelation == R) return;
|
||||
|
||||
#ifdef OCC387
|
||||
Backup();
|
||||
#endif
|
||||
myRelation = R;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetRelation
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TCollection_ExtendedString& TDataStd_Relation::GetRelation() const
|
||||
{
|
||||
return myRelation;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetVariables
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDF_AttributeList& TDataStd_Relation::GetVariables()
|
||||
{
|
||||
return myVariables;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Relation::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Relation::Restore(const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_Relation) REL = Handle(TDataStd_Relation)::DownCast (With);
|
||||
myRelation = REL->GetRelation();
|
||||
Handle(TDataStd_Variable) V;
|
||||
myVariables.Clear();
|
||||
for (TDF_ListIteratorOfAttributeList it (REL->GetVariables()); it.More(); it.Next()) {
|
||||
V = Handle(TDataStd_Variable)::DownCast(it.Value());
|
||||
myVariables.Append(V);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Relation::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Relation();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Relation::Paste(const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_Relation) REL = Handle(TDataStd_Relation)::DownCast (Into);
|
||||
REL->SetRelation(myRelation);
|
||||
Handle(TDataStd_Variable) V1,V2;
|
||||
for (TDF_ListIteratorOfAttributeList it (myVariables); it.More(); it.Next()) {
|
||||
V1 = Handle(TDataStd_Variable)::DownCast(it.Value());
|
||||
RT->HasRelocation (V1,V2);
|
||||
REL->GetVariables().Append(V2);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Relation::Dump(Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Relation";
|
||||
return anOS;
|
||||
}
|
||||
|
65
src/TDataStd/TDataStd_Tick.cdl
Executable file
65
src/TDataStd/TDataStd_Tick.cdl
Executable file
@@ -0,0 +1,65 @@
|
||||
-- File: TDataStd_Tick.cdl
|
||||
-- Created: May 29 11:40:00 2007
|
||||
-- Author: Vlad Romashko
|
||||
-- <vladislav.romashko@opencascade.com>
|
||||
-- Copyright: Open CASCADE
|
||||
|
||||
class Tick from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Defines a boolean attribute.
|
||||
-- If it exists at a label - true,
|
||||
-- Otherwise - false.
|
||||
|
||||
uses
|
||||
|
||||
Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
Integer from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
---Purpose: Static methods
|
||||
-- ==============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
|
||||
Set (myclass; label : Label from TDF)
|
||||
---Purpose: Find, or create, a Tick attribute.
|
||||
returns Tick from TDataStd;
|
||||
|
||||
|
||||
---Purpose: Tick methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Tick from TDataStd;
|
||||
|
||||
|
||||
---Category: Inherited methods
|
||||
-- =================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
Dump (me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
|
||||
end Tick;
|
87
src/TDataStd/TDataStd_Tick.cxx
Executable file
87
src/TDataStd/TDataStd_Tick.cxx
Executable file
@@ -0,0 +1,87 @@
|
||||
// File: TDataStd_Tick.cxx
|
||||
// Created: May 29 11:40:00 2007
|
||||
// Author: Vlad Romashko
|
||||
// <vladislav.romashko@opencascade.com>
|
||||
// Copyright: Open CASCADE
|
||||
|
||||
#include <TDataStd_Tick.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_Tick::GetID ()
|
||||
{
|
||||
static Standard_GUID TDataStd_TickID("40DC60CD-30B9-41be-B002-4169EFB34EA5");
|
||||
return TDataStd_TickID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDataStd_Tick) TDataStd_Tick::Set (const TDF_Label& L)
|
||||
{
|
||||
Handle(TDataStd_Tick) A;
|
||||
if (!L.FindAttribute(TDataStd_Tick::GetID (), A))
|
||||
{
|
||||
A = new TDataStd_Tick();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Tick
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
TDataStd_Tick::TDataStd_Tick ()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Standard_GUID& TDataStd_Tick::ID () const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(TDF_Attribute) TDataStd_Tick::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Tick();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_Tick::Restore (const Handle(TDF_Attribute)& other)
|
||||
{
|
||||
// There are no fields in this attribute.
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_Tick::Paste(const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
// There are no fields in this attribute.
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_OStream& TDataStd_Tick::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Tick";
|
||||
return anOS;
|
||||
}
|
270
src/TDataStd/TDataStd_TreeNode.cdl
Executable file
270
src/TDataStd/TDataStd_TreeNode.cdl
Executable file
@@ -0,0 +1,270 @@
|
||||
-- File: TFunction_Function.cdl
|
||||
-- Created: Thu Jun 10 19:25:22 1999
|
||||
-- Author: Vladislav ROMASHKO
|
||||
-- <vro@flox.nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
|
||||
class TreeNode from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Allows you to define an explicit tree of labels
|
||||
-- which you can also edit.
|
||||
-- Without this class, the data structure cannot be fully edited.
|
||||
-- This service is required if for presentation
|
||||
-- purposes, you want to create an application with
|
||||
-- a tree which allows you to organize and link data
|
||||
-- as a function of application features.
|
||||
|
||||
uses
|
||||
|
||||
GUID from Standard,
|
||||
OStream from Standard,
|
||||
Attribute from TDF,
|
||||
RelocationTable from TDF,
|
||||
DataSet from TDF,
|
||||
AttributeDelta from TDF,
|
||||
Label from TDF,
|
||||
PtrTreeNode from TDataStd
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods working on the node
|
||||
-- ===================================
|
||||
|
||||
Find (myclass; L : Label from TDF;
|
||||
T : out TreeNode from TDataStd)
|
||||
---Purpose: Returns true if the tree node T is found on the label L.
|
||||
-- Otherwise, false is returned.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Set (myclass; L : Label from TDF)
|
||||
---Purpose: Finds or Creates a TreeNode attribute on the label <L>
|
||||
-- with the default tree ID, returned by the method
|
||||
-- <GetDefaultTreeID>. Returns the created/found TreeNode
|
||||
-- attribute.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
Set (myclass; L : Label from TDF; ExplicitTreeID : GUID from Standard)
|
||||
---Purpose: Finds or Creates a TreeNode attribute on the label
|
||||
-- <L>, with an explicit tree ID. <ExplicitTreeID> is
|
||||
-- the ID returned by <TDF_Attribute::ID> method.
|
||||
-- Returns the found/created TreeNode attribute.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
GetDefaultTreeID (myclass)
|
||||
---Purpose: returns a default tree ID. this ID is used by the
|
||||
-- <Set> method without explicit tree ID.
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
---Purpose: Instance methods:
|
||||
-- ================
|
||||
|
||||
Create returns mutable TreeNode from TDataStd;
|
||||
|
||||
|
||||
Append (me : mutable; Child : TreeNode from TDataStd)
|
||||
---Purpose: Insert the TreeNode <Child> as last child of <me>. If
|
||||
-- the insertion is successful <me> becomes the Father of <Child>.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Prepend (me : mutable; Child : TreeNode from TDataStd)
|
||||
---Purpose: Insert the the TreeNode <Child> as first child of
|
||||
-- <me>. If the insertion is successful <me> becomes the Father of <Child>
|
||||
returns Boolean from Standard;
|
||||
|
||||
InsertBefore (me : mutable; Node : TreeNode from TDataStd)
|
||||
---Purpose: Inserts the TreeNode <Node> before <me>. If insertion is successful <me>
|
||||
-- and <Node> belongs to the same Father.
|
||||
returns Boolean from Standard;
|
||||
|
||||
InsertAfter(me : mutable; Node : TreeNode from TDataStd)
|
||||
---Purpose: Inserts the TreeNode <Node> after <me>. If insertion is successful <me>
|
||||
-- and <Node> belongs to the same Father.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Remove (me : mutable)
|
||||
---Purpose: Removes this tree node attribute from its father
|
||||
-- node. The result is that this attribute becomes a root node.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Depth (me) returns Integer from Standard;
|
||||
---Purpose: Returns the depth of this tree node in the overall tree node structure.
|
||||
-- In other words, the number of father tree nodes of this one is returned.
|
||||
|
||||
NbChildren (me; allLevels : Boolean from Standard = Standard_False)
|
||||
returns Integer from Standard;
|
||||
---Purpose: Returns the number of child nodes.
|
||||
-- If <allLevels> is true, the method counts children of all levels
|
||||
-- (children of children ...)
|
||||
|
||||
IsAscendant (me; of : TreeNode from TDataStd)
|
||||
---Purpose: Returns true if this tree node attribute is an
|
||||
-- ascendant of of. In other words, if it is a father or
|
||||
-- the father of a father of of.
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsDescendant (me; of : TreeNode from TDataStd)
|
||||
---Purpose: Returns true if this tree node attribute is a
|
||||
-- descendant of of. In other words, if it is a child or
|
||||
-- the child of a child of of.
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsRoot(me)
|
||||
---Purpose: Returns true if this tree node attribute is the
|
||||
-- ultimate father in the tree.
|
||||
returns Boolean;
|
||||
|
||||
Root(me)
|
||||
---Purpose: Returns the ultimate father of this tree node attribute.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
IsFather (me; of : TreeNode from TDataStd)
|
||||
---Purpose: Returns true if this tree node attribute is a father of of.
|
||||
returns Boolean from Standard;
|
||||
|
||||
IsChild (me; of : TreeNode from TDataStd)
|
||||
---Purpose: Returns true if this tree node attribute is a child of of.
|
||||
returns Boolean from Standard;
|
||||
|
||||
HasFather(me)
|
||||
---Purpose: Returns true if this tree node attribute has a father tree node.
|
||||
---C++: inline
|
||||
returns Boolean;
|
||||
|
||||
Father (me)
|
||||
---Purpose: Returns the father TreeNode of <me>. Null if root.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
HasNext(me)
|
||||
---Purpose: Returns true if this tree node attribute has a next tree node.
|
||||
---C++: inline
|
||||
returns Boolean;
|
||||
|
||||
Next (me)
|
||||
---Purpose: Returns the next tree node in this tree node attribute.
|
||||
-- Warning
|
||||
-- This tree node is null if it is the last one in this
|
||||
-- tree node attribute.Returns the next TreeNode of <me>. Null if last.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
HasPrevious(me)
|
||||
---Purpose: Returns true if this tree node attribute has a previous tree node.
|
||||
---C++: inline
|
||||
returns Boolean;
|
||||
|
||||
Previous (me)
|
||||
---Purpose: Returns the previous tree node of this tree node attribute.
|
||||
-- Warning
|
||||
-- This tree node is null if it is the first one in this tree node attribute.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
HasFirst (me)
|
||||
---Purpose: Returns true if this tree node attribute has a first child tree node.
|
||||
---C++: inline
|
||||
returns Boolean;
|
||||
|
||||
First (me)
|
||||
---Purpose: Returns the first child tree node in this tree node object.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
HasLast (me)
|
||||
---Purpose: Returns true if this tree node attribute has a last child tree node.
|
||||
---C++: inline
|
||||
returns Boolean;
|
||||
|
||||
Last (me : mutable)
|
||||
---Purpose: Returns the last child tree node in this tree node object.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
FindLast (me : mutable)
|
||||
---Purpose: Returns the last child tree node in this tree node object.
|
||||
returns TreeNode from TDataStd;
|
||||
|
||||
---Purpose: to set fields
|
||||
-- =============
|
||||
|
||||
SetTreeID (me : mutable; explicitID : GUID from Standard);
|
||||
|
||||
SetFather(me : mutable;F : TreeNode from TDataStd);
|
||||
|
||||
SetNext (me : mutable;F : TreeNode from TDataStd);
|
||||
|
||||
SetPrevious (me : mutable;F : TreeNode from TDataStd);
|
||||
|
||||
SetFirst (me : mutable;F : TreeNode from TDataStd);
|
||||
|
||||
SetLast (me : mutable;F : TreeNode from TDataStd);
|
||||
|
||||
---Purpose: TreeNode callback:
|
||||
-- ==================
|
||||
|
||||
AfterAddition(me: mutable)
|
||||
---Purpose: Connect the TreeNode to its father child list
|
||||
is redefined;
|
||||
|
||||
BeforeForget(me: mutable)
|
||||
---Purpose: Disconnect the TreeNode from its Father child list
|
||||
is redefined;
|
||||
|
||||
AfterResume(me: mutable)
|
||||
---Purpose: Reconnect the TreeNode to its father child list.
|
||||
is redefined;
|
||||
|
||||
BeforeUndo(me: mutable; anAttDelta : AttributeDelta from TDF;
|
||||
forceIt : Boolean from Standard = Standard_False)
|
||||
---Purpose: Disconnect the TreeNode, if necessary.
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
AfterUndo(me: mutable; anAttDelta : AttributeDelta from TDF;
|
||||
forceIt : Boolean from Standard = Standard_False)
|
||||
---Purpose: Reconnect the TreeNode, if necessary.
|
||||
returns Boolean from Standard
|
||||
is redefined;
|
||||
|
||||
|
||||
---Purpose: Implementation of Attribute methods:
|
||||
-- ===================================
|
||||
|
||||
ID (me)
|
||||
---Purpose: Returns the tree ID (default or explicit one depending
|
||||
-- onthe Set method used).
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF)
|
||||
is virtual;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF)
|
||||
is virtual;
|
||||
|
||||
NewEmpty(me)
|
||||
returns mutable Attribute from TDF
|
||||
is redefined;
|
||||
|
||||
References(me;
|
||||
aDataSet : DataSet from TDF)
|
||||
is redefined;
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
---C++: return &
|
||||
is redefined;
|
||||
|
||||
fields
|
||||
|
||||
myFather : PtrTreeNode from TDataStd;
|
||||
myPrevious : PtrTreeNode from TDataStd;
|
||||
myNext : PtrTreeNode from TDataStd;
|
||||
myFirst : PtrTreeNode from TDataStd;
|
||||
myLast : PtrTreeNode from TDataStd;
|
||||
myTreeID : GUID from Standard;
|
||||
|
||||
friends
|
||||
|
||||
class ChildNodeIterator from TDataStd
|
||||
|
||||
end TreeNode;
|
693
src/TDataStd/TDataStd_TreeNode.cxx
Executable file
693
src/TDataStd/TDataStd_TreeNode.cxx
Executable file
@@ -0,0 +1,693 @@
|
||||
// File: TFunction_Function.cxx
|
||||
// Created: Thu Jun 10 19:39:27 1999
|
||||
// Author: Vladislav ROMASHKO
|
||||
// <vro@flox.nnov.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_TreeNode.ixx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
// This bug concerns the method IsDescendant():
|
||||
#define BUC60817
|
||||
|
||||
// This bug concerns the method BeforeForget() - Forget/Resume, Undo/Redo behaviour of the attribute
|
||||
#define BUC60844
|
||||
|
||||
//=======================================================================
|
||||
//function : Find
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::Find(const TDF_Label& L,
|
||||
Handle(TDataStd_TreeNode)& T)
|
||||
{
|
||||
return L.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(), T);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : GetDefaultTreeID
|
||||
//purpose : Static method to get the default ID of a TreeNode
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_TreeNode::GetDefaultTreeID()
|
||||
{
|
||||
static Standard_GUID TDataStd_TreeNodeID ("2a96b621-ec8b-11d0-bee7-080009dc3333");
|
||||
return TDataStd_TreeNodeID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Set
|
||||
//purpose : Finds or creates a TreeNode attribute with default ID
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Set(const TDF_Label& L)
|
||||
{
|
||||
Handle(TDataStd_TreeNode) TN;
|
||||
if (!L.FindAttribute(TDataStd_TreeNode::GetDefaultTreeID(),TN)) {
|
||||
TN = new TDataStd_TreeNode();
|
||||
TN->SetTreeID(TDataStd_TreeNode::GetDefaultTreeID());
|
||||
L.AddAttribute(TN);
|
||||
}
|
||||
return TN;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose : Finds or creates a TreeNode attribute with explicit ID
|
||||
// : a driver for it
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Set (const TDF_Label& L,
|
||||
const Standard_GUID& explicitID)
|
||||
{
|
||||
Handle(TDataStd_TreeNode) TN;
|
||||
if (!L.FindAttribute(explicitID,TN)) {
|
||||
TN = new TDataStd_TreeNode ();
|
||||
TN->SetTreeID(explicitID);
|
||||
L.AddAttribute(TN);
|
||||
}
|
||||
return TN;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : ID
|
||||
//purpose : Returns GUID of the TreeNode
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_TreeNode::ID() const
|
||||
{
|
||||
return myTreeID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : TDataStd_TreeNode
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_TreeNode::TDataStd_TreeNode () :
|
||||
myFather(NULL), myPrevious(NULL), myNext(NULL), myFirst(NULL), myLast(NULL)
|
||||
{}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Append
|
||||
//purpose : Add <TN> as last child of me
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::Append (const Handle(TDataStd_TreeNode)& TN)
|
||||
{
|
||||
if (!(TN->ID() == myTreeID) )
|
||||
Standard_DomainError::Raise("TDataStd_TreeNode::Append : uncompatible GUID");
|
||||
|
||||
Handle(TDataStd_TreeNode) bid;
|
||||
TN->SetNext(bid); // Deconnects from next.
|
||||
|
||||
// Find the last
|
||||
if (!HasFirst()) {
|
||||
SetFirst(TN);
|
||||
TN->SetPrevious(bid); // Deconnects from previous.
|
||||
}
|
||||
else
|
||||
{
|
||||
Handle(TDataStd_TreeNode) L = Last();
|
||||
L->SetNext(TN);
|
||||
TN->SetPrevious(L);
|
||||
}
|
||||
// Set Father
|
||||
TN->SetFather(this);
|
||||
myLast=TN.operator->();
|
||||
return !TN.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Prepend
|
||||
//purpose : Add <TN> as first child of me
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::Prepend (const Handle(TDataStd_TreeNode)& TN)
|
||||
{
|
||||
if (!(TN->ID() == myTreeID) )
|
||||
Standard_DomainError::Raise("TDataStd_TreeNode::Prepend : uncompatible GUID");
|
||||
|
||||
Handle(TDataStd_TreeNode) bid;
|
||||
TN->SetPrevious(bid);
|
||||
if (HasFirst()) {
|
||||
TN->SetNext(First());
|
||||
First()->SetPrevious(TN);
|
||||
}
|
||||
else {
|
||||
TN->SetNext(bid);
|
||||
SetLast(TN);
|
||||
}
|
||||
TN->SetFather(this);
|
||||
SetFirst(TN);
|
||||
return !TN.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertBefore
|
||||
//purpose : Inserts the TreeNode <TN> before me
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::InsertBefore (const Handle(TDataStd_TreeNode)& TN)
|
||||
{
|
||||
if (!(TN->ID() == myTreeID) )
|
||||
Standard_DomainError::Raise("TDataStd_TreeNode::InsertBefore : uncompatible GUID");
|
||||
|
||||
TN->SetFather(Father());
|
||||
TN->SetPrevious(Previous());
|
||||
TN->SetNext(this);
|
||||
|
||||
if (!HasPrevious())
|
||||
Father()->SetFirst(TN);
|
||||
else
|
||||
Previous()->SetNext(TN);
|
||||
|
||||
SetPrevious(TN);
|
||||
return !TN.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InsertAfter
|
||||
//purpose : Inserts the TreeNode <TN> after me
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::InsertAfter (const Handle(TDataStd_TreeNode)& TN)
|
||||
{
|
||||
if (!(TN->ID() == myTreeID) )
|
||||
Standard_DomainError::Raise("TDataStd_TreeNode::InsertAfter : uncompatible GUID");
|
||||
|
||||
if (HasFather() && !HasNext())
|
||||
Father()->SetLast(TN);
|
||||
|
||||
TN->SetFather(Father());
|
||||
TN->SetPrevious(this);
|
||||
TN->SetNext(Next());
|
||||
|
||||
if (HasNext())
|
||||
Next()->SetPrevious(TN);
|
||||
|
||||
SetNext(TN);
|
||||
return !TN.IsNull();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Remove
|
||||
//purpose : Removees the function from the function tree
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::Remove ()
|
||||
{
|
||||
if (IsRoot()) return Standard_True;
|
||||
|
||||
Handle(TDataStd_TreeNode) bid;
|
||||
if (!HasPrevious())
|
||||
Father()->SetFirst(Next());
|
||||
else
|
||||
Previous()->SetNext(Next());
|
||||
|
||||
if (HasNext()) {
|
||||
if (HasPrevious()) Next()->SetPrevious(Previous());
|
||||
else Next()->SetPrevious(bid);
|
||||
}
|
||||
else {
|
||||
if (HasPrevious()) Previous()->SetNext(bid);
|
||||
}
|
||||
|
||||
if (Father()->HasFirst()) {
|
||||
if (Handle(TDataStd_TreeNode)::DownCast(this) == Father()->First()) {
|
||||
if (HasNext()) {
|
||||
Father()->SetFirst(Next());
|
||||
}
|
||||
else Father()->SetFirst(bid);
|
||||
}
|
||||
}
|
||||
|
||||
if(Father()->HasLast()) {
|
||||
if (Handle(TDataStd_TreeNode)::DownCast(this) == Father()->Last()) {
|
||||
if(HasPrevious()) {
|
||||
Father()->SetLast(Previous());
|
||||
}
|
||||
else Father()->SetLast(bid);
|
||||
}
|
||||
}
|
||||
|
||||
SetFather(bid);
|
||||
SetNext(bid);
|
||||
SetPrevious(bid);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Depth
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer TDataStd_TreeNode::Depth () const
|
||||
{
|
||||
Standard_Integer depth = 0;
|
||||
|
||||
TDataStd_TreeNode* O = (TDataStd_TreeNode*) this;
|
||||
while (O->myFather != NULL)
|
||||
{
|
||||
depth++;
|
||||
O = O->myFather;
|
||||
}
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbChildren
|
||||
//purpose : Returns the number of child nodes.
|
||||
// If <allLevels> is true, the method counts children of all levels
|
||||
// (children of children ...)
|
||||
//=======================================================================
|
||||
Standard_Integer TDataStd_TreeNode::NbChildren(const Standard_Boolean allLevels) const
|
||||
{
|
||||
Standard_Integer nb = 0;
|
||||
TDataStd_TreeNode* C = myFirst;
|
||||
while (C != NULL)
|
||||
{
|
||||
if (allLevels &&
|
||||
C->myFirst != NULL)
|
||||
{
|
||||
nb += C->NbChildren(allLevels);
|
||||
}
|
||||
nb++;
|
||||
C = C->myNext;
|
||||
}
|
||||
return nb;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetTreeID
|
||||
//purpose : Finds or creates a TreeNode attribute with explicit ID
|
||||
// : a driver for it
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::SetTreeID (const Standard_GUID& explicitID)
|
||||
{
|
||||
myTreeID = explicitID;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAscendant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::IsAscendant (const Handle(TDataStd_TreeNode)& ofTN) const
|
||||
{
|
||||
return ofTN->IsDescendant(this);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDescendant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::IsDescendant (const Handle(TDataStd_TreeNode)& ofTN) const
|
||||
{
|
||||
#ifdef BUC60817
|
||||
|
||||
TDataStd_TreeNode* O = (TDataStd_TreeNode*) this;
|
||||
while (O->myFather != NULL)
|
||||
{
|
||||
if (O->myFather == ofTN)
|
||||
return Standard_True;
|
||||
O = O->myFather;
|
||||
}
|
||||
|
||||
#else
|
||||
Handle(TDataStd_TreeNode) current;
|
||||
for (current = this; current = current->Father(); current->HasFather()) {
|
||||
if (current == ofTN) return Standard_True;
|
||||
}
|
||||
#endif
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsFather
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::IsFather (const Handle(TDataStd_TreeNode)& ofTN) const
|
||||
{
|
||||
return (ofTN->Father() == this);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsChild
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::IsChild (const Handle(TDataStd_TreeNode)& ofTN) const
|
||||
{
|
||||
return (myFather == ofTN.operator->());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Father
|
||||
//purpose : Returns the Father of the TreeNode
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Father() const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) O = myFather;
|
||||
return O;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : IsRoot
|
||||
//purpose : Returns Standard_True if the TreeNode is not attached to a
|
||||
// TreeNode tree or hasn't an Father.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::IsRoot() const
|
||||
{
|
||||
if (myFather == NULL &&
|
||||
myPrevious == NULL &&
|
||||
myNext == NULL)
|
||||
return Standard_True;
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Root
|
||||
//purpose : Returns the TreeNode which has no Father
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Root() const
|
||||
{
|
||||
TDataStd_TreeNode* O = (TDataStd_TreeNode*) this;
|
||||
while (O->myFather != NULL)
|
||||
{
|
||||
O = O->myFather;
|
||||
}
|
||||
return O;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Next
|
||||
//purpose : Returns next (in the TreeNode tree) TreeNode
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Next() const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) O = myNext;
|
||||
return O;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Previous
|
||||
//purpose : Returns previous (in the TreeNode tree) TreeNode
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Previous() const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) O = myPrevious;
|
||||
return O;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : First
|
||||
//purpose : Returns first child
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::First () const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) O = myFirst;
|
||||
return O;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Last
|
||||
//purpose : Returns last child
|
||||
// Optimize an Append operation if it is called in a circle
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::Last ()
|
||||
{
|
||||
if(myLast && !myLast->IsChild(this))
|
||||
myLast=NULL;
|
||||
|
||||
if(myLast == NULL)
|
||||
return FindLast();
|
||||
|
||||
return myLast;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : FindLast
|
||||
//purpose : Returns last child
|
||||
// Optimizes an Append operation if it is called in a circle
|
||||
//=======================================================================
|
||||
Handle(TDataStd_TreeNode) TDataStd_TreeNode::FindLast ()
|
||||
{
|
||||
if (myFirst == NULL)
|
||||
return myFirst;
|
||||
TDataStd_TreeNode* L = myFirst;
|
||||
while (L->myNext != NULL)
|
||||
{
|
||||
L = L->myNext;
|
||||
}
|
||||
return L;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : SetFather
|
||||
//purpose : Sets the TreeNode F as Father of me
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::SetFather(const Handle(TDataStd_TreeNode)& F)
|
||||
{
|
||||
Backup();
|
||||
if (F.IsNull()) myFather = NULL;
|
||||
else myFather = F.operator->();
|
||||
myLast=NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : SetNext
|
||||
//purpose : Sets the TreeNode F next to me
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::SetNext(const Handle(TDataStd_TreeNode)& F)
|
||||
{
|
||||
Backup();
|
||||
if (F.IsNull()) myNext = NULL;
|
||||
else myNext = F.operator->();
|
||||
myLast=NULL;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : SetPrevious
|
||||
//purpose : Sets the TreeNode F previous to me
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::SetPrevious(const Handle(TDataStd_TreeNode)& F)
|
||||
{
|
||||
Backup();
|
||||
if (F.IsNull()) myPrevious = NULL;
|
||||
else myPrevious = F.operator->();
|
||||
myLast=NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : SetFirst
|
||||
//purpose : Sets the TreeNode F as first in the TreeNode tree
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::SetFirst(const Handle(TDataStd_TreeNode)& F)
|
||||
{
|
||||
Backup();
|
||||
if (F.IsNull()) myFirst = NULL;
|
||||
else myFirst = F.operator->();
|
||||
myLast=NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : SetLast
|
||||
//purpose : Sets the TreeNode F as last in the TreeNode tree
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::SetLast(const Handle(TDataStd_TreeNode)& F)
|
||||
{
|
||||
Backup();
|
||||
if (F.IsNull()) myLast = NULL;
|
||||
else myLast = F.operator->();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : AfterAddition
|
||||
//purpose : Connects the TreeNode to the tree.
|
||||
// Backuped attribute must stay disconnected
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::AfterAddition() {
|
||||
if (!IsBackuped()) {
|
||||
if (myPrevious)
|
||||
myPrevious->SetNext(this);
|
||||
else if (myFather)
|
||||
myFather->SetFirst(this);
|
||||
if (myNext)
|
||||
myNext->SetPrevious(this);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : BeforeForget
|
||||
//purpose : Disconnect the TreeNode from the tree.
|
||||
// Backuped attribute is normaly not concerned by such an operation
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::BeforeForget() {
|
||||
#ifdef BUC60844
|
||||
if (!IsBackuped()) {
|
||||
Remove();
|
||||
while (HasFirst()) First()->Remove();
|
||||
}
|
||||
#else
|
||||
if (!IsBackuped()) Remove();
|
||||
#endif
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : AfterResume
|
||||
//purpose : Connects the TreeNode to the tree
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::AfterResume() {
|
||||
AfterAddition();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : BeforeUndo
|
||||
//purpose : Disconnect the TreeNode from the tree.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::BeforeUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
|
||||
const Standard_Boolean forceIt)
|
||||
{
|
||||
if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnAddition))) BeforeForget(); // Disconnect.
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : AfterUndo
|
||||
//purpose : Connect the TreeNode from the tree.
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_TreeNode::AfterUndo(const Handle(TDF_AttributeDelta)& anAttDelta,
|
||||
const Standard_Boolean forceIt)
|
||||
{
|
||||
if (anAttDelta->IsKind(STANDARD_TYPE(TDF_DeltaOnRemoval))) AfterAddition(); // Reconnect.
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::Restore(const Handle(TDF_Attribute)& other) {
|
||||
Handle(TDataStd_TreeNode) F = Handle(TDataStd_TreeNode)::DownCast(other);
|
||||
myFather = F->myFather;
|
||||
myPrevious = F->myPrevious;
|
||||
myNext = F->myNext;
|
||||
myFirst = F->myFirst;
|
||||
myTreeID = F->myTreeID;
|
||||
myLast = NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Paste
|
||||
//purpose : Method for Copy mechanism
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::Paste(const Handle(TDF_Attribute)& into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) intof = Handle(TDataStd_TreeNode)::DownCast(into);
|
||||
Handle(TDataStd_TreeNode) func;
|
||||
if (!RT->HasRelocation(myFather, func) && RT->AfterRelocate()) {
|
||||
func.Nullify();
|
||||
}
|
||||
intof->SetFather(func);
|
||||
if (!RT->HasRelocation(myNext, func) && RT->AfterRelocate()) {
|
||||
func.Nullify();
|
||||
}
|
||||
intof->SetNext(func);
|
||||
if (!RT->HasRelocation(myPrevious, func) && RT->AfterRelocate()) {
|
||||
func.Nullify();
|
||||
}
|
||||
intof->SetPrevious(func);
|
||||
if (!RT->HasRelocation(myFirst, func) && RT->AfterRelocate()) {
|
||||
func.Nullify();
|
||||
}
|
||||
|
||||
intof->SetFirst(func);
|
||||
intof->SetTreeID(myTreeID);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : NewEmpty
|
||||
//purpose : Returns new empty TreeNode attribute
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_TreeNode::NewEmpty() const
|
||||
{
|
||||
Handle(TDataStd_TreeNode) T = new TDataStd_TreeNode();
|
||||
T->SetTreeID(myTreeID);
|
||||
return T;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : References
|
||||
//purpose : Collects the references
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_TreeNode::References(const Handle(TDF_DataSet)& aDataSet) const
|
||||
{
|
||||
TDataStd_TreeNode* fct = myFirst;
|
||||
while (fct != NULL) {
|
||||
aDataSet->AddAttribute(fct);
|
||||
fct = fct->myNext;
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//TreeNode : Dump
|
||||
//purpose : Dump of the TreeNode
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_TreeNode::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
TDF_Attribute::Dump (anOS);
|
||||
if (myFather) {
|
||||
anOS<<" Father=";
|
||||
if (!myFather->Label().IsNull()) myFather->Label().EntryDump(anOS);
|
||||
}
|
||||
if (myPrevious) {
|
||||
anOS<<" Previous=";
|
||||
if (!myPrevious->Label().IsNull()) myPrevious->Label().EntryDump(anOS);
|
||||
}
|
||||
if (myNext) {
|
||||
anOS<<" Next=";
|
||||
if (!myNext->Label().IsNull()) myNext->Label().EntryDump(anOS);
|
||||
}
|
||||
if (myFirst) {
|
||||
anOS<<" First=";
|
||||
if (!myFirst->Label().IsNull()) myFirst->Label().EntryDump(anOS);
|
||||
}
|
||||
anOS<<endl;
|
||||
return anOS;
|
||||
}
|
30
src/TDataStd/TDataStd_TreeNode.lxx
Executable file
30
src/TDataStd/TDataStd_TreeNode.lxx
Executable file
@@ -0,0 +1,30 @@
|
||||
// File: TDataStd_TreeNode.lxx
|
||||
// Created: Fri Nov 5 11:29:30 1999
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
inline Standard_Boolean TDataStd_TreeNode::HasFather() const
|
||||
{
|
||||
return myFather != NULL;
|
||||
}
|
||||
|
||||
inline Standard_Boolean TDataStd_TreeNode::HasNext() const
|
||||
{
|
||||
return myNext != NULL;
|
||||
}
|
||||
|
||||
inline Standard_Boolean TDataStd_TreeNode::HasPrevious() const
|
||||
{
|
||||
return myPrevious != NULL;
|
||||
}
|
||||
|
||||
inline Standard_Boolean TDataStd_TreeNode::HasFirst() const
|
||||
{
|
||||
return myFirst != NULL;
|
||||
}
|
||||
|
||||
inline Standard_Boolean TDataStd_TreeNode::HasLast() const
|
||||
{
|
||||
return myLast != NULL;
|
||||
}
|
63
src/TDataStd/TDataStd_UAttribute.cdl
Executable file
63
src/TDataStd/TDataStd_UAttribute.cdl
Executable file
@@ -0,0 +1,63 @@
|
||||
-- File: TDataStd_UAttribute.cdl
|
||||
-- Created: Fri Jun 11 13:59:31 1999
|
||||
-- Author: Sergey RUIN
|
||||
-- <s-ruin@nnov.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1999
|
||||
|
||||
|
||||
|
||||
class UAttribute from TDataStd inherits Attribute from TDF
|
||||
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
GUID from Standard,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF
|
||||
|
||||
is
|
||||
|
||||
|
||||
---Purpose: api class methods
|
||||
-- =============
|
||||
|
||||
Set (myclass ; label : Label from TDF; LocalID : GUID from Standard)
|
||||
---Purpose: Find, or create, a UAttribute attribute with <LocalID> as Local GUID.
|
||||
-- The UAttribute attribute is returned.
|
||||
returns UAttribute from TDataStd ;
|
||||
|
||||
|
||||
---Purpose: UAttribute methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable UAttribute from TDataStd;
|
||||
|
||||
SetID (me: mutable; LocalID : GUID from Standard);
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
---Category: methodes of TDF_Attribute
|
||||
-- =========================
|
||||
|
||||
Restore (me: mutable; with : Attribute from TDF);
|
||||
|
||||
NewEmpty (me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; into : mutable Attribute from TDF;
|
||||
RT : mutable 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 &
|
||||
fields
|
||||
|
||||
myID: GUID from Standard;
|
||||
|
||||
end UAttribute;
|
117
src/TDataStd/TDataStd_UAttribute.cxx
Executable file
117
src/TDataStd/TDataStd_UAttribute.cxx
Executable file
@@ -0,0 +1,117 @@
|
||||
// File: TDataStd_UAttribute.cxx
|
||||
// Created: Fri Jun 11 14:39:43 1999
|
||||
// Author: Sergey RUIN
|
||||
// <s-ruin@nnov.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_UAttribute.ixx>
|
||||
#include <TDataStd.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_UAttribute) TDataStd_UAttribute::Set (const TDF_Label& label, const Standard_GUID& guid )
|
||||
{
|
||||
Handle(TDataStd_UAttribute) A;
|
||||
if (!label.FindAttribute(guid, A)) {
|
||||
A = new TDataStd_UAttribute ();
|
||||
A->SetID(guid);
|
||||
label.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_UAttribute
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_UAttribute::TDataStd_UAttribute()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_UAttribute::ID() const
|
||||
{ return myID; }
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : SetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_UAttribute::SetID( const Standard_GUID& guid)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myID == guid) return;
|
||||
|
||||
Backup();
|
||||
myID = guid;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_UAttribute::NewEmpty () const
|
||||
{
|
||||
Handle(TDataStd_UAttribute) A = new TDataStd_UAttribute();
|
||||
A->SetID(myID);
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_UAttribute::Restore(const Handle(TDF_Attribute)& with)
|
||||
{
|
||||
Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(with);
|
||||
SetID( A->ID() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_UAttribute::Paste (const Handle(TDF_Attribute)& into,
|
||||
const Handle(TDF_RelocationTable)& RT) const
|
||||
{
|
||||
Handle(TDataStd_UAttribute) A = Handle(TDataStd_UAttribute)::DownCast(into);
|
||||
A->SetID( myID );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : References
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_UAttribute::References (const Handle(TDF_DataSet)& DS) const
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_UAttribute::Dump (Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "UAttribute";
|
||||
TDF_Attribute::Dump(anOS);
|
||||
return anOS;
|
||||
}
|
||||
|
||||
|
154
src/TDataStd/TDataStd_Variable.cdl
Executable file
154
src/TDataStd/TDataStd_Variable.cdl
Executable file
@@ -0,0 +1,154 @@
|
||||
-- File: TDesignVariable_Variable.cdl
|
||||
-- Created: Wed Dec 10 10:37:50 1997
|
||||
-- Author: Denis PASCAL
|
||||
-- <dp@dingox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1997
|
||||
|
||||
|
||||
class Variable from TDataStd inherits Attribute from TDF
|
||||
|
||||
---Purpose: Variable attribute.
|
||||
-- ==================
|
||||
--
|
||||
-- * A variable is associated to a TDataStd_Real (which
|
||||
-- contains its current value) and a TDataStd_Name
|
||||
-- attribute (which contains its name). It contains a
|
||||
-- constant flag, and a Unit
|
||||
--
|
||||
-- * An expression may be assigned to a variable. In
|
||||
-- thatcase the expression is handled by the associated
|
||||
-- Expression Attribute and the Variable returns True to
|
||||
-- the method <IsAssigned>.
|
||||
|
||||
|
||||
uses Attribute from TDF,
|
||||
Label from TDF,
|
||||
ExtendedString from TCollection,
|
||||
Real from TDataStd,
|
||||
Expression from TDataStd,
|
||||
GUID from Standard,
|
||||
Real from Standard,
|
||||
RealEnum from TDataStd,
|
||||
DataSet from TDF,
|
||||
RelocationTable from TDF,
|
||||
AsciiString from TCollection
|
||||
|
||||
|
||||
is
|
||||
|
||||
---Purpose: class methods
|
||||
-- =============
|
||||
|
||||
GetID (myclass)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Set (myclass ; label : Label from TDF)
|
||||
---Purpose: Find, or create, a Variable attribute.
|
||||
returns Variable from TDataStd;
|
||||
|
||||
---Purpose: Real methods
|
||||
-- ============
|
||||
|
||||
Create
|
||||
returns mutable Variable from TDataStd;
|
||||
|
||||
Name (me : mutable; string : ExtendedString from TCollection);
|
||||
---Purpose: set or change the name of the variable, in myUnknown
|
||||
-- and my associated Name attribute.
|
||||
|
||||
Name (me)
|
||||
returns ExtendedString from TCollection;
|
||||
---Purpose: returns string stored in the associated Name
|
||||
-- attribute.
|
||||
---C++: return const &
|
||||
|
||||
Set (me; value : Real from Standard; dimension : RealEnum from TDataStd = TDataStd_SCALAR);
|
||||
---Purpose: retrieve or create the associated real attribute and
|
||||
-- set the value <value>. if creation, dimension is
|
||||
-- written.
|
||||
|
||||
IsValued (me)
|
||||
---Purpose: returns True if a Real attribute is associated.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Get (me)
|
||||
---Purpose: returns value stored in associated Real attribute.
|
||||
returns Real from Standard;
|
||||
|
||||
Real (me)
|
||||
---Purpose: returns associated Real attribute.
|
||||
returns Real from TDataStd;
|
||||
|
||||
IsAssigned (me) returns Boolean;
|
||||
---Purpose: returns True if an Expression attribute is associated.
|
||||
|
||||
-- Assign (me; E : GeneralExpression from Expr)
|
||||
---Purpose: create(if doesn't exist), set and returns the assigned
|
||||
-- expression attribute.
|
||||
--returns Expression from TDataStd;
|
||||
|
||||
Assign (me)
|
||||
---Purpose: create(if doesn't exist) and returns the assigned
|
||||
-- expression attribute. fill it after.
|
||||
returns Expression from TDataStd;
|
||||
|
||||
Desassign (me);
|
||||
---Purpose: if <me> is assigned delete the associated expression
|
||||
-- attribute.
|
||||
|
||||
Expression (me)
|
||||
---Purpose: if <me> is assigned, returns associated Expression
|
||||
-- attribute.
|
||||
returns Expression from TDataStd;
|
||||
|
||||
IsCaptured (me) returns Boolean;
|
||||
---Purpose: shortcut for <Real()->IsCaptured()>
|
||||
|
||||
IsConstant (me)
|
||||
---Purpose: A constant value is not modified by regeneration.
|
||||
returns Boolean from Standard;
|
||||
|
||||
Unit (me:mutable; unit : AsciiString from TCollection);
|
||||
|
||||
Unit (me)
|
||||
---C++: return const &
|
||||
returns AsciiString from TCollection;
|
||||
|
||||
---Purpose: to read/write fields
|
||||
-- ===================
|
||||
|
||||
Constant (me : mutable; status : Boolean from Standard);
|
||||
---Purpose: if <status> is True, this variable will not be
|
||||
-- modified by the solver.
|
||||
|
||||
---Category: TDF_Attribute methods
|
||||
-- =====================
|
||||
|
||||
ID (me)
|
||||
---C++: return const &
|
||||
returns GUID from Standard;
|
||||
|
||||
Restore (me: mutable; With : Attribute from TDF);
|
||||
|
||||
NewEmpty(me)
|
||||
returns mutable Attribute from TDF;
|
||||
|
||||
Paste (me; Into : mutable Attribute from TDF;
|
||||
RT : mutable RelocationTable from TDF);
|
||||
|
||||
References (me; DS : DataSet from TDF)
|
||||
---Purpose: to export reference to the associated Name attribute.
|
||||
is redefined;
|
||||
|
||||
Dump(me; anOS : in out OStream from Standard)
|
||||
returns OStream from Standard
|
||||
is redefined;
|
||||
---C++: return &
|
||||
|
||||
fields
|
||||
|
||||
isConstant : Boolean from Standard;
|
||||
myUnit : AsciiString from TCollection;
|
||||
|
||||
end Variable;
|
305
src/TDataStd/TDataStd_Variable.cxx
Executable file
305
src/TDataStd/TDataStd_Variable.cxx
Executable file
@@ -0,0 +1,305 @@
|
||||
// File: TDataStd_Variable.cxx
|
||||
// Created: Wed Dec 10 11:25:50 1997
|
||||
// Author: Denis PASCAL
|
||||
// <dp@dingox.paris1.matra-dtv.fr>
|
||||
|
||||
|
||||
#include <TDataStd_Variable.ixx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDataStd_Real.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <Standard_DomainError.hxx>
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : GetID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Variable::GetID()
|
||||
{
|
||||
static Standard_GUID TDataStd_VariableID("ce241469-8e57-11d1-8953-080009dc4425");
|
||||
return TDataStd_VariableID;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Variable) TDataStd_Variable::Set(const TDF_Label& L)
|
||||
{
|
||||
Handle(TDataStd_Variable) A;
|
||||
if (!L.FindAttribute (TDataStd_Variable::GetID(), A)) {
|
||||
A = new TDataStd_Variable ();
|
||||
L.AddAttribute(A);
|
||||
}
|
||||
return A;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TDataStd_Variable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
TDataStd_Variable::TDataStd_Variable()
|
||||
:isConstant(Standard_False),
|
||||
myUnit("SCALAR")
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::Name (const TCollection_ExtendedString& string)
|
||||
{
|
||||
TDataStd_Name::Set(Label(),string);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Name
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_ExtendedString& TDataStd_Variable::Name () const
|
||||
{
|
||||
Handle(TDataStd_Name) N;
|
||||
if (!Label().FindAttribute(TDataStd_Name::GetID(),N)) {
|
||||
Standard_DomainError::Raise("TDataStd_Variable::Name : invalid model");
|
||||
}
|
||||
return N->Get();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsValued
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Variable::IsValued () const
|
||||
{
|
||||
return (Label().IsAttribute (TDataStd_Real::GetID()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Real
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Real) TDataStd_Variable::Real() const
|
||||
{
|
||||
Handle(TDataStd_Real) R;
|
||||
if (!Label().FindAttribute(TDataStd_Real::GetID(),R)) {
|
||||
Standard_DomainError::Raise("TDataStd_Variable::Real : invalid model");
|
||||
}
|
||||
return R;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Set
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::Set (const Standard_Real value, const TDataStd_RealEnum dimension) const
|
||||
{
|
||||
if (!IsValued()) {
|
||||
Handle(TDataStd_Real) R = TDataStd_Real::Set(Label(),value);
|
||||
R->SetDimension (dimension);
|
||||
}
|
||||
else {
|
||||
Handle(TDataStd_Real) R = TDataStd_Real::Set(Label(),value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Get
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Real TDataStd_Variable::Get () const
|
||||
{
|
||||
Handle(TDataStd_Real) R;
|
||||
if (!Label().FindAttribute(TDataStd_Real::GetID(),R)) {
|
||||
Standard_DomainError::Raise("TDataStd_Variable::Get : invalid model");
|
||||
}
|
||||
return R->Get();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAssigned
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Variable::IsAssigned () const
|
||||
{
|
||||
return (Label().IsAttribute(TDataStd_Expression::GetID()));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Assign
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Expression) TDataStd_Variable::Assign () const
|
||||
{
|
||||
Handle(TDataStd_Expression) E = TDataStd_Expression::Set(Label());
|
||||
return E;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Desassign
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::Desassign () const
|
||||
{
|
||||
Handle(TDataStd_Expression) E;
|
||||
if (!Label().FindAttribute(TDataStd_Expression::GetID(),E)) {
|
||||
Standard_DomainError::Raise("TDataStd_Variable::Deassign");
|
||||
}
|
||||
Label().ForgetAttribute(E);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Expression
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDataStd_Expression) TDataStd_Variable::Expression () const
|
||||
{
|
||||
Handle(TDataStd_Expression) E;
|
||||
if (!Label().FindAttribute(TDataStd_Expression::GetID(),E)) {
|
||||
Standard_DomainError::Raise("TDataStd_Variable::GetExpression");
|
||||
}
|
||||
return E;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsCaptured
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Variable::IsCaptured() const
|
||||
{
|
||||
return Real()->IsCaptured();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsConstant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean TDataStd_Variable::IsConstant () const
|
||||
{
|
||||
return isConstant;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Constant
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::Constant (const Standard_Boolean status)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(isConstant == status) return;
|
||||
|
||||
Backup();
|
||||
isConstant = status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Unit
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void TDataStd_Variable::Unit(const TCollection_AsciiString& unit)
|
||||
{
|
||||
// OCC2932 correction
|
||||
if(myUnit == unit)
|
||||
return;
|
||||
|
||||
Backup();
|
||||
myUnit = unit;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : Unit
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const TCollection_AsciiString& TDataStd_Variable::Unit() const
|
||||
{
|
||||
return myUnit;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ID
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const Standard_GUID& TDataStd_Variable::ID() const
|
||||
{
|
||||
return GetID();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Restore
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::Restore (const Handle(TDF_Attribute)& With)
|
||||
{
|
||||
Handle(TDataStd_Variable) V = Handle(TDataStd_Variable)::DownCast (With);
|
||||
isConstant = V->IsConstant();
|
||||
myUnit = V->Unit();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NewEmpty
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(TDF_Attribute) TDataStd_Variable::NewEmpty() const
|
||||
{
|
||||
return new TDataStd_Variable();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Paste
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::Paste (const Handle(TDF_Attribute)& Into,
|
||||
const Handle(TDF_RelocationTable)& /*RT*/) const
|
||||
{
|
||||
Handle(TDataStd_Variable) V = Handle(TDataStd_Variable)::DownCast (Into);
|
||||
V->Constant(isConstant);
|
||||
V->Unit(myUnit);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : References
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void TDataStd_Variable::References(const Handle(TDF_DataSet)& DS) const
|
||||
{
|
||||
Handle(TDataStd_Name) N;
|
||||
if (Label().FindAttribute(TDataStd_Name::GetID(),N)) {
|
||||
DS->AddAttribute(N);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Dump
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_OStream& TDataStd_Variable::Dump(Standard_OStream& anOS) const
|
||||
{
|
||||
anOS << "Variable";
|
||||
return anOS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user