Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/ApplicationFramework/TKBinL/BinMDF/BinMDF_ADriverTable.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ void BinMDF_ADriverTable::AddDerivedDriver(const occ::handle<TDF_Attribute>& the
for (occ::handle<Standard_Type> aType = anInstanceType->Parent(); !aType.IsNull();
aType = aType->Parent())
{
if (myMap.IsBound(aType))
const occ::handle<BinMDF_ADriver>* pDriver = myMap.Seek(aType);
if (pDriver)
{
occ::handle<BinMDF_DerivedDriver> aDriver =
new BinMDF_DerivedDriver(theInstance, myMap(aType));
occ::handle<BinMDF_DerivedDriver> aDriver = new BinMDF_DerivedDriver(theInstance, *pDriver);
myMap.Bind(anInstanceType, aDriver);
return;
}
Expand Down Expand Up @@ -129,10 +129,10 @@ void BinMDF_ADriverTable::AssignIds(
const occ::handle<Standard_Type>& aType = it.Key();
const occ::handle<BinMDF_ADriver>& aDriver = it.Value();
const TCollection_AsciiString& aTypeName = aDriver->TypeName();
if (aStringIdMap.IsBound(aTypeName))
const int* pId = aStringIdMap.Seek(aTypeName);
if (pId)
{
i = aStringIdMap(aTypeName);
myMapId.Bind(aType, i);
myMapId.Bind(aType, *pId);
}
}

Expand Down
46 changes: 25 additions & 21 deletions src/ApplicationFramework/TKCAF/TNaming/TNaming.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ bool TNaming::SubstituteSShape(const TDF_Label& Lab, const TopoDS_Shape& From, T
occ::handle<TNaming_UsedShapes> US;
Lab.Root().FindAttribute(TNaming_UsedShapes::GetID(), US);
NCollection_DataMap<TopoDS_Shape, TNaming_PtrRefShape, TopTools_ShapeMapHasher>& amap = US->Map();
if (!amap.IsBound(To))
TNaming_RefShape** pPos = amap.ChangeSeek(To);
if (!pPos)
return false;
TNaming_RefShape* pos;
pos = amap.ChangeFind(To);
TNaming_RefShape* pos = *pPos;
if (!amap.UnBind(To))
return false;
// update shape
Expand Down Expand Up @@ -421,15 +421,17 @@ static void Replace(
{
if (!it.OldShape().IsNull())
{
OS = it.OldShape();
if (M.IsBound(OS))
OS = M(OS);
OS = it.OldShape();
const TopoDS_Shape* pMappedS = M.Seek(OS);
if (pMappedS)
OS = *pMappedS;
}
if (!it.NewShape().IsNull())
{
NS = it.NewShape();
if (M.IsBound(NS))
NS = M(NS);
NS = it.NewShape();
const TopoDS_Shape* pMappedS = M.Seek(NS);
if (pMappedS)
NS = *pMappedS;
}
LoadNamedShape(B, Evol, OS, NS);
}
Expand Down Expand Up @@ -528,8 +530,9 @@ static TopoDS_Shape ShapeCopy(
{
if (S.IsNull())
return S;
if (M.IsBound(S))
return M(S);
const TopoDS_Shape* pMapped = M.Seek(S);
if (pMapped)
return *pMapped;
//----------------------------
// construction de la copie.
// 1- copie des sous shapes.
Expand Down Expand Up @@ -844,9 +847,8 @@ TopoDS_Shape TNaming::FindUniqueContext(const TopoDS_Shape& Selection, const Top
<< " OR = " << it.Value().Orientation() << std::endl;
}
#endif
if (aMap.IsBound(Selection))
return aMap.Find(Selection);
return TopoDS_Shape();
const TopoDS_Shape* pResult = aMap.Seek(Selection);
return pResult ? *pResult : TopoDS_Shape();
}

//=======================================================================
Expand Down Expand Up @@ -876,8 +878,9 @@ TopoDS_Shape TNaming::FindUniqueContextSet(const TopoDS_Shape& Selection,
if (aStopType == TopAbs_SHAPE)
aStopType = Selection.ShapeType();
BuildMap(Context, aStopType, aMap);
if (aMap.IsBound(Selection))
return aMap.Find(Selection);
const TopoDS_Shape* pSelResult = aMap.Seek(Selection);
if (pSelResult)
return *pSelResult;
else if (Selection.ShapeType() == TopAbs_COMPOUND)
{
int num1(0), num2(0);
Expand All @@ -888,16 +891,17 @@ TopoDS_Shape TNaming::FindUniqueContextSet(const TopoDS_Shape& Selection,
NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> aView;
for (; it.More(); it.Next(), num1++)
{
if (aMap.IsBound(it.Value()))
const TopoDS_Shape* pVal = aMap.Seek(it.Value());
if (pVal)
{
if (aView.Add(aMap.Find(it.Value())))
if (aView.Add(*pVal))
{
B.Add(CompShape, aMap.Find(it.Value()));
B.Add(CompShape, *pVal);
}
if (!Arr.IsNull())
Arr->SetValue(num1 + 1, aMap.Find(it.Value()));
Arr->SetValue(num1 + 1, *pVal);

if (aMap.Find(it.Value()) == Context)
if (*pVal == Context)
num2++;
}
}
Expand Down
52 changes: 30 additions & 22 deletions src/ApplicationFramework/TKCAF/TNaming/TNaming_NamedShape.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,13 @@ void TNaming_Builder::Generated(const TopoDS_Shape& newShape)
TNaming_RefShape* pos = nullptr;
TNaming_RefShape* pns;

if (myShapes->myMap.IsBound(newShape))
TNaming_RefShape** ppns = myShapes->myMap.ChangeSeek(newShape);
if (ppns)
{
#ifdef OCCT_DEBUG_BUILDER
std::cout << "TNaming_Builder::Generate : the shape is already in the attribute" << std::endl;
#endif
pns = myShapes->myMap.ChangeFind(newShape);
pns = *ppns;
if (pns->FirstUse()->myAtt == myAtt.operator->())
{
throw Standard_ConstructionError("TNaming_Builder::Generate");
Expand Down Expand Up @@ -674,8 +675,9 @@ void TNaming_Builder::Delete(const TopoDS_Shape& oldShape)
TNaming_RefShape* pns;
TNaming_RefShape* pos;

if (myShapes->myMap.IsBound(oldShape))
pos = myShapes->myMap.ChangeFind(oldShape);
TNaming_RefShape** ppos = myShapes->myMap.ChangeSeek(oldShape);
if (ppos)
pos = *ppos;
else
{
#ifdef OCCT_DEBUG_BUILDER
Expand Down Expand Up @@ -714,23 +716,25 @@ void TNaming_Builder::Generated(const TopoDS_Shape& oldShape, const TopoDS_Shape
#endif
return;
}
TNaming_RefShape* pos;
if (!myShapes->myMap.IsBound(oldShape))
TNaming_RefShape* pos;
TNaming_RefShape** ppos = myShapes->myMap.ChangeSeek(oldShape);
if (!ppos)
{
pos = new TNaming_RefShape(oldShape);
myShapes->myMap.Bind(oldShape, pos);
}
else
pos = myShapes->myMap.ChangeFind(oldShape);
pos = *ppos;

TNaming_RefShape* pns;
if (!myShapes->myMap.IsBound(newShape))
TNaming_RefShape* pns;
TNaming_RefShape** ppns = myShapes->myMap.ChangeSeek(newShape);
if (!ppns)
{
pns = new TNaming_RefShape(newShape);
myShapes->myMap.Bind(newShape, pns);
}
else
pns = myShapes->myMap.ChangeFind(newShape);
pns = *ppns;

TNaming_Node* pdn = new TNaming_Node(pos, pns);
myAtt->Add(pdn);
Expand All @@ -757,23 +761,25 @@ void TNaming_Builder::Modify(const TopoDS_Shape& oldShape, const TopoDS_Shape& n
#endif
return;
}
TNaming_RefShape* pos;
if (!myShapes->myMap.IsBound(oldShape))
TNaming_RefShape* pos;
TNaming_RefShape** ppos = myShapes->myMap.ChangeSeek(oldShape);
if (!ppos)
{
pos = new TNaming_RefShape(oldShape);
myShapes->myMap.Bind(oldShape, pos);
}
else
pos = myShapes->myMap.ChangeFind(oldShape);
pos = *ppos;

TNaming_RefShape* pns;
if (!myShapes->myMap.IsBound(newShape))
TNaming_RefShape* pns;
TNaming_RefShape** ppns = myShapes->myMap.ChangeSeek(newShape);
if (!ppns)
{
pns = new TNaming_RefShape(newShape);
myShapes->myMap.Bind(newShape, pns);
}
else
pns = myShapes->myMap.ChangeFind(newShape);
pns = *ppns;

TNaming_Node* pdn = new TNaming_Node(pos, pns);
myAtt->Add(pdn);
Expand All @@ -793,23 +799,25 @@ void TNaming_Builder::Select(const TopoDS_Shape& S, const TopoDS_Shape& InS)
throw Standard_ConstructionError("TNaming_Builder : not same evolution");
}

TNaming_RefShape* pos;
if (!myShapes->myMap.IsBound(InS))
TNaming_RefShape* pos;
TNaming_RefShape** ppos = myShapes->myMap.ChangeSeek(InS);
if (!ppos)
{
pos = new TNaming_RefShape(InS);
myShapes->myMap.Bind(InS, pos);
}
else
pos = myShapes->myMap.ChangeFind(InS);
pos = *ppos;

TNaming_RefShape* pns;
if (!myShapes->myMap.IsBound(S))
TNaming_RefShape* pns;
TNaming_RefShape** ppns = myShapes->myMap.ChangeSeek(S);
if (!ppns)
{
pns = new TNaming_RefShape(S);
myShapes->myMap.Bind(S, pns);
}
else
pns = myShapes->myMap.ChangeFind(S);
pns = *ppns;

TNaming_Node* pdn = new TNaming_Node(pos, pns);
myAtt->Add(pdn);
Expand Down
6 changes: 2 additions & 4 deletions src/ApplicationFramework/TKCAF/TNaming/TNaming_Translator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ const NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher>&

const TopoDS_Shape TNaming_Translator::Copied(const TopoDS_Shape& aShape) const
{
TopoDS_Shape aResult;
if (myDataMapOfResults.IsBound(aShape))
aResult = myDataMapOfResults.Find(aShape);
return aResult;
const TopoDS_Shape* pResult = myDataMapOfResults.Seek(aShape);
return pResult ? *pResult : TopoDS_Shape();
}

//=================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,8 @@ occ::handle<NCollection_HSequence<occ::handle<StdStorage_Root>>> StdStorage_Root

occ::handle<StdStorage_Root> StdStorage_RootData::Find(const TCollection_AsciiString& aName) const
{
occ::handle<StdStorage_Root> p;
if (myObjects.Contains(aName))
{
p = myObjects.FindFromKey(aName);
}

return p;
const occ::handle<StdStorage_Root>* pRoot = myObjects.Seek(aName);
return pRoot ? *pRoot : occ::handle<StdStorage_Root>();
}

bool StdStorage_RootData::IsRoot(const TCollection_AsciiString& aName) const
Expand All @@ -168,9 +163,10 @@ bool StdStorage_RootData::IsRoot(const TCollection_AsciiString& aName) const

void StdStorage_RootData::RemoveRoot(const TCollection_AsciiString& aName)
{
if (myObjects.Contains(aName))
occ::handle<StdStorage_Root>* pRoot = myObjects.ChangeSeek(aName);
if (pRoot)
{
myObjects.ChangeFromKey(aName)->myRef = 0;
(*pRoot)->myRef = 0;
myObjects.RemoveKey(aName);
int aRef = 1;
for (NCollection_IndexedDataMap<TCollection_AsciiString, occ::handle<StdStorage_Root>>::Iterator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ bool TPrsStd_DriverTable::AddDriver(const Standard_GUID& guid,
bool TPrsStd_DriverTable::FindDriver(const Standard_GUID& guid,
occ::handle<TPrsStd_Driver>& driver) const
{
if (myDrivers.IsBound(guid))
const occ::handle<TPrsStd_Driver>* pDriver = myDrivers.Seek(guid);
if (pDriver)
{
driver = myDrivers.Find(guid);
driver = *pDriver;
return true;
}
return false;
Expand Down
48 changes: 13 additions & 35 deletions src/DataExchange/TKDEIGES/IGESControl/IGESControl_Reader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,7 @@ void IGESControl_Reader::PrintTransferInfo(const IFSelect_PrintFail failsonly,
char mess[300];
const occ::handle<Transfer_Binder>& aBinder = iterTrans.Value();
Sprintf(mess, "\t%s", aBinder->ResultTypeName());
if (aMapCountResult.IsBound(mess))
aMapCountResult.ChangeFind(mess)++;
else
aMapCountResult.Bind(mess, 1);
(*aMapCountResult.TryBound(mess, 0))++;
}
// Init for dicoCountMapping for IFSelect_Mapping
else if (mode == IFSelect_Mapping)
Expand All @@ -167,10 +164,7 @@ void IGESControl_Reader::PrintTransferInfo(const IFSelect_PrintFail failsonly,
"%d",
aBinder->ResultTypeName());
// std::cout << mess << std::endl;
if (aMapCountMapping.IsBound(mess))
aMapCountMapping.ChangeFind(mess)++;
else
aMapCountMapping.Bind(mess, 1);
(*aMapCountMapping.TryBound(mess, 0))++;
}
}

Expand All @@ -189,38 +183,25 @@ void IGESControl_Reader::PrintTransferInfo(const IFSelect_PrintFail failsonly,
for (i = 1; (failsonly == IFSelect_FailAndWarn) && (i <= nw); i++)
{
Sprintf(mess, "\t W\t%d\t%d\t%s", type, form, aCheck->CWarning(i));
if (aMapCount.IsBound(mess))
aMapCount.ChangeFind(mess)++;
else
aMapCount.Bind(mess, 1);

occ::handle<NCollection_HSequence<int>> alist;
if (aMapList.IsBound(mess))
alist = aMapList.ChangeFind(mess);
else
(*aMapCount.TryBound(mess, 0))++;
occ::handle<NCollection_HSequence<int>>* pList = aMapList.ChangeSeek(mess);
if (!pList)
{
alist = new NCollection_HSequence<int>();
aMapList.Bind(mess, alist);
pList = aMapList.Bound(mess, new NCollection_HSequence<int>());
}
alist->Append(model->Number(igesEnt) * 2 - 1);
(*pList)->Append(model->Number(igesEnt) * 2 - 1);
}
for (i = 1; i <= nf; i++)
{
Sprintf(mess, "\t F\t%d\t%d\t%s", type, form, aCheck->CFail(i));
// TF << mess << std::endl;
if (aMapCount.IsBound(mess))
aMapCount.ChangeFind(mess)++;
else
aMapCount.Bind(mess, 1);
occ::handle<NCollection_HSequence<int>> alist;
if (aMapList.IsBound(mess))
alist = aMapList.ChangeFind(mess);
else
(*aMapCount.TryBound(mess, 0))++;
occ::handle<NCollection_HSequence<int>>* pList = aMapList.ChangeSeek(mess);
if (!pList)
{
alist = new NCollection_HSequence<int>();
aMapList.Bind(mess, alist);
pList = aMapList.Bound(mess, new NCollection_HSequence<int>());
}
alist->Append(model->Number(igesEnt) * 2 - 1);
(*pList)->Append(model->Number(igesEnt) * 2 - 1);
}
nbWarn += nw;
nbFail += nf;
Expand Down Expand Up @@ -337,10 +318,7 @@ void IGESControl_Reader::PrintTransferInfo(const IFSelect_PrintFail failsonly,
"%d",
"Failed");
// std::cout << mess << std::endl;
if (aMapCountMapping.IsBound(mess))
aMapCountMapping.ChangeFind(mess)++;
else
aMapCountMapping.Bind(mess, 1);
(*aMapCountMapping.TryBound(mess, 0))++;
}
}
}
Expand Down
Loading
Loading