MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #27932 All Revisions ] Back to Issue ]
Summary 0027932: Improvement of standard attributes usability
Revision 2016-10-14 11:35 by szy
Additional information
and documentation updates
1)Modified sources:

TDataStd
  TDataStd_AsciiString.cx
  TDataStd_AsciiString.hx
  TDataStd_Integer.cxx
  TDataStd_Integer.hxx
  TDataStd_Name.cxx
  TDataStd_Name.hxx
  TDataStd_Real.cxx
  TDataStd_Real.hxx
DDataStd
  DDataStd_BasicCommands.cxx
  DDataStd_NameCommands.cxx
BinLDrivers
  BinLDrivers.cxx
BinMDataStd
BinMDataStd_AsciiStringDriver.cxx
  BinMDataStd_IntegerDriver.cxx
  BinMDataStd_NameDriver.cxx
  BinMDataStd_RealDriver.cxx
XmlMDataStd
  XmlMDataStd_AsciiStringDriver.cxx
  XmlMDataStd_IntegerDriver.cxx
  XmlMDataStd_NameDriver.cxx
  XmlMDataStd_RealDriver.cxx
StdLPersistent
  StdLPersistent_Real.hxx
  StdLPersistent_Value.cxx
  StdLPersistent_Value.hxx
Standard
  Standard_GUID.cxx
  Standard_GUID.hxx

2)Description
The listed attributes (TDataStd_Integer, TDataStd_Real, TDataStd_Name, TDataStd_AsciiString) received the new feature to be user defined. It allows to set at the same Label as many attributes of the same type as you want. Let's consider it on example of the TDataStd_Real attribute. The previous version of the attribute allows to set the attribute using static method Set in next way:

static Handle(TDataStd_Real) Set (const TDF_Label& label, const Standard_Real value);
The is a default form which is kept by the attribute. It uses for the attribute identification the default GUID - TDataStd_Real::GetID(). In case if you want to use the new feature (user defined Real attribute), for example to define several attributes which should keep a value of the same type - Standard_Real, but to be associated with different user's notions (or objects) the new static method Set should be used. In our example we will define two Real attributes which presents two customer's objects - Density and Volume and will be put on the same Label.

#define DENSITY Standard_GUID("12e9454b-6dbc-11d4-b9c8-0060b0ee2810")

#define VOLUME Standard_GUID("12e9454b-6dbc-11d4-b9c8-0060b0ee2811")

TDF_Label aLabel = ...;

// Real attribute type with user defined GUID associated with user's object "Density"
TDataStd_Real::Set(aLabel, DENSITY, 1.2);

// Real attribute type with user defined GUID associated with user's object "Volume"
TDataStd_Real::Set(aLabel, VOLUME, 185.5);

To find an user defined Real attribute just use a corresponding GUID:
Handle (TDataStd_Real anAtt;
aLabel.FindAttribute (DENSITY, anAtt);
Revision 2016-10-05 17:18 by szy
Additional information
and documentation updates


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker