FILES
QANCollection.cdl
QANCollection.cxx
-QANCollection1.cxx
-QANCollection2.cxx
-QANCollection3.cxx
-QANCollection4.cxx
+QANCollection_Simple.cxx
+QANCollection_Test.cxx
+QANCollection_Perf.cxx
+QANCollection_Alloc.cxx
QANCollection_Stl.cxx
QANCollection_Common.cxx
QANCollection_Common.hxx
-QANCollection_Common2.hxx
-QANCollection_Common3.hxx
-QANCollection_FuncArrays.hxx
-QANCollection_FuncLists.hxx
-QANCollection_FuncMaps.hxx
-QANCollection_FuncTest.hxx
-QANCollection_PerfArrays.hxx
-QANCollection_PerfLists.hxx
-QANCollection_PerfMaps.hxx
-QANCollection_PerfTest.hxx
-QANCollectionTest.cxx
-QANCollection_PerfSparseArray.hxx
MapRealHasher from TColStd,
MapIntegerHasher from TColStd);
-
---- HashCode (thePnt : Pnt from gp;
---- theUpper : Integer from Standard)
---- returns Integer from Standard;
-
---- IsEqual (thePnt1 : Pnt from gp;
---- thePnt2 : Pnt from gp)
---- returns Boolean from Standard;
-
Commands(DI : in out Interpretor from Draw);
- Commands1(DI : in out Interpretor from Draw);
- Commands2(DI : in out Interpretor from Draw);
- Commands3(DI : in out Interpretor from Draw);
- Commands4(DI : in out Interpretor from Draw);
+ CommandsSimple(DI : in out Interpretor from Draw);
+ CommandsTest(DI : in out Interpretor from Draw);
+ CommandsPerf(DI : in out Interpretor from Draw);
+ CommandsAlloc(DI : in out Interpretor from Draw);
CommandsStl(DI : in out Interpretor from Draw);
end;
#include <Draw_Interpretor.hxx>
#include <gp_Pnt.hxx>
-//#include <QANCollection_Common.hxx>
void QANCollection::Commands (Draw_Interpretor& theCommands)
{
- QANCollection::Commands1 (theCommands);
- QANCollection::Commands2 (theCommands);
- QANCollection::Commands3 (theCommands);
- QANCollection::Commands4 (theCommands);
+ QANCollection::CommandsSimple (theCommands);
+ QANCollection::CommandsTest (theCommands);
+ QANCollection::CommandsPerf (theCommands);
+ QANCollection::CommandsAlloc (theCommands);
QANCollection::CommandsStl (theCommands);
}
+++ /dev/null
-// Created on: 2004-03-05
-// Created by: Mikhail KUZMITCHEV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <QANCollection.hxx>
-#include <Draw_Interpretor.hxx>
-
-#include <OSD_PerfMeter.hxx>
-
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-
-#define USE_MACROS
-#ifdef USE_MACROS
-#include <NCollection_DefineArray1.hxx>
-#include <NCollection_DefineSequence.hxx>
-DEFINE_BASECOLLECTION (MyBaseCollPnt, gp_Pnt)
-DEFINE_ARRAY1 (MyArray1, MyBaseCollPnt, gp_Pnt)
-DEFINE_SEQUENCE (MySequence, MyBaseCollPnt, gp_Pnt)
-#else
-#include <NCollection_Sequence.hxx>
-#include <NCollection_Array1.hxx>
-typedef NCollection_Array1<gp_Pnt> MyArray1;
-typedef NCollection_Sequence<gp_Pnt> MySequence;
-typedef NCollection_BaseCollection<gp_Pnt> MyBaseCollPnt;
-#endif
-void checkArray (const Standard_Boolean);
-void checkSequence (const Standard_Boolean, const Standard_Boolean);
-void createArray (TColgp_Array1OfPnt&);
-void assignArray (TColgp_Array1OfPnt&, const TColgp_Array1OfPnt&);
-void createSequence (TColgp_SequenceOfPnt&);
-void assignSequence (TColgp_SequenceOfPnt&, const TColgp_SequenceOfPnt&);
-
-void createArray (MyArray1&);
-void assignArray (MyArray1&, const MyArray1&);
-void createSequence (MySequence&);
-void assignSequence (MySequence&, const MySequence&);
-void assignCollection (MyBaseCollPnt&, const MyBaseCollPnt&, const char *);
-void printAllMeters ();
-
-void checkArray (const Standard_Boolean isNewColl)
-{
- if (isNewColl) {
- MyArray1 anArrPnt (1, 100000), anArrPnt1 (1, 100000);
- createArray (anArrPnt);
- assignArray (anArrPnt1, anArrPnt);
- assignCollection (anArrPnt1, anArrPnt, "Assign collect to array");
- } else {
- TColgp_Array1OfPnt anArrPnt (1,100000), anArrPnt1 (1, 100000);
- createArray (anArrPnt);
- assignArray (anArrPnt1, anArrPnt);
- }
- printAllMeters ();
-}
-
-static Handle(NCollection_BaseAllocator) anAlloc[2];
-
-Handle(NCollection_BaseAllocator) getAlloc (const int i)
-{
- return i == 0 ? anAlloc[0]: anAlloc[1];
-}
-
-void checkSequence (const Standard_Boolean isNewColl,
- const Standard_Boolean isIncr)
-{
- if (isNewColl) {
- if (isIncr) {
- anAlloc[0] = new NCollection_IncAllocator;
- anAlloc[1] = new NCollection_IncAllocator;
- }
- MySequence aSeqPnt (anAlloc[0]), aSeqPnt1(anAlloc[1]);
- createSequence (aSeqPnt);
- assignSequence (aSeqPnt1, aSeqPnt);
- assignCollection (aSeqPnt1, aSeqPnt, "Assign collect to sequence");
- } else {
- TColgp_SequenceOfPnt aSeqPnt, aSeqPnt1;
- createSequence (aSeqPnt);
- assignSequence (aSeqPnt1, aSeqPnt);
- }
- printAllMeters ();
-}
-
-//=======================================================================
-//function : QANColCheckArray1
-//purpose :
-//=======================================================================
-static Standard_Integer QANColCheckArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc > 2) {
- di << "Usage : " << argv[0] << " [-n]" << "\n";
- return 1;
- }
-
- Standard_Boolean isNewColl = Standard_False;
- if (argc > 1) {
- if (strcmp (argv[1], "-n") == 0) isNewColl = Standard_True;
- }
- checkArray (isNewColl);
- return 0;
-}
-
-//=======================================================================
-//function : QANColCheckSequence
-//purpose :
-//=======================================================================
-static Standard_Integer QANColCheckSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc > 2) {
- di << "Usage : " << argv[0] << " [-n]/[-ni]/[-in]" << "\n";
- return 1;
- }
-
- Standard_Boolean isNewColl = Standard_False, isIncr = Standard_False;
- if (argc > 1) {
- if (strcmp (argv[1], "-n") == 0) isNewColl = Standard_True;
- if (strcmp (argv[1], "-ni") == 0 || strcmp (argv[1], "-in") == 0)
- {
- isNewColl = Standard_True;
- isIncr = Standard_True;
- }
- }
- checkSequence (isNewColl, isIncr);
- return 0;
-}
-
-void QANCollection::Commands1(Draw_Interpretor& theCommands) {
- const char *group = "QANCollection";
-
- // from agvCollTest/src/AgvColEXE/TestEXE.cxx
- theCommands.Add("QANColCheckArray1", "QANColCheckArray1 [-n]", __FILE__, QANColCheckArray1, group);
- theCommands.Add("QANColCheckSequence", "QANColCheckSequence [-n]/[-ni]/[-in]", __FILE__, QANColCheckSequence, group);
-
- return;
-}
+++ /dev/null
-// Created on: 2004-03-05
-// Created by: Mikhail KUZMITCHEV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <QANCollection.hxx>
-
-#include <Draw.hxx>
-#include <Draw_Interpretor.hxx>
-
-#include <gp_Pnt.hxx>
-
-// HashCode and IsEquel must be defined for key types of maps
-Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper)
-{
- return HashCode(thePnt.X(),theUpper);
-}
-
-Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2)
-{
- return theP1.IsEqual(theP2,gp::Resolution());
-}
-
-#define ItemType gp_Pnt
-#define Key1Type gp_Pnt
-#define Key2Type Standard_Real
-
-#include <QANCollection_FuncTest.hxx>
-
-IMPLEMENT_HARRAY1(QANCollection_HArray1Func)
-IMPLEMENT_HARRAY2(QANCollection_HArray2Func)
-IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc)
-
-//=======================================================================
-//function : CheckArguments1
-//purpose :
-//=======================================================================
-Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper)
-{
- if ( argc != 3) {
- di << "Usage : " << argv[0] << " Lower Upper" << "\n";
- return 1;
- }
- Lower = Draw::Atoi(argv[1]);
- Upper = Draw::Atoi(argv[2]);
- if ( Lower > Upper ) {
- di << "Lower > Upper" << "\n";
- return 1;
- }
- return 0;
-}
-
-//=======================================================================
-//function : CheckArguments2
-//purpose :
-//=======================================================================
-Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol)
-{
- if ( argc != 5) {
- di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n";
- return 1;
- }
- LowerRow = Draw::Atoi(argv[1]);
- UpperRow = Draw::Atoi(argv[2]);
- LowerCol = Draw::Atoi(argv[3]);
- UpperCol = Draw::Atoi(argv[4]);
- if ( LowerRow > UpperRow ) {
- di << "LowerRow > UpperRow" << "\n";
- return 1;
- }
- if ( LowerCol > UpperCol ) {
- di << "LowerCol UpperCol> " << "\n";
- return 1;
- }
- return 0;
-}
-
-
-//=======================================================================
-//function : QANColTestArray1
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Lower, Upper;
- if ( CheckArguments1(di, argc, argv, Lower, Upper) ) {
- return 1;
- }
- QANCollection_Array1Func anArr1(Lower, Upper);
- TestArray1(anArr1);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestArray2
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol;
- if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) {
- return 1;
- }
- QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol);
- TestArray2(anArr2);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_MapFunc aMap;
- TestMap(aMap);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestDataMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_DataMapFunc aDataMap;
- TestDataMap(aDataMap);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestDoubleMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_DoubleMapFunc aDoubleMap;
- TestDoubleMap(aDoubleMap);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestIndexedMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_IndexedMapFunc aIndexedMap;
- TestIndexedMap(aIndexedMap);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestIndexedDataMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_IDMapFunc aIDMap;
- TestIndexedDataMap(aIDMap);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestList
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_ListFunc aList;
- TestList(aList);
- return 0;
-}
-
-//=======================================================================
-//function : QANColTestSequence
-//purpose :
-//=======================================================================
-static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
- QANCollection_SequenceFunc aSeq;
- TestSequence(aSeq);
- return 0;
-}
-
-void QANCollection::Commands2(Draw_Interpretor& theCommands) {
- const char *group = "QANCollection";
-
- // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
- theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group);
- theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group);
- theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group);
- theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group);
- theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group);
- theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
- theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
- theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
- theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
-
- return;
-}
+++ /dev/null
-// Created on: 2004-03-05
-// Created by: Mikhail KUZMITCHEV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <QANCollection.hxx>
-
-#include <Draw.hxx>
-#include <Draw_Interpretor.hxx>
-
-#define ItemType gp_Pnt
-#define Key1Type Standard_Real
-#define Key2Type Standard_Integer
-
-#include <QANCollection_PerfTest.hxx>
-
-#include <QANCollection_PerfSparseArray.hxx>
-
-IMPLEMENT_HARRAY1(QANCollection_HArray1Perf)
-IMPLEMENT_HARRAY2(QANCollection_HArray2Perf)
-IMPLEMENT_HSEQUENCE(QANCollection_HSequencePerf)
-
-//=======================================================================
-//function : CheckArguments
-//purpose :
-//=======================================================================
-Standard_Integer CheckArguments(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Repeat, Standard_Integer& Size)
-{
- if ( argc != 3) {
- di << "Usage : " << argv[0] << " Repeat Size" << "\n";
- return 1;
- }
- Repeat = Draw::Atoi(argv[1]);
- Size = Draw::Atoi(argv[2]);
- if ( Repeat < 1 ) {
- di << "Repeat > 0" << "\n";
- return 1;
- }
- if ( Size < 1 ) {
- di << "Size > 0" << "\n";
- return 1;
- }
- return 0;
-}
-
-
-//=======================================================================
-//function : QANColPerfArray1
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompArray1(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfArray2
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompArray2(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfList
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompList(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfSequence
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompSequence(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompMap(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfDataMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompDataMap(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfDoubleMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompDoubleMap(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfIndexedMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompIndexedMap(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColPerfIndexedDataMap
-//purpose :
-//=======================================================================
-static Standard_Integer QANColPerfIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompIndexedDataMap(Repeat,Size);
- return 0;
-}
-
-//=======================================================================
-//function : QANColCheckSparseArray
-//purpose :
-//=======================================================================
-static Standard_Integer QANColCheckSparseArray(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- Standard_Integer Repeat, Size;
- if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
- return 1;
- }
- CompSparseArray(Repeat,Size);
- return 0;
-}
-
-void QANCollection::Commands3(Draw_Interpretor& theCommands) {
- const char *group = "QANCollection";
-
- // from agvCollTest/src/CollectionEXE/PerfTestEXE.cxx
- theCommands.Add("QANColPerfArray1", "QANColPerfArray1 Repeat Size", __FILE__, QANColPerfArray1, group);
- theCommands.Add("QANColPerfArray2", "QANColPerfArray2 Repeat Size", __FILE__, QANColPerfArray2, group);
- theCommands.Add("QANColPerfList", "QANColPerfList Repeat Size", __FILE__, QANColPerfList, group);
- theCommands.Add("QANColPerfSequence", "QANColPerfSequence Repeat Size", __FILE__, QANColPerfSequence, group);
- theCommands.Add("QANColPerfMap", "QANColPerfMap Repeat Size", __FILE__, QANColPerfMap, group);
- theCommands.Add("QANColPerfDataMap", "QANColPerfDataMap Repeat Size", __FILE__, QANColPerfDataMap, group);
- theCommands.Add("QANColPerfDoubleMap", "QANColPerfDoubleMap Repeat Size", __FILE__, QANColPerfDoubleMap, group);
- theCommands.Add("QANColPerfIndexedMap", "QANColPerfIndexedMap Repeat Size", __FILE__, QANColPerfIndexedMap, group);
- theCommands.Add("QANColPerfIndexedDataMap", "QANColPerfIndexedDataMap Repeat Size", __FILE__, QANColPerfIndexedDataMap, group);
-
- theCommands.Add("QANColCheckSparseArray", "QANColCheckSparseArray Repeat Size", __FILE__, QANColCheckSparseArray, group);
-
- return;
-}
-
+++ /dev/null
-// Created on: 2004-03-05
-// Created by: Mikhail KUZMITCHEV
-// Copyright (c) 2004-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <QANCollection.hxx>
-#include <Draw_Interpretor.hxx>
-
-#include <NCollection_StdAllocator.hxx>
-#include <NCollection_IncAllocator.hxx>
-#include <Standard_Assert.hxx>
-
-#include <list>
-#include <vector>
-
-//=======================================================================
-//function : QANColStdAllocator1
-//purpose :
-//=======================================================================
-static Standard_Integer QANColStdAllocator1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
-
- //type definitions
- typedef Handle(Standard_Transient) elem_type;
- typedef NCollection_StdAllocator<elem_type> allocator_type;
- Standard_STATIC_ASSERT (sizeof (allocator_type::value_type) == sizeof (elem_type));
- Standard_STATIC_ASSERT (sizeof (allocator_type::pointer) == sizeof (void*));
- Standard_STATIC_ASSERT (sizeof (allocator_type::const_pointer) == sizeof (void*));
-
- elem_type aDummy;
- allocator_type::reference aRef = aDummy;
- (void)aRef; // avoid compiler warning on unused
- allocator_type::const_reference aConstRef = aDummy;
- (void)aConstRef; // avoid compiler warning on unused
- Standard_STATIC_ASSERT (sizeof (allocator_type::size_type) == sizeof (size_t));
- Standard_STATIC_ASSERT (sizeof (allocator_type::difference_type) == sizeof (ptrdiff_t));
-
- typedef int other_elem_type;
- Standard_STATIC_ASSERT (sizeof (allocator_type::rebind<other_elem_type>::other::value_type) == sizeof (other_elem_type));
-
- return 0;
-}
-
-//=======================================================================
-//function : QANColStdAllocator2
-//purpose :
-//=======================================================================
-static Standard_Integer QANColStdAllocator2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
- if ( argc != 1) {
- di << "Usage : " << argv[0] << "\n";
- return 1;
- }
-
- //create incremental allocator outside the scope of objects it will manage
- Handle(NCollection_IncAllocator) anIncAlloc = new NCollection_IncAllocator();
-
- {
- //typed allocator
- NCollection_StdAllocator<int> aSAlloc (anIncAlloc);
- std::list<int, NCollection_StdAllocator<int> > aL (aSAlloc);
- aL.push_back (2);
- if ( aL.size() == size_t (1) ) {
- di << "Test1 : OK\n";
- } else {
- di << "Test1 : Error\n";
- }
-
- //type cast
- NCollection_StdAllocator<char> aCAlloc;
- std::vector<int, NCollection_StdAllocator<int> > aV (aCAlloc);
- aV.push_back (1);
- if ( aV.size() == size_t (1) ) {
- di << "Test2 : OK\n";
- } else {
- di << "Test2 : Error\n";
- }
-
- //using void-specialization allocator
- NCollection_StdAllocator<void> aVAlloc;
- std::vector<int, NCollection_StdAllocator<int> > aV2 (aVAlloc);
-
- aV2.resize (10);
- aV2.push_back (-1);
- if ( aV2.size() == size_t (11) ) {
- di << "Test3 : OK\n";
- } else {
- di << "Test3 : Error\n";
- }
-
- //equality of allocators
- if ( aSAlloc != aCAlloc ) {
- di << "Test4 : OK\n";
- } else {
- di << "Test4 : Error\n";
- }
- NCollection_StdAllocator<int> anIAlloc (anIncAlloc);
- if ( aSAlloc == anIAlloc ) {
- di << "Test5 : OK\n";
- } else {
- di << "Test5 : Error\n";
- }
-
- }
-
- return 0;
-}
-
-void QANCollection::Commands4(Draw_Interpretor& theCommands) {
- const char *group = "QANCollection";
-
- theCommands.Add("QANColStdAllocator1", "QANColStdAllocator1", __FILE__, QANColStdAllocator1, group);
- theCommands.Add("QANColStdAllocator2", "QANColStdAllocator2", __FILE__, QANColStdAllocator2, group);
-
- return;
-}
+++ /dev/null
-// Created on: 2002-04-16
-// Created by: Alexander GRIGORIEV
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-
-#define USE_MACROS
-#ifdef USE_MACROS
-#include <NCollection_DefineArray1.hxx>
-#include <NCollection_DefineSequence.hxx>
-DEFINE_BASECOLLECTION (MyBaseCollPnt, gp_Pnt)
-DEFINE_ARRAY1 (MyArray1, MyBaseCollPnt, gp_Pnt)
-DEFINE_SEQUENCE (MySequence, MyBaseCollPnt, gp_Pnt)
-#else
-#include <NCollection_Sequence.hxx>
-#include <NCollection_Array1.hxx>
-typedef NCollection_Array1<gp_Pnt> MyArray1;
-typedef NCollection_Sequence<gp_Pnt> MySequence;
-typedef NCollection_BaseCollection<gp_Pnt> MyBaseCollPnt;
-#endif
-
-#define PERF_ENABLE_METERS
-#include <OSD_PerfMeter.hxx>
-
-extern Handle(NCollection_BaseAllocator) getAlloc (const int i);
-
-const Standard_Integer REPEAT = 100;
-
-void createArray (TColgp_Array1OfPnt& anArrPnt)
-{
- OSD_PerfMeter aPerfMeter("Create array");
-
- for (Standard_Integer j = 0; j < 2*REPEAT; j++) {
- PERF_START_METER("Create array")
- for (Standard_Integer i = anArrPnt.Lower(); i <= anArrPnt.Upper(); i++)
- anArrPnt(i).SetCoord ((double)i, (double)(i+1), (double)(i+2));
- PERF_STOP_METER("Create array")
- }
-}
-
-void createArray (MyArray1& anArrPnt)
-{
- for (Standard_Integer j = 0; j < 2*REPEAT; j++) {
- PERF_START_METER("Create array")
- for (Standard_Integer i = anArrPnt.Lower(); i <= anArrPnt.Upper(); i++)
- anArrPnt(i).SetCoord ((double)i, (double)(i+1), (double)(i+2));
- PERF_STOP_METER("Create array")
- }
-}
-
-void assignArray (TColgp_Array1OfPnt& aDest, const TColgp_Array1OfPnt& aSrc)
-{
- for (Standard_Integer i = 0; i < 2*REPEAT; i++) {
- PERF_START_METER("Assign array to array")
- aDest = aSrc;
- PERF_STOP_METER("Assign array to array")
- }
-}
-
-void assignCollection (MyBaseCollPnt& aDest,
- const MyBaseCollPnt& aSrc,
- const char * MeterName)
-{
- for (Standard_Integer i = 0; i < REPEAT; i++) {
- perf_start_meter (MeterName);
-// if (getAlloc(1).IsNull() == Standard_False)
-// if (getAlloc(1)->IsKind(STANDARD_TYPE(NCollection_IncAllocator)))
-// Handle(NCollection_IncAllocator)::DownCast(getAlloc(1)) -> Clean();
- aDest.Assign(aSrc);
- perf_stop_meter (MeterName);
- }
-}
-
-void assignArray (MyArray1& aDest,
- const MyArray1& aSrc)
-{
- for (Standard_Integer i = 0; i < 2*REPEAT; i++) {
- PERF_START_METER("Assign array to array")
- aDest = aSrc;
- PERF_STOP_METER("Assign array to array")
- }
-}
-
-void createSequence (TColgp_SequenceOfPnt& aSeq)
-{
- for (Standard_Integer j = 0; j < REPEAT; j++) {
- PERF_START_METER("Clear sequence")
- aSeq.Clear();
- PERF_STOP_METER("Clear sequence")
- PERF_START_METER("Create sequence")
- for (Standard_Integer i = 0; i < 100000; i++)
- aSeq.Append (gp_Pnt((double)i, (double)(i+1), (double)(i+2)));
- PERF_STOP_METER("Create sequence")
- }
-}
-
-void createSequence (MySequence& aSeq)
-{
- for (Standard_Integer j = 0; j < REPEAT; j++) {
- PERF_START_METER("Clear sequence")
- aSeq.Clear();
-// if (getAlloc(0).IsNull() == Standard_False)
-// if (getAlloc(0)->IsKind(STANDARD_TYPE(NCollection_IncAllocator)))
-// Handle(NCollection_IncAllocator)::DownCast(getAlloc(0)) -> Clean();
- PERF_STOP_METER("Clear sequence")
- PERF_START_METER("Create sequence")
- for (Standard_Integer i = 0; i < 100000; i++)
- aSeq.Append (gp_Pnt((double)i, (double)(i+1), (double)(i+2)));
- PERF_STOP_METER("Create sequence")
- }
-}
-
-void assignSequence (TColgp_SequenceOfPnt& aDest,
- const TColgp_SequenceOfPnt& aSrc)
-{
- for (Standard_Integer i = 0; i < REPEAT; i++) {
- PERF_START_METER("Assign sequence to sequence")
- aDest = aSrc;
- PERF_STOP_METER("Assign sequence to sequence")
- }
-}
-
-void assignSequence (MySequence& aDest, const MySequence& aSrc)
-{
- for (Standard_Integer i = 0; i < REPEAT; i++) {
- PERF_START_METER("Assign sequence to sequence")
-// if (getAlloc(1).IsNull() == Standard_False)
-// if (getAlloc(1)->IsKind(STANDARD_TYPE(NCollection_IncAllocator)))
-// Handle(NCollection_IncAllocator)::DownCast(getAlloc(1)) -> Clean();
- aDest = aSrc;
- PERF_STOP_METER("Assign sequence to sequence")
- }
-}
-
-void printAllMeters ()
-{
- PERF_PRINT_ALL
-}
--- /dev/null
+// Created on: 2004-03-05
+// Created by: Mikhail KUZMITCHEV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <QANCollection.hxx>
+#include <Draw_Interpretor.hxx>
+
+#include <NCollection_StdAllocator.hxx>
+#include <NCollection_IncAllocator.hxx>
+#include <Standard_Assert.hxx>
+
+#include <list>
+#include <vector>
+
+//=======================================================================
+//function : QANColStdAllocator1
+//purpose :
+//=======================================================================
+static Standard_Integer QANColStdAllocator1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+
+ //type definitions
+ typedef Handle(Standard_Transient) elem_type;
+ typedef NCollection_StdAllocator<elem_type> allocator_type;
+ Standard_STATIC_ASSERT (sizeof (allocator_type::value_type) == sizeof (elem_type));
+ Standard_STATIC_ASSERT (sizeof (allocator_type::pointer) == sizeof (void*));
+ Standard_STATIC_ASSERT (sizeof (allocator_type::const_pointer) == sizeof (void*));
+
+ elem_type aDummy;
+ allocator_type::reference aRef = aDummy;
+ (void)aRef; // avoid compiler warning on unused
+ allocator_type::const_reference aConstRef = aDummy;
+ (void)aConstRef; // avoid compiler warning on unused
+ Standard_STATIC_ASSERT (sizeof (allocator_type::size_type) == sizeof (size_t));
+ Standard_STATIC_ASSERT (sizeof (allocator_type::difference_type) == sizeof (ptrdiff_t));
+
+ typedef int other_elem_type;
+ Standard_STATIC_ASSERT (sizeof (allocator_type::rebind<other_elem_type>::other::value_type) == sizeof (other_elem_type));
+
+ return 0;
+}
+
+//=======================================================================
+//function : QANColStdAllocator2
+//purpose :
+//=======================================================================
+static Standard_Integer QANColStdAllocator2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+
+ //create incremental allocator outside the scope of objects it will manage
+ Handle(NCollection_IncAllocator) anIncAlloc = new NCollection_IncAllocator();
+
+ {
+ //typed allocator
+ NCollection_StdAllocator<int> aSAlloc (anIncAlloc);
+ std::list<int, NCollection_StdAllocator<int> > aL (aSAlloc);
+ aL.push_back (2);
+ if ( aL.size() == size_t (1) ) {
+ di << "Test1 : OK\n";
+ } else {
+ di << "Test1 : Error\n";
+ }
+
+ //type cast
+ NCollection_StdAllocator<char> aCAlloc;
+ std::vector<int, NCollection_StdAllocator<int> > aV (aCAlloc);
+ aV.push_back (1);
+ if ( aV.size() == size_t (1) ) {
+ di << "Test2 : OK\n";
+ } else {
+ di << "Test2 : Error\n";
+ }
+
+ //using void-specialization allocator
+ NCollection_StdAllocator<void> aVAlloc;
+ std::vector<int, NCollection_StdAllocator<int> > aV2 (aVAlloc);
+
+ aV2.resize (10);
+ aV2.push_back (-1);
+ if ( aV2.size() == size_t (11) ) {
+ di << "Test3 : OK\n";
+ } else {
+ di << "Test3 : Error\n";
+ }
+
+ //equality of allocators
+ if ( aSAlloc != aCAlloc ) {
+ di << "Test4 : OK\n";
+ } else {
+ di << "Test4 : Error\n";
+ }
+ NCollection_StdAllocator<int> anIAlloc (anIncAlloc);
+ if ( aSAlloc == anIAlloc ) {
+ di << "Test5 : OK\n";
+ } else {
+ di << "Test5 : Error\n";
+ }
+
+ }
+
+ return 0;
+}
+
+void QANCollection::CommandsAlloc(Draw_Interpretor& theCommands) {
+ const char *group = "QANCollection";
+
+ theCommands.Add("QANColStdAllocator1", "QANColStdAllocator1", __FILE__, QANColStdAllocator1, group);
+ theCommands.Add("QANColStdAllocator2", "QANColStdAllocator2", __FILE__, QANColStdAllocator2, group);
+
+ return;
+}
+++ /dev/null
-// Created on: 2002-05-15
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_Common2_HeaderFile
-#define QANCollection_Common2_HeaderFile
-
-#include <stdio.h>
-#include <gp_Pnt.hxx>
-
-#include <QANCollection_Common.hxx>
-
-// ===================== INSTANTIATIONS ===========
-// ===================== The Types must be defined before this line ===========
-// These are: TheItemType, TheKey1Type, TheKey2Type
-// So must be defined ::HashCode and ::IsEqual too
-
-#if defined(ItemType) && defined(Key1Type) && defined(Key2Type)
-
-#include <NCollection_DefineBaseCollection.hxx>
-////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key1BaseCol,Key1Type)
-////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key2BaseCol,Key2Type)
-DEFINE_BASECOLLECTION(QANCollection_BaseColFunc,ItemType)
-DEFINE_BASECOLLECTION(QANCollection_Key1BaseColFunc,Key1Type)
-DEFINE_BASECOLLECTION(QANCollection_Key2BaseColFunc,Key2Type)
-
-#include <NCollection_DefineArray1.hxx>
-#include <NCollection_DefineHArray1.hxx>
-////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
-DEFINE_ARRAY1(QANCollection_Array1Func,QANCollection_BaseColFunc,ItemType)
-DEFINE_HARRAY1(QANCollection_HArray1Func,QANCollection_Array1Func)
-
-#include <NCollection_DefineArray2.hxx>
-#include <NCollection_DefineHArray2.hxx>
-////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
-DEFINE_ARRAY2(QANCollection_Array2Func,QANCollection_BaseColFunc,ItemType)
-DEFINE_HARRAY2(QANCollection_HArray2Func,QANCollection_Array2Func)
-
-#include <NCollection_DefineMap.hxx>
-#include <NCollection_DefineDataMap.hxx>
-#include <NCollection_DefineDoubleMap.hxx>
-#include <NCollection_DefineIndexedMap.hxx>
-#include <NCollection_DefineIndexedDataMap.hxx>
-////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
-////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
-////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
-////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
-////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
-DEFINE_MAP(QANCollection_MapFunc,QANCollection_Key1BaseColFunc,Key1Type)
-DEFINE_DATAMAP(QANCollection_DataMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
-DEFINE_DOUBLEMAP(QANCollection_DoubleMapFunc,QANCollection_Key2BaseColFunc,Key1Type,Key2Type)
-DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key1Type)
-DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
-
-#include <NCollection_DefineList.hxx>
-////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
-DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
-
-#include <NCollection_DefineSequence.hxx>
-#include <NCollection_DefineHSequence.hxx>
-////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
-DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
-DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
-
-
-// ===================== Type independent methods =============================
-////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
-void printCollection (QANCollection_BaseColFunc& aColl,
- const char * str)
-{
- printf ("%s:\n",str);
- Standard_Integer iSize = aColl.Size();
- ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
- QANCollection_BaseColFunc::Iterator& anIter = aColl.CreateIterator();
- if (!anIter.More())
- {
- if (iSize==0)
- printf (" <Empty collection>\n");
- else
- printf ("Error : empty collection has size==%d",iSize);
- }
- else
- {
- printf (" Size==%d\n",iSize);
- for (; anIter.More(); anIter.Next())
- PrintItem(anIter.Value());
- }
-}
-
-////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
-#if 0
-void printCollection (QANCollection_Key1BaseColFunc& aColl,
- const char * str)
-{
- printf ("%s:\n",str);
- Standard_Integer iSize = aColl.Size();
- ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
- QANCollection_Key1BaseColFunc::Iterator& anIter = aColl.CreateIterator();
- if (!anIter.More())
- {
- if (iSize==0)
- printf (" <Empty collection>\n");
- else
- printf ("Error : empty collection has size==%d",iSize);
- }
- else
- {
- printf (" Size==%d\n",iSize);
- for (; anIter.More(); anIter.Next())
- PrintItem(anIter.Value());
- }
-}
-#endif
-
-////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
-void printCollection (QANCollection_Key2BaseColFunc& aColl,
- const char * str)
-{
- printf ("%s:\n",str);
- Standard_Integer iSize = aColl.Size();
- ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
- QANCollection_Key2BaseColFunc::Iterator& anIter = aColl.CreateIterator();
- if (!anIter.More())
- {
- if (iSize==0)
- printf (" <Empty collection>\n");
- else
- printf ("Error : empty collection has size==%d",iSize);
- }
- else
- {
- printf (" Size==%d\n",iSize);
- for (; anIter.More(); anIter.Next())
- PrintItem(anIter.Value());
- }
-}
-
-////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
-//////////////////////////////// QANCollection_BaseCol& aCollDst)
-void AssignCollection (QANCollection_BaseColFunc& aCollSrc,
- QANCollection_BaseColFunc& aCollDst)
-{
- printCollection (aCollSrc,"Source collection");
- aCollDst.Assign(aCollSrc);
- printCollection (aCollDst,"Target collection");
-}
-
-////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
-//////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
-#if 0
-void AssignCollection (QANCollection_Key1BaseColFunc& aCollSrc,
- QANCollection_Key1BaseColFunc& aCollDst)
-{
- printCollection (aCollSrc,"Source collection");
- aCollDst.Assign(aCollSrc);
- printCollection (aCollDst,"Target collection");
-}
-#endif
-
-////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
-//////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
-void AssignCollection (QANCollection_Key2BaseColFunc& aCollSrc,
- QANCollection_Key2BaseColFunc& aCollDst)
-{
- printCollection (aCollSrc,"Source collection");
- aCollDst.Assign(aCollSrc);
- printCollection (aCollDst,"Target collection");
-}
-
-#endif
-
-#endif
+++ /dev/null
-// Created on: 2002-05-15
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_Common3_HeaderFile
-#define QANCollection_Common3_HeaderFile
-
-#include <stdio.h>
-#include <gp_Pnt.hxx>
-
-#include <QANCollection_Common.hxx>
-
-// ===================== INSTANTIATIONS ===========
-// ===================== The Types must be defined before this line ===========
-// These are: TheItemType, TheKey1Type, TheKey2Type
-// So must be defined ::HashCode and ::IsEqual too
-
-#if defined(ItemType) && defined(Key1Type) && defined(Key2Type)
-
-#include <NCollection_DefineBaseCollection.hxx>
-////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key1BaseCol,Key1Type)
-////////////////////////////////DEFINE_BASECOLLECTION(QANCollection_Key2BaseCol,Key2Type)
-DEFINE_BASECOLLECTION(QANCollection_BaseColPerf,ItemType)
-DEFINE_BASECOLLECTION(QANCollection_Key1BaseColPerf,Key1Type)
-DEFINE_BASECOLLECTION(QANCollection_Key2BaseColPerf,Key2Type)
-
-#include <NCollection_DefineArray1.hxx>
-#include <NCollection_DefineHArray1.hxx>
-////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
-DEFINE_ARRAY1(QANCollection_Array1Perf,QANCollection_BaseColPerf,ItemType)
-DEFINE_HARRAY1(QANCollection_HArray1Perf,QANCollection_Array1Perf)
-
-#include <NCollection_DefineArray2.hxx>
-#include <NCollection_DefineHArray2.hxx>
-////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
-DEFINE_ARRAY2(QANCollection_Array2Perf,QANCollection_BaseColPerf,ItemType)
-DEFINE_HARRAY2(QANCollection_HArray2Perf,QANCollection_Array2Perf)
-
-#include <NCollection_DefineMap.hxx>
-#include <NCollection_DefineDataMap.hxx>
-#include <NCollection_DefineDoubleMap.hxx>
-#include <NCollection_DefineIndexedMap.hxx>
-#include <NCollection_DefineIndexedDataMap.hxx>
-////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
-////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
-////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
-////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
-////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
-DEFINE_MAP(QANCollection_MapPerf,QANCollection_Key1BaseColPerf,Key1Type)
-DEFINE_DATAMAP(QANCollection_DataMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
-DEFINE_DOUBLEMAP(QANCollection_DoubleMapPerf,QANCollection_Key2BaseColPerf,Key1Type,Key2Type)
-DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key1Type)
-DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
-
-#include <NCollection_DefineList.hxx>
-////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
-DEFINE_LIST(QANCollection_ListPerf,QANCollection_BaseColPerf,ItemType)
-
-#include <NCollection_DefineSequence.hxx>
-#include <NCollection_DefineHSequence.hxx>
-////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
-////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
-DEFINE_SEQUENCE(QANCollection_SequencePerf,QANCollection_BaseColPerf,ItemType)
-DEFINE_HSEQUENCE(QANCollection_HSequencePerf,QANCollection_SequencePerf)
-
-
-// ===================== Type independent methods =============================
-////////////////////////////////void printCollection (QANCollection_BaseCol& aColl,
-#if 0
-void printCollection (QANCollection_BaseColPerf& aColl,
- const char * str)
-{
- printf ("%s:\n",str);
- Standard_Integer iSize = aColl.Size();
- ////////////////////////////////QANCollection_BaseCol::Iterator& anIter = aColl.CreateIterator();
- QANCollection_BaseColPerf::Iterator& anIter = aColl.CreateIterator();
- if (!anIter.More())
- {
- if (iSize==0)
- printf (" <Empty collection>\n");
- else
- printf ("Error : empty collection has size==%d",iSize);
- }
- else
- {
- printf (" Size==%d\n",iSize);
- for (; anIter.More(); anIter.Next())
- PrintItem(anIter.Value());
- }
-}
-
-////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
-void printCollection (QANCollection_Key1BaseColPerf& aColl,
- const char * str)
-{
- printf ("%s:\n",str);
- Standard_Integer iSize = aColl.Size();
- ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
- QANCollection_Key1BaseColPerf::Iterator& anIter = aColl.CreateIterator();
- if (!anIter.More())
- {
- if (iSize==0)
- printf (" <Empty collection>\n");
- else
- printf ("Error : empty collection has size==%d",iSize);
- }
- else
- {
- printf (" Size==%d\n",iSize);
- for (; anIter.More(); anIter.Next())
- PrintItem(anIter.Value());
- }
-}
-
-////////////////////////////////void printCollection (QANCollection_Key2BaseCol& aColl,
-void printCollection (QANCollection_Key2BaseColPerf& aColl,
- const char * str)
-{
- printf ("%s:\n",str);
- Standard_Integer iSize = aColl.Size();
- ////////////////////////////////QANCollection_Key2BaseCol::Iterator& anIter = aColl.CreateIterator();
- QANCollection_Key2BaseColPerf::Iterator& anIter = aColl.CreateIterator();
- if (!anIter.More())
- {
- if (iSize==0)
- printf (" <Empty collection>\n");
- else
- printf ("Error : empty collection has size==%d",iSize);
- }
- else
- {
- printf (" Size==%d\n",iSize);
- for (; anIter.More(); anIter.Next())
- PrintItem(anIter.Value());
- }
-}
-
-////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
-//////////////////////////////// QANCollection_BaseCol& aCollDst)
-void AssignCollection (QANCollection_BaseColPerf& aCollSrc,
- QANCollection_BaseColPerf& aCollDst)
-{
- printCollection (aCollSrc,"Source collection");
- aCollDst.Assign(aCollSrc);
- printCollection (aCollDst,"Target collection");
-}
-
-////////////////////////////////void AssignCollection (QANCollection_Key1BaseCol& aCollSrc,
-//////////////////////////////// QANCollection_Key1BaseCol& aCollDst)
-void AssignCollection (QANCollection_Key1BaseColPerf& aCollSrc,
- QANCollection_Key1BaseColPerf& aCollDst)
-{
- printCollection (aCollSrc,"Source collection");
- aCollDst.Assign(aCollSrc);
- printCollection (aCollDst,"Target collection");
-}
-
-////////////////////////////////void AssignCollection (QANCollection_Key2BaseCol& aCollSrc,
-//////////////////////////////// QANCollection_Key2BaseCol& aCollDst)
-void AssignCollection (QANCollection_Key2BaseColPerf& aCollSrc,
- QANCollection_Key2BaseColPerf& aCollDst)
-{
- printCollection (aCollSrc,"Source collection");
- aCollDst.Assign(aCollSrc);
- printCollection (aCollDst,"Target collection");
-}
-#endif
-
-#endif
-
-#endif
+++ /dev/null
-// Created on: 2002-04-30
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_FuncArrays_HeaderFile
-#define QANCollection_FuncArrays_HeaderFile
-
-// ===================== Test methods of Array1 type ==========================
-////////////////////////////////void TestArray1 (QANCollection_Array1& theA1)
-void TestArray1 (QANCollection_Array1Func& theA1)
-{
- // Bounds
- Standard_Integer iLow=theA1.Lower();
- Standard_Integer iUpp=theA1.Upper();
- Standard_Integer i;
-
- printf ("Info: testing Array1(%d,%d), %s\n",
- iLow, iUpp, (theA1.IsDeletable()?"deletable":"frozen"));
- // C-array constructor, Length, Init
- ItemType anItem;
- Random(anItem);
- theA1.Init (anItem);
- ItemType * rBlock = new ItemType[theA1.Length()];
- ////////////////////////////////QANCollection_Array1 aCArr(*rBlock, iLow-100, iUpp-100);
- QANCollection_Array1Func aCArr(*rBlock, iLow-100, iUpp-100);
- printf (" created the same sized preallocated array (%d,%d), %s\n",
- aCArr.Lower(),aCArr.Upper(),(aCArr.IsDeletable()?"deletable":"frozen"));
- // *Value, operator()
- for (i=iLow+1; i<iUpp; i++)
- {
- Random (aCArr.ChangeValue (i-101));
- aCArr.SetValue (i-100, ItemType(aCArr.Value(i-101)));
- aCArr(i-99) = aCArr(i-100) = aCArr(i-101);
- }
- // Handle, copy constructor (including operator=)
- ////////////////////////////////Handle(QANCollection_HArray1) aHa = new QANCollection_HArray1(aCArr);
- Handle(QANCollection_HArray1Func) aHa = new QANCollection_HArray1Func(aCArr);
- // Assign
- AssignCollection (aHa->ChangeArray1(), theA1);
-}
-
-// ===================== Test methods of Array2 type ==========================
-////////////////////////////////void TestArray2 (QANCollection_Array2& theA2)
-void TestArray2 (QANCollection_Array2Func& theA2)
-{
- // Bounds
- Standard_Integer iLR=theA2.LowerRow(), iLC=theA2.LowerCol();
- Standard_Integer iUR=theA2.UpperRow(), iUC=theA2.UpperCol();
- Standard_Integer i,j;
-
- printf ("Info: testing Array2 (%d,%d)(%d,%d), %s\n",
- iLR, iUR, iLC, iUC, (theA2.IsDeletable()?"deletable":"frozen"));
- // C-array constructor, Length, Init, RowLength, ColLength
- ItemType anItem;
- Random(anItem);
- theA2.Init (anItem);
- ItemType * rBlock = new ItemType[theA2.Length()];
- ////////////////////////////////QANCollection_Array2 aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
- QANCollection_Array2Func aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
- printf (" created the same sized preallocated array (%d*%d), %s\n",
- aCArr.RowLength(), aCArr.ColLength(),
- (aCArr.IsDeletable()?"deletable":"frozen"));
- // *Value, operator()
- for (i=iLR+1; i<iUR; i++)
- {
- for (j=iLC; j<=iUC; j++)
- {
- Random (aCArr.ChangeValue (i-101, j));
- aCArr.SetValue (i-100, j,
- ItemType(aCArr.Value(i-101,j)));
- aCArr(i-99,j) = aCArr(i-100,j) = aCArr(i-101,j);
- }
- }
- // Handle, copy constructor (including operator=)
- ////////////////////////////////Handle(QANCollection_HArray2) aHa = new QANCollection_HArray2(aCArr);
- Handle(QANCollection_HArray2Func) aHa = new QANCollection_HArray2Func(aCArr);
- // Assign
- AssignCollection (aHa->ChangeArray2(), theA2);
-}
-
-#endif
+++ /dev/null
-// Created on: 2002-04-30
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_FuncLists_HeaderFile
-#define QANCollection_FuncLists_HeaderFile
-
-// ===================== Test methods of List type ==========================
-////////////////////////////////void TestList (QANCollection_List& theL)
-void TestList (QANCollection_ListFunc& theL)
-{
- // Extent
- Standard_Integer iExt=theL.Extent();
- Standard_Integer i;
-
- printf ("Info: testing List(%d)\n", iExt);
- // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
- // Remove, RemoveFirst, First, Last
- ItemType anItem;
- ////////////////////////////////QANCollection_List aL, aL1;
- QANCollection_ListFunc aL, aL1;
- for (i=0; i<4; i++)
- {
- Random (anItem);
- aL.Append (anItem); // #1
- aL.Append (aL1); // #2
- Random (anItem);
- aL1.Prepend (anItem); // #3
- aL1.Prepend (aL); // #4
- ////////////////////////////////QANCollection_List::Iterator anI(theL);
- QANCollection_ListFunc::Iterator anI(theL);
- if (anI.More())
- {
- Random (anItem);
- theL.InsertBefore (anItem, anI); // #5
- theL.InsertBefore (aL1, anI); // #6
- Random (anItem);
- theL.InsertAfter (anItem, anI); // #7
- theL.InsertAfter (aL, anI); // #8
- theL.Remove (anI); // #9
- if (theL.Extent() > 0)
- theL.RemoveFirst(); // #10
- }
- else
- {
- theL.Prepend (anItem);
- PrintItem(theL.First());
- PrintItem(theL.Last());
- }
- }
- // Copy constructor + operator=
- ////////////////////////////////aL = QANCollection_List(theL);
- aL = QANCollection_ListFunc(theL);
-
- // Assign
- AssignCollection (theL, aL);
-
- // Clear
- aL.Clear();
-}
-
-// ===================== Test methods of Sequence type ========================
-////////////////////////////////void TestSequence (QANCollection_Sequence& theS)
-void TestSequence (QANCollection_SequenceFunc& theS)
-{
- Standard_Integer i;
-
- printf ("Info: testing Sequence\n");
- // Append(2)
- ItemType anItem;
- ////////////////////////////////QANCollection_Sequence aS, aS1;
- QANCollection_SequenceFunc aS, aS1;
- // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
- // Remove, RemoveFirst, First, Last
- for (i=0; i<4; i++)
- {
- Random (anItem);
- aS.Append (anItem); // #1
- aS.Append (aS1); // #2
- Random (anItem);
- aS1.Prepend (anItem); // #3
- aS1.Prepend (aS); // #4
- if (theS.Length() > 0)
- {
- Random (anItem);
- theS.InsertBefore (1, anItem); // #5
- theS.InsertBefore (2, aS1); // #6
- Random (anItem);
- theS.InsertAfter (1, anItem); // #7
- theS.InsertAfter (2, aS); // #8
- theS.Remove (1); // #9
- if (theS.Length() > 0)
- theS.Remove(1); // #10
- }
- else
- {
- theS.Prepend (anItem);
- PrintItem(theS.First());
- PrintItem(theS.Last());
- }
- }
-
- // ()
- PrintItem(theS(1));
-
- // Handle, Split
- ////////////////////////////////Handle(QANCollection_HSequence) aHS = new QANCollection_HSequence(aS1);
- Handle(QANCollection_HSequenceFunc) aHS = new QANCollection_HSequenceFunc(aS1);
- theS.Split (3, aHS->ChangeSequence());
-
- // Assign
- AssignCollection (theS, aS);
-
- // Clear
- aS.Clear();
-}
-
-#endif
+++ /dev/null
-// Created on: 2002-04-30
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_FuncMaps_HeaderFile
-#define QANCollection_FuncMaps_HeaderFile
-
-// ===================== Test methods of Map type =============================
-////////////////////////////////void TestMap (QANCollection_Map& theM)
-void TestMap (QANCollection_MapFunc& theM)
-{
- // Extent
- Standard_Integer iExt=theM.Extent();
- Standard_Integer i;
-
- printf ("Info: testing Map(l=%d)\n", iExt);
- theM.Statistics(cout);
- // Resize
- theM.ReSize(8);
- theM.Statistics(cout);
- cout.flush();
- // Constructor
- ////////////////////////////////QANCollection_Map aM;
- QANCollection_MapFunc aM;
- // Add
- Key1Type aKey;
- for (i=0; i<8; i++)
- {
- Random (aKey);
- aM.Add (aKey);
- }
- // Contains, Remove
- if (!aM.Contains(aKey))
- {
- printf("Error : map says that it does not contain its key ");
- PrintItem(aKey);
- }
- else
- {
- aM.Remove(aKey);
- printf(" successfully removed item, l=%d\n", aM.Size());
- }
- // Copy constructor (including operator=)
- ////////////////////////////////QANCollection_Map aM2 = QANCollection_Map(aM);
- QANCollection_MapFunc aM2 = QANCollection_MapFunc(aM);
- // Assign
- AssignCollection (aM2,theM);
-
- // Clear
- aM.Clear();
-}
-
-// ===================== Test methods of DataMap type =========================
-////////////////////////////////void TestDataMap (QANCollection_DataMap& theM)
-void TestDataMap (QANCollection_DataMapFunc& theM)
-{
- // Extent
- Standard_Integer iExt=theM.Extent();
- Standard_Integer i;
-
- printf ("Info: testing DataMap(l=%d)\n", iExt);
- theM.Statistics(cout);
- // Resize
- theM.ReSize(8);
- theM.Statistics(cout);
- cout.flush();
- // Constructor
- ////////////////////////////////QANCollection_DataMap aM;
- QANCollection_DataMapFunc aM;
- // Bind, Find, ChangeFind, ()
- Key1Type aKey;
- ItemType anItem;
- for (i=0; i<8; i++)
- {
- Random (aKey);
- Random (anItem);
- aM.Bind (aKey, anItem);
- PrintItem(aM.Find(aKey));
- Random(aM(aKey));
- }
- // IsBound, UnBind
- if (!aM.IsBound(aKey))
- {
- printf("Error : map says that it does not contain its key ");
- PrintItem(aKey);
- }
- else
- {
- aM.UnBind(aKey);
- printf(" successfully unbound the key, l=%d\n", aM.Size());
- }
- // Copy constructor (including operator=)
- ////////////////////////////////theM = QANCollection_DataMap(aM);
- theM = QANCollection_DataMapFunc(aM);
- // Assign - prohibited
- // AssignCollection (aM2,theM);
- printCollection (theM, "DataMap:");
-
- // Clear
- aM.Clear();
-}
-
-
-// ===================== Test methods of DoubleMap type =======================
-////////////////////////////////void TestDoubleMap (QANCollection_DoubleMap& theM)
-void TestDoubleMap (QANCollection_DoubleMapFunc& theM)
-{
- // Extent
- Standard_Integer iExt=theM.Extent();
- Standard_Integer i;
-
- printf ("Info: testing DoubleMap(l=%d)\n", iExt);
- theM.Statistics(cout);
- // Resize
- theM.ReSize(8);
- theM.Statistics(cout);
- cout.flush();
- // Constructor
- ////////////////////////////////QANCollection_DoubleMap aM;
- QANCollection_DoubleMapFunc aM;
- // Bind, Find?,
- Key1Type aKey1;
- Key2Type aKey2;
- for (i=0; i<8; i++)
- {
- Random (aKey1);
- Random (aKey2);
- aM.Bind (aKey1, aKey2);
- PrintItem(aM.Find1(aKey1));
- if (!aM.IsBound1(aKey1))
- {
- printf("Error : map says that it does not contain its key ");
- PrintItem(aKey1);
- }
- PrintItem(aM.Find2(aKey2));
- if (!aM.IsBound2(aKey2))
- {
- printf("Error : map says that it does not contain its key ");
- PrintItem(aKey2);
- }
- }
- // AreBound, UnBind
- if (!aM.AreBound(aKey1,aKey2))
- {
- printf("Error : map says that it does not contain its keys ");
- PrintItem(aKey1);
- PrintItem(aKey2);
- }
- else
- {
- if (aM.UnBind2(aKey2))
- printf(" successfully unbound the key, l=%d\n", aM.Size());
- if (aM.UnBind1(aKey1))
- printf("Error : unbound both keys?!\n");
- }
- // Copy constructor (including operator=)
- ////////////////////////////////theM = QANCollection_DoubleMap(aM);
- theM = QANCollection_DoubleMapFunc(aM);
- // Assign - prohibited
- // AssignCollection (aM2,theM);
- printCollection (theM, "DoubleMap:");
-
- // Clear
- aM.Clear();
-}
-
-// ===================== Test methods of IndexedMap type ======================
-////////////////////////////////void TestIndexedMap (QANCollection_IndexedMap& theM)
-void TestIndexedMap (QANCollection_IndexedMapFunc& theM)
-{
- // Extent
- Standard_Integer iExt=theM.Extent();
- Standard_Integer i;
-
- printf ("Info: testing IndexedMap(l=%d)\n", iExt);
- theM.Statistics(cout);
- // Resize
- theM.ReSize(8);
- theM.Statistics(cout);
- cout.flush();
- // Constructor
- ////////////////////////////////QANCollection_IndexedMap aM;
- QANCollection_IndexedMapFunc aM;
- // Add, FindKey, FindIndex
- Key1Type aKey;
- for (i=0; i<8; i++)
- {
- Random (aKey);
- aM.Add (aKey);
- Standard_Integer iIndex=aM.FindIndex(aKey);
- printf (" added a key, i=%d, k=",iIndex);
- PrintItem(aM(iIndex));
- }
- // Contains, Remove
- if (!aM.Contains(aM.FindKey(aM.FindIndex(aKey))))
- {
- printf("Error : map says that it does not contain its key ");
- PrintItem(aKey);
- }
- else
- {
- aM.RemoveLast();
- printf(" successfully removed item, l=%d\n", aM.Size());
- }
- // Substitute
- Random(aKey);
- aM.Substitute(1,aKey);
- // Copy constructor (including operator=)
- ////////////////////////////////QANCollection_IndexedMap aM2 = QANCollection_IndexedMap(aM);
- QANCollection_IndexedMapFunc aM2 = QANCollection_IndexedMapFunc(aM);
- // Assign
- AssignCollection (aM2,theM);
-
- // Clear
- aM.Clear();
-}
-
-// ===================== Test methods of IndexedDataMap type ==================
-////////////////////////////////void TestIndexedDataMap (QANCollection_IDMap& theM)
-void TestIndexedDataMap (QANCollection_IDMapFunc& theM)
-{
- // Extent
- Standard_Integer iExt=theM.Extent();
- Standard_Integer i;
-
- printf ("Info: testing IndexedDataMap(l=%d)\n", iExt);
- theM.Statistics(cout);
- // Resize
- theM.ReSize(8);
- theM.Statistics(cout);
- cout.flush();
- // Constructor
- ////////////////////////////////QANCollection_IDMap aM;
- QANCollection_IDMapFunc aM;
- // Add, FindKey, FindIndex, FindFromIndex, Change..., ()
- Key1Type aKey;
- ItemType anItem;
- for (i=0; i<8; i++)
- {
- Random (aKey);
- Random (anItem);
- aM.Add (aKey, anItem);
- Standard_Integer iIndex=aM.FindIndex(aKey);
- printf (" added a key, i=%d, k=",iIndex);
- PrintItem(aM.FindKey(iIndex));
- PrintItem(aM(iIndex));
- Random(aM.ChangeFromIndex(iIndex));
- }
- // Contains, Remove, FindFromKey
- if (!aM.Contains(aM.FindKey(aM.FindIndex(aKey))))
- {
- printf("Error : map says that it does not contain its key ");
- PrintItem(aKey);
- }
- else
- {
- anItem = aM.FindFromKey(aKey);
- aM.RemoveLast();
- printf(" successfully removed item, l=%d\n", aM.Size());
- }
- // Substitute
- Random(aKey);
- aM.Substitute (1, aKey, anItem);
- // Copy constructor (including operator=)
- ////////////////////////////////theM = QANCollection_IDMap(aM);
- theM = QANCollection_IDMapFunc(aM);
- // Assign - prohibited
- // AssignCollection (aM2,theM);
- printCollection (theM, "DoubleMap:");
-
- // Clear
- aM.Clear();
-}
-
-
-#endif
+++ /dev/null
-// Created on: 2002-04-30
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// Purpose: To test all methods of all NCollection classes
-
-#ifndef QANCollection_FuncTest_HeaderFile
-#define QANCollection_FuncTest_HeaderFile
-
-#include <QANCollection_Common2.hxx>
-
-// ===================== Test methods for each type ===========================
-// Parameters of funcs below must be empty collections
-
-// Standard_EXPORT void TestArray1 (QANCollection_Array1& theA1);
-// Standard_EXPORT void TestArray2 (QANCollection_Array2& theA2);
-#include <QANCollection_FuncArrays.hxx>
-// Standard_EXPORT void TestMap (QANCollection_Map& theM );
-// Standard_EXPORT void TestDataMap (QANCollection_DataMap& theDM);
-// Standard_EXPORT void TestDblMap (QANCollection_DoubleMap& theBM);
-// Standard_EXPORT void TestIndyMap (QANCollection_IndexedMap& theIM);
-// Standard_EXPORT void TestInDaMap (QANCollection_IDMap& theNM);
-// Standard_EXPORT void TestInDaMap (QANCollection_IDMap& theNM);
-#include <QANCollection_FuncMaps.hxx>
-// Standard_EXPORT void TestList (QANCollection_List& theLi);
-// Standard_EXPORT void TestSequence(QANCollection_Sequence& theSq);
-#include <QANCollection_FuncLists.hxx>
-
-#endif
--- /dev/null
+// Created on: 2004-03-05
+// Created by: Mikhail KUZMITCHEV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <QANCollection.hxx>
+#include <QANCollection_Common.hxx>
+
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array2OfPnt.hxx>
+#include <TColStd_MapOfReal.hxx>
+#include <TColStd_IndexedMapOfReal.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+
+#include <QANCollection_DataMapOfRealPnt.hxx>
+#include <QANCollection_DoubleMapOfRealInteger.hxx>
+#include <QANCollection_IndexedDataMapOfRealPnt.hxx>
+#include <QANCollection_ListOfPnt.hxx>
+
+#include <NCollection_SparseArray.hxx>
+#include <NCollection_SparseArrayBase.hxx>
+
+#define PERF_ENABLE_METERS
+#include <OSD_PerfMeter.hxx>
+
+#define ItemType gp_Pnt
+#define Key1Type Standard_Real
+#define Key2Type Standard_Integer
+
+// ===================== INSTANTIATIONS ===========
+// ===================== The Types must be defined before this line ===========
+// These are: TheItemType, TheKey1Type, TheKey2Type
+// So must be defined ::HashCode and ::IsEqual too
+
+#include <NCollection_DefineArray1.hxx>
+#include <NCollection_DefineHArray1.hxx>
+////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
+////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
+DEFINE_ARRAY1(QANCollection_Array1Perf,QANCollection_BaseColPerf,ItemType)
+DEFINE_HARRAY1(QANCollection_HArray1Perf,QANCollection_Array1Perf)
+IMPLEMENT_HARRAY1(QANCollection_HArray1Perf)
+
+#include <NCollection_DefineArray2.hxx>
+#include <NCollection_DefineHArray2.hxx>
+////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
+////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
+DEFINE_ARRAY2(QANCollection_Array2Perf,QANCollection_BaseColPerf,ItemType)
+DEFINE_HARRAY2(QANCollection_HArray2Perf,QANCollection_Array2Perf)
+IMPLEMENT_HARRAY2(QANCollection_HArray2Perf)
+
+#include <NCollection_DefineMap.hxx>
+#include <NCollection_DefineDataMap.hxx>
+#include <NCollection_DefineDoubleMap.hxx>
+#include <NCollection_DefineIndexedMap.hxx>
+#include <NCollection_DefineIndexedDataMap.hxx>
+////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
+////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
+////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
+////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
+////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
+DEFINE_MAP(QANCollection_MapPerf,QANCollection_Key1BaseColPerf,Key1Type)
+DEFINE_DATAMAP(QANCollection_DataMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
+DEFINE_DOUBLEMAP(QANCollection_DoubleMapPerf,QANCollection_Key2BaseColPerf,Key1Type,Key2Type)
+DEFINE_INDEXEDMAP(QANCollection_IndexedMapPerf,QANCollection_Key1BaseColPerf,Key1Type)
+DEFINE_INDEXEDDATAMAP(QANCollection_IDMapPerf,QANCollection_BaseColPerf,Key1Type,ItemType)
+
+#include <NCollection_DefineList.hxx>
+////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
+DEFINE_LIST(QANCollection_ListPerf,QANCollection_BaseColPerf,ItemType)
+
+#include <NCollection_DefineSequence.hxx>
+#include <NCollection_DefineHSequence.hxx>
+////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
+////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
+DEFINE_SEQUENCE(QANCollection_SequencePerf,QANCollection_BaseColPerf,ItemType)
+DEFINE_HSEQUENCE(QANCollection_HSequencePerf,QANCollection_SequencePerf)
+IMPLEMENT_HSEQUENCE(QANCollection_HSequencePerf)
+
+// ===================== Test perform of Array1 type ==========================
+static void CompArray1 (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array1 creation",0);
+ ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array1 creation",0);
+ ////////////////////////////////Perf_Meter aNFill ("NCollection_Array1 filling",0);
+ ////////////////////////////////Perf_Meter aTFill ("TCollection_Array1 filling",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_Array1 finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_Array1 finding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_Array1 operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_Array1 operator=",0);
+ ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array1 Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////aNCrea.Start();
+ PERF_START_METER("NCollection_Array1 creation")
+ ////////////////////////////////QANCollection_Array1 a1(1,theSize), a2(1,theSize);
+ QANCollection_Array1Perf a1(1,theSize), a2(1,theSize);
+ ////////////////////////////////aNCrea.Stop();
+ PERF_STOP_METER("NCollection_Array1 creation")
+ ////////////////////////////////aNFill.Start();
+ PERF_START_METER("NCollection_Array1 filling")
+ for (j=1; j<=theSize; j++)
+ Random(a1(j));
+ ////////////////////////////////aNFill.Stop();
+ PERF_STOP_METER("NCollection_Array1 filling")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_Array1 finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a1.Value(iIndex+1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_Array1 finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_Array1 operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_Array1 operator=")
+ ////////////////////////////////aNAssi.Start();
+ PERF_START_METER("NCollection_Array1 Assign")
+ a2.Assign(a1);
+ ////////////////////////////////aNAssi.Stop();
+ PERF_STOP_METER("NCollection_Array1 Assign")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////aTCrea.Start();
+ PERF_START_METER("TCollection_Array1 creation")
+ TColgp_Array1OfPnt a1(1,theSize), a2(1,theSize);
+ ////////////////////////////////aTCrea.Stop();
+ PERF_STOP_METER("TCollection_Array1 creation")
+ ////////////////////////////////aTFill.Start();
+ PERF_START_METER("TCollection_Array1 filling")
+ for (j=1; j<=theSize; j++)
+ Random(a1(j));
+ ////////////////////////////////aTFill.Stop();
+ PERF_STOP_METER("TCollection_Array1 filling")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_Array1 finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a1.Value(iIndex+1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_Array1 finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_Array1 operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_Array1 operator=")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of Array2 type ==========================
+static void CompArray2 (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j,k;
+
+ ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array2 creation",0);
+ ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array2 creation",0);
+ ////////////////////////////////Perf_Meter aNFill ("NCollection_Array2 filling",0);
+ ////////////////////////////////Perf_Meter aTFill ("TCollection_Array2 filling",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_Array2 finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_Array2 finding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_Array2 operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_Array2 operator=",0);
+ ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array2 Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////aNCrea.Start();
+ PERF_START_METER("NCollection_Array2 creation")
+ ////////////////////////////////QANCollection_Array2 a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
+ QANCollection_Array2Perf a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
+ ////////////////////////////////aNCrea.Stop();
+ PERF_STOP_METER("NCollection_Array2 creation")
+ ////////////////////////////////aNFill.Start();
+ PERF_START_METER("NCollection_Array2 filling")
+ for (j=1; j<=theSize; j++)
+ for (k=1; k<=theSize; k++)
+ Random(a1(j,k));
+ ////////////////////////////////aNFill.Stop();
+ PERF_STOP_METER("NCollection_Array2 filling")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_Array2 finding")
+ for (j=1; j<=theSize*theSize; j++)
+ {
+ Standard_Integer m,n;
+ Random(m,theSize);
+ Random(n,theSize);
+ a1.Value(m+1,n+1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_Array2 finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_Array2 operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_Array2 operator=")
+ ////////////////////////////////aNAssi.Start();
+ PERF_START_METER("NCollection_Array2 Assign")
+ a2.Assign(a1);
+ ////////////////////////////////aNAssi.Stop();
+ PERF_STOP_METER("NCollection_Array2 Assign")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////aTCrea.Start();
+ PERF_START_METER("TCollection_Array2 creation")
+ TColgp_Array2OfPnt a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
+ ////////////////////////////////aTCrea.Stop();
+ PERF_STOP_METER("TCollection_Array2 creation")
+ ////////////////////////////////aTFill.Start();
+ PERF_START_METER("TCollection_Array2 filling")
+ for (j=1; j<=theSize; j++)
+ for (k=1; k<=theSize; k++)
+ Random(a1(j,k));
+ ////////////////////////////////aTFill.Stop();
+ PERF_STOP_METER("TCollection_Array2 filling")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_Array2 finding")
+ for (j=1; j<=theSize*theSize; j++)
+ {
+ Standard_Integer m,n;
+ Random(m,theSize);
+ Random(n,theSize);
+ a1.Value(m+1,n+1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_Array2 finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_Array2 operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_Array2 operator=")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of List type ==========================
+static void CompList (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNAppe ("NCollection_List appending",0);
+ ////////////////////////////////Perf_Meter aTAppe ("TCollection_List appending",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_List operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_List operator=",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_List clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_List clearing",0);
+ ////////////////////////////////Perf_Meter aNAssi ("NCollection_List Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_List a1, a2;
+ QANCollection_ListPerf a1, a2;
+ ////////////////////////////////aNAppe.Start();
+ PERF_START_METER("NCollection_List appending")
+ for (j=1; j<=theSize; j++)
+ {
+ ItemType anItem;
+ Random(anItem);
+ a1.Append(anItem);
+ }
+ ////////////////////////////////aNAppe.Stop();
+ PERF_STOP_METER("NCollection_List appending")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_List operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_List operator=")
+ ////////////////////////////////aNAssi.Start();
+ PERF_START_METER("NCollection_List Assign")
+ a2.Assign(a1);
+ ////////////////////////////////aNAssi.Stop();
+ PERF_STOP_METER("NCollection_List Assign")
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_List clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_List clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ QANCollection_ListOfPnt a1, a2;
+ ////////////////////////////////aTAppe.Start();
+ PERF_START_METER("TCollection_List appending")
+ for (j=1; j<=theSize; j++)
+ {
+ ItemType anItem;
+ Random(anItem);
+ a1.Append(anItem);
+ }
+ ////////////////////////////////aTAppe.Stop();
+ PERF_STOP_METER("TCollection_List appending")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_List operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_List operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_List clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_List clearing")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of Sequence type ==========================
+static void CompSequence (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNAppe ("NCollection_Sequence appending",0);
+ ////////////////////////////////Perf_Meter aTAppe ("TCollection_Sequence appending",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_Sequence finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_Sequence finding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_Sequence operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_Sequence operator=",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_Sequence clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_Sequence clearing",0);
+ ////////////////////////////////Perf_Meter aNAssi ("NCollection_Sequence Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_Sequence a1, a2;
+ QANCollection_SequencePerf a1, a2;
+ ////////////////////////////////aNAppe.Start();
+ PERF_START_METER("NCollection_Sequence appending")
+ for (j=1; j<=theSize; j++)
+ {
+ ItemType anItem;
+ Random(anItem);
+ a1.Append(anItem);
+ }
+ ////////////////////////////////aNAppe.Stop();
+ PERF_STOP_METER("NCollection_Sequence appending")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_Sequence finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a1.Value(iIndex+1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_Sequence finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_Sequence operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_Sequence operator=")
+ ////////////////////////////////aNAssi.Start();
+ PERF_START_METER("NCollection_Sequence Assign")
+ a2.Assign(a1);
+ ////////////////////////////////aNAssi.Stop();
+ PERF_STOP_METER("NCollection_Sequence Assign")
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_Sequence clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_Sequence clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ TColgp_SequenceOfPnt a1, a2;
+ ////////////////////////////////aTAppe.Start();
+ PERF_START_METER("TCollection_Sequence appending")
+ for (j=1; j<=theSize; j++)
+ {
+ ItemType anItem;
+ Random(anItem);
+ a1.Append(anItem);
+ }
+ ////////////////////////////////aTAppe.Stop();
+ PERF_STOP_METER("TCollection_Sequence appending")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_Sequence finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a1.Value(iIndex+1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_Sequence finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_Sequence operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_Sequence operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_Sequence clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_Sequence clearing")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of Map type ==========================
+static void CompMap (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNBind ("NCollection_Map adding",0);
+ ////////////////////////////////Perf_Meter aTBind ("TCollection_Map adding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_Map operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_Map operator=",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_Map finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_Map finding",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_Map clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_Map clearing",0);
+ ////////////////////////////////Perf_Meter aNAssi ("NCollection_Map Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_Map a1, a2;
+ QANCollection_MapPerf a1, a2;
+ ////////////////////////////////aNBind.Start();
+ PERF_START_METER("NCollection_Map adding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Add(aKey1);
+ }
+ ////////////////////////////////aNBind.Stop();
+ PERF_STOP_METER("NCollection_Map adding")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_Map finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Contains(aKey1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_Map finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_Map operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_Map operator=")
+ ////////////////////////////////aNAssi.Start();
+ PERF_START_METER("NCollection_Map Assign")
+ a2.Assign(a1);
+ ////////////////////////////////aNAssi.Stop();
+ PERF_STOP_METER("NCollection_Map Assign")
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_Map clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_Map clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ TColStd_MapOfReal a1, a2;
+ ////////////////////////////////aTBind.Start();
+ PERF_START_METER("TCollection_Map adding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Add(aKey1);
+ }
+ ////////////////////////////////aTBind.Stop();
+ PERF_STOP_METER("TCollection_Map adding")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_Map finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Contains(aKey1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_Map finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_Map operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_Map operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_Map clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_Map clearing")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of DataMap type ==========================
+static void CompDataMap (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNBind ("NCollection_DataMap binding",0);
+ ////////////////////////////////Perf_Meter aTBind ("TCollection_DataMap binding",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_DataMap finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_DataMap finding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_DataMap operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_DataMap operator=",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_DataMap clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_DataMap clearing",0);
+ //////////////////////////////////Perf_Meter aNAssi ("NCollection_DataMap Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_DataMap a1, a2;
+ QANCollection_DataMapPerf a1, a2;
+ ////////////////////////////////aNBind.Start();
+ PERF_START_METER("NCollection_DataMap binding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ ItemType anItem;
+ Random(aKey1);
+ Random(anItem);
+ a1.Bind(aKey1,anItem);
+ }
+ ////////////////////////////////aNBind.Stop();
+ PERF_STOP_METER("NCollection_DataMap binding")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_DataMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.IsBound(aKey1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_DataMap finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_DataMap operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_DataMap operator=")
+ //aNAssi.Start();
+ //a2.Assign(a1);
+ //aNAssi.Stop();
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_DataMap clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_DataMap clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ QANCollection_DataMapOfRealPnt a1, a2;
+ ////////////////////////////////aTBind.Start();
+ PERF_START_METER("TCollection_DataMap binding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ ItemType anItem;
+ Random(aKey1);
+ Random(anItem);
+ a1.Bind(aKey1,anItem);
+ }
+ ////////////////////////////////aTBind.Stop();
+ PERF_STOP_METER("TCollection_DataMap binding")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_DataMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.IsBound(aKey1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_DataMap finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_DataMap operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_DataMap operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_DataMap clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_DataMap clearing")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of DoubleMap type ==========================
+static void CompDoubleMap (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+ Standard_Integer iFail1=0, iFail2=0;
+
+ ////////////////////////////////Perf_Meter aNBind ("NCollection_DoubleMap binding",0);
+ ////////////////////////////////Perf_Meter aTBind ("TCollection_DoubleMap binding",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_DoubleMap finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_DoubleMap finding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_DoubleMap operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_DoubleMap operator=",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_DoubleMap clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_DoubleMap clearing",0);
+ //////////////////////////////////Perf_Meter aNAssi ("NCollection_DoubleMap Assign",0);
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_DoubleMap a1, a2;
+ QANCollection_DoubleMapPerf a1, a2;
+ ////////////////////////////////aNBind.Start();
+ PERF_START_METER("NCollection_DoubleMap binding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Key2Type aKey2;
+ do {
+ Random(aKey1);
+ Random(aKey2);
+ iFail1++;
+ }
+ while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
+ iFail1--;
+ a1.Bind(aKey1,aKey2);
+ }
+ ////////////////////////////////aNBind.Stop();
+ PERF_STOP_METER("NCollection_DoubleMap binding")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_DoubleMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Key2Type aKey2;
+ Random(aKey1);
+ Random(aKey2);
+ a1.AreBound(aKey1,aKey2);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_DoubleMap finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_DoubleMap operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_DoubleMap operator=")
+ //aNAssi.Start();
+ //a2.Assign(a1);
+ //aNAssi.Stop();
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_DoubleMap clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_DoubleMap clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ QANCollection_DoubleMapOfRealInteger a1, a2;
+ ////////////////////////////////aTBind.Start();
+ PERF_START_METER("TCollection_DoubleMap binding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Key2Type aKey2;
+ do {
+ Random(aKey1);
+ Random(aKey2);
+ iFail2++;
+ }
+ while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
+ iFail2--;
+ a1.Bind(aKey1,aKey2);
+ }
+ ////////////////////////////////aTBind.Stop();
+ PERF_STOP_METER("TCollection_DoubleMap binding")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_DoubleMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Key2Type aKey2;
+ Random(aKey1);
+ Random(aKey2);
+ a1.AreBound(aKey1,aKey2);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_DoubleMap finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_DoubleMap operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_DoubleMap operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_DoubleMap clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_DoubleMap clearing")
+ }
+ PERF_PRINT_ALL
+ if (iFail1 || iFail2)
+ cout << "Warning : N map failed " << iFail1 << " times, T map - " <<
+ iFail2 << endl;
+}
+
+// ===================== Test perform of IndexedMap type ==========================
+static void CompIndexedMap (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedMap adding",0);
+ ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedMap adding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedMap operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedMap operator=",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedMap finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedMap finding",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedMap clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedMap clearing",0);
+ ////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedMap Assign",0);
+
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_IndexedMap a1, a2;
+ QANCollection_IndexedMapPerf a1, a2;
+ ////////////////////////////////aNBind.Start();
+ PERF_START_METER("NCollection_IndexedMap adding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Add(aKey1);
+ }
+ ////////////////////////////////aNBind.Stop();
+ PERF_STOP_METER("NCollection_IndexedMap adding")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_IndexedMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Contains(aKey1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_IndexedMap finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_IndexedMap operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_IndexedMap operator=")
+ ////////////////////////////////aNAssi.Start();
+ PERF_START_METER("NCollection_IndexedMap Assign")
+ a2.Assign(a1);
+ ////////////////////////////////aNAssi.Stop();
+ PERF_STOP_METER("NCollection_IndexedMap Assign")
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_IndexedMap clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_IndexedMap clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ TColStd_IndexedMapOfReal a1, a2;
+ ////////////////////////////////aTBind.Start();
+ PERF_START_METER("TCollection_IndexedMap adding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Add(aKey1);
+ }
+ ////////////////////////////////aTBind.Stop();
+ PERF_STOP_METER("TCollection_IndexedMap adding")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_IndexedMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Contains(aKey1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_IndexedMap finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_IndexedMap operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_IndexedMap operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_IndexedMap clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_IndexedMap clearing")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of IndexedDataMap type ==========================
+static void CompIndexedDataMap (const Standard_Integer theRep,
+ const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+
+ ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedDataMap binding",0);
+ ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedDataMap binding",0);
+ ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedDataMap finding",0);
+ ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedDataMap finding",0);
+ ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedDataMap operator=",0);
+ ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedDataMap operator=",0);
+ ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedDataMap clearing",0);
+ ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedDataMap clearing",0);
+ //////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedDataMap Assign",0);
+
+ for (i=0; i<theRep; i++)
+ {
+ ////////////////////////////////QANCollection_IDMap a1, a2;
+ QANCollection_IDMapPerf a1, a2;
+ ////////////////////////////////aNBind.Start();
+ PERF_START_METER("NCollection_IndexedDataMap binding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ ItemType anItem;
+ Random(aKey1);
+ Random(anItem);
+ a1.Add(aKey1,anItem);
+ }
+ ////////////////////////////////aNBind.Stop();
+ PERF_STOP_METER("NCollection_IndexedDataMap binding")
+ ////////////////////////////////aNFind.Start();
+ PERF_START_METER("NCollection_IndexedDataMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Contains(aKey1);
+ }
+ ////////////////////////////////aNFind.Stop();
+ PERF_STOP_METER("NCollection_IndexedDataMap finding")
+ ////////////////////////////////aNOper.Start();
+ PERF_START_METER("NCollection_IndexedDataMap operator=")
+ a2 = a1;
+ ////////////////////////////////aNOper.Stop();
+ PERF_STOP_METER("NCollection_IndexedDataMap operator=")
+ //aNAssi.Start();
+ //a2.Assign(a1);
+ //aNAssi.Stop();
+ ////////////////////////////////aNClea.Start();
+ PERF_START_METER("NCollection_IndexedDataMap clearing")
+ a2.Clear();
+ ////////////////////////////////aNClea.Stop();
+ PERF_STOP_METER("NCollection_IndexedDataMap clearing")
+ }
+
+ for (i=0; i<theRep; i++)
+ {
+ QANCollection_IndexedDataMapOfRealPnt a1, a2;
+ ////////////////////////////////aTBind.Start();
+ PERF_START_METER("TCollection_IndexedDataMap binding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ ItemType anItem;
+ Random(aKey1);
+ Random(anItem);
+ a1.Add(aKey1,anItem);
+ }
+ ////////////////////////////////aTBind.Stop();
+ PERF_STOP_METER("TCollection_IndexedDataMap binding")
+ ////////////////////////////////aTFind.Start();
+ PERF_START_METER("TCollection_IndexedDataMap finding")
+ for (j=1; j<=theSize; j++)
+ {
+ Key1Type aKey1;
+ Random(aKey1);
+ a1.Contains(aKey1);
+ }
+ ////////////////////////////////aTFind.Stop();
+ PERF_STOP_METER("TCollection_IndexedDataMap finding")
+ ////////////////////////////////aTOper.Start();
+ PERF_START_METER("TCollection_IndexedDataMap operator=")
+ a2 = a1;
+ ////////////////////////////////aTOper.Stop();
+ PERF_STOP_METER("TCollection_IndexedDataMap operator=")
+ ////////////////////////////////aTClea.Start();
+ PERF_START_METER("TCollection_IndexedDataMap clearing")
+ a2.Clear();
+ ////////////////////////////////aTClea.Stop();
+ PERF_STOP_METER("TCollection_IndexedDataMap clearing")
+ }
+ PERF_PRINT_ALL
+}
+
+// ===================== Test perform of SparseArray type ==========================
+static void CompSparseArray (const Standard_Integer theRep, const Standard_Integer theSize)
+{
+ Standard_Integer i,j;
+ for (i=0; i<theRep; i++)
+ {
+ PERF_START_METER("NCollection_SparseArray creation")
+
+ NCollection_SparseArray<Standard_Integer> a1(theSize),a2(theSize);
+
+ PERF_STOP_METER("NCollection_SparseArray creation")
+
+ PERF_START_METER("NCollection_SparseArray filling")
+ for( j=0;j<theSize;j++ )
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a1.SetValue(j,iIndex+1);
+ }
+
+ PERF_STOP_METER("NCollection_SparseArray filling")
+
+ PERF_START_METER("NCollection_SparseArray size")
+ Standard_Size sizeSparseArray=a1.Size();
+ (void)sizeSparseArray; // avoid compiler warning on unused variable
+ PERF_STOP_METER("NCollection_SparseArray size")
+
+ PERF_START_METER("NCollection_Array1 Assign")
+ a2.Assign(a1);
+ PERF_STOP_METER("NCollection_Array1 Assign")
+ PERF_START_METER("NCollection_SparseArray HasValue")
+ for (j=0; j<theSize; j++)
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a2.HasValue(iIndex+1);
+ }
+ PERF_STOP_METER("NCollection_SparseArray HasValue")
+ PERF_START_METER("NCollection_SparseArray UnsetValue")
+ for (j=0; j<theSize; j++)
+ {
+ Standard_Integer iIndex;
+ Random(iIndex,theSize);
+ a1.UnsetValue(iIndex+1);
+ }
+ PERF_STOP_METER("NCollection_SparseArray UnsetValue")
+
+ PERF_START_METER("NCollection_SparseArray Clear")
+ a1.Clear();
+ a2.Clear();
+ PERF_STOP_METER("NCollection_SparseArray Clear")
+
+ }
+
+ PERF_PRINT_ALL
+}
+
+//=======================================================================
+//function : CheckArguments
+//purpose :
+//=======================================================================
+Standard_Integer CheckArguments(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Repeat, Standard_Integer& Size)
+{
+ if ( argc != 3) {
+ di << "Usage : " << argv[0] << " Repeat Size" << "\n";
+ return 1;
+ }
+ Repeat = Draw::Atoi(argv[1]);
+ Size = Draw::Atoi(argv[2]);
+ if ( Repeat < 1 ) {
+ di << "Repeat > 0" << "\n";
+ return 1;
+ }
+ if ( Size < 1 ) {
+ di << "Size > 0" << "\n";
+ return 1;
+ }
+ return 0;
+}
+
+
+//=======================================================================
+//function : QANColPerfArray1
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompArray1(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfArray2
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompArray2(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfList
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompList(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfSequence
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompSequence(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompMap(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfDataMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompDataMap(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfDoubleMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompDoubleMap(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfIndexedMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompIndexedMap(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColPerfIndexedDataMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColPerfIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompIndexedDataMap(Repeat,Size);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColCheckSparseArray
+//purpose :
+//=======================================================================
+static Standard_Integer QANColCheckSparseArray(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Repeat, Size;
+ if ( CheckArguments(di, argc, argv, Repeat, Size) ) {
+ return 1;
+ }
+ CompSparseArray(Repeat,Size);
+ return 0;
+}
+
+void QANCollection::CommandsPerf(Draw_Interpretor& theCommands) {
+ const char *group = "QANCollection";
+
+ // from agvCollTest/src/CollectionEXE/PerfTestEXE.cxx
+ theCommands.Add("QANColPerfArray1", "QANColPerfArray1 Repeat Size", __FILE__, QANColPerfArray1, group);
+ theCommands.Add("QANColPerfArray2", "QANColPerfArray2 Repeat Size", __FILE__, QANColPerfArray2, group);
+ theCommands.Add("QANColPerfList", "QANColPerfList Repeat Size", __FILE__, QANColPerfList, group);
+ theCommands.Add("QANColPerfSequence", "QANColPerfSequence Repeat Size", __FILE__, QANColPerfSequence, group);
+ theCommands.Add("QANColPerfMap", "QANColPerfMap Repeat Size", __FILE__, QANColPerfMap, group);
+ theCommands.Add("QANColPerfDataMap", "QANColPerfDataMap Repeat Size", __FILE__, QANColPerfDataMap, group);
+ theCommands.Add("QANColPerfDoubleMap", "QANColPerfDoubleMap Repeat Size", __FILE__, QANColPerfDoubleMap, group);
+ theCommands.Add("QANColPerfIndexedMap", "QANColPerfIndexedMap Repeat Size", __FILE__, QANColPerfIndexedMap, group);
+ theCommands.Add("QANColPerfIndexedDataMap", "QANColPerfIndexedDataMap Repeat Size", __FILE__, QANColPerfIndexedDataMap, group);
+
+ theCommands.Add("QANColCheckSparseArray", "QANColCheckSparseArray Repeat Size", __FILE__, QANColCheckSparseArray, group);
+
+ return;
+}
+
+++ /dev/null
-// Created on: 2002-05-15
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_PerfArrays_HeaderFile
-#define QANCollection_PerfArrays_HeaderFile
-
-#define PERF_ENABLE_METERS
-#include <OSD_PerfMeter.hxx>
-////////////////////////////////#include <Perf_Meter.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColgp_Array2OfPnt.hxx>
-
-// ===================== Test perform of Array1 type ==========================
-void CompArray1 (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array1 creation",0);
- ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array1 creation",0);
- ////////////////////////////////Perf_Meter aNFill ("NCollection_Array1 filling",0);
- ////////////////////////////////Perf_Meter aTFill ("TCollection_Array1 filling",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_Array1 finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_Array1 finding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_Array1 operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_Array1 operator=",0);
- ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array1 Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////aNCrea.Start();
- PERF_START_METER("NCollection_Array1 creation")
- ////////////////////////////////QANCollection_Array1 a1(1,theSize), a2(1,theSize);
- QANCollection_Array1Perf a1(1,theSize), a2(1,theSize);
- ////////////////////////////////aNCrea.Stop();
- PERF_STOP_METER("NCollection_Array1 creation")
- ////////////////////////////////aNFill.Start();
- PERF_START_METER("NCollection_Array1 filling")
- for (j=1; j<=theSize; j++)
- Random(a1(j));
- ////////////////////////////////aNFill.Stop();
- PERF_STOP_METER("NCollection_Array1 filling")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_Array1 finding")
- for (j=1; j<=theSize; j++)
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a1.Value(iIndex+1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_Array1 finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_Array1 operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_Array1 operator=")
- ////////////////////////////////aNAssi.Start();
- PERF_START_METER("NCollection_Array1 Assign")
- a2.Assign(a1);
- ////////////////////////////////aNAssi.Stop();
- PERF_STOP_METER("NCollection_Array1 Assign")
- }
-
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////aTCrea.Start();
- PERF_START_METER("TCollection_Array1 creation")
- TColgp_Array1OfPnt a1(1,theSize), a2(1,theSize);
- ////////////////////////////////aTCrea.Stop();
- PERF_STOP_METER("TCollection_Array1 creation")
- ////////////////////////////////aTFill.Start();
- PERF_START_METER("TCollection_Array1 filling")
- for (j=1; j<=theSize; j++)
- Random(a1(j));
- ////////////////////////////////aTFill.Stop();
- PERF_STOP_METER("TCollection_Array1 filling")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_Array1 finding")
- for (j=1; j<=theSize; j++)
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a1.Value(iIndex+1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_Array1 finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_Array1 operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_Array1 operator=")
- }
- PERF_PRINT_ALL
-}
-
-// ===================== Test perform of Array2 type ==========================
-void CompArray2 (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j,k;
-
- ////////////////////////////////Perf_Meter aNCrea ("NCollection_Array2 creation",0);
- ////////////////////////////////Perf_Meter aTCrea ("TCollection_Array2 creation",0);
- ////////////////////////////////Perf_Meter aNFill ("NCollection_Array2 filling",0);
- ////////////////////////////////Perf_Meter aTFill ("TCollection_Array2 filling",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_Array2 finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_Array2 finding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_Array2 operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_Array2 operator=",0);
- ////////////////////////////////Perf_Meter aNAssi ("NCollection_Array2 Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////aNCrea.Start();
- PERF_START_METER("NCollection_Array2 creation")
- ////////////////////////////////QANCollection_Array2 a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
- QANCollection_Array2Perf a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
- ////////////////////////////////aNCrea.Stop();
- PERF_STOP_METER("NCollection_Array2 creation")
- ////////////////////////////////aNFill.Start();
- PERF_START_METER("NCollection_Array2 filling")
- for (j=1; j<=theSize; j++)
- for (k=1; k<=theSize; k++)
- Random(a1(j,k));
- ////////////////////////////////aNFill.Stop();
- PERF_STOP_METER("NCollection_Array2 filling")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_Array2 finding")
- for (j=1; j<=theSize*theSize; j++)
- {
- Standard_Integer m,n;
- Random(m,theSize);
- Random(n,theSize);
- a1.Value(m+1,n+1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_Array2 finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_Array2 operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_Array2 operator=")
- ////////////////////////////////aNAssi.Start();
- PERF_START_METER("NCollection_Array2 Assign")
- a2.Assign(a1);
- ////////////////////////////////aNAssi.Stop();
- PERF_STOP_METER("NCollection_Array2 Assign")
- }
-
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////aTCrea.Start();
- PERF_START_METER("TCollection_Array2 creation")
- TColgp_Array2OfPnt a1(1,theSize,1,theSize), a2(1,theSize,1,theSize);
- ////////////////////////////////aTCrea.Stop();
- PERF_STOP_METER("TCollection_Array2 creation")
- ////////////////////////////////aTFill.Start();
- PERF_START_METER("TCollection_Array2 filling")
- for (j=1; j<=theSize; j++)
- for (k=1; k<=theSize; k++)
- Random(a1(j,k));
- ////////////////////////////////aTFill.Stop();
- PERF_STOP_METER("TCollection_Array2 filling")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_Array2 finding")
- for (j=1; j<=theSize*theSize; j++)
- {
- Standard_Integer m,n;
- Random(m,theSize);
- Random(n,theSize);
- a1.Value(m+1,n+1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_Array2 finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_Array2 operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_Array2 operator=")
- }
- PERF_PRINT_ALL
-}
-
-
-#endif
+++ /dev/null
-// Created on: 2002-04-30
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_PerfLists_HeaderFile
-#define QANCollection_PerfLists_HeaderFile
-
-#include <QANCollection_ListOfPnt.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-
-// ===================== Test perform of List type ==========================
-void CompList (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNAppe ("NCollection_List appending",0);
- ////////////////////////////////Perf_Meter aTAppe ("TCollection_List appending",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_List operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_List operator=",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_List clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_List clearing",0);
- ////////////////////////////////Perf_Meter aNAssi ("NCollection_List Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_List a1, a2;
- QANCollection_ListPerf a1, a2;
- ////////////////////////////////aNAppe.Start();
- PERF_START_METER("NCollection_List appending")
- for (j=1; j<=theSize; j++)
- {
- ItemType anItem;
- Random(anItem);
- a1.Append(anItem);
- }
- ////////////////////////////////aNAppe.Stop();
- PERF_STOP_METER("NCollection_List appending")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_List operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_List operator=")
- ////////////////////////////////aNAssi.Start();
- PERF_START_METER("NCollection_List Assign")
- a2.Assign(a1);
- ////////////////////////////////aNAssi.Stop();
- PERF_STOP_METER("NCollection_List Assign")
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_List clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_List clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- QANCollection_ListOfPnt a1, a2;
- ////////////////////////////////aTAppe.Start();
- PERF_START_METER("TCollection_List appending")
- for (j=1; j<=theSize; j++)
- {
- ItemType anItem;
- Random(anItem);
- a1.Append(anItem);
- }
- ////////////////////////////////aTAppe.Stop();
- PERF_STOP_METER("TCollection_List appending")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_List operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_List operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_List clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_List clearing")
- }
- PERF_PRINT_ALL
-}
-
-
-
-// ===================== Test perform of Sequence type ==========================
-void CompSequence (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNAppe ("NCollection_Sequence appending",0);
- ////////////////////////////////Perf_Meter aTAppe ("TCollection_Sequence appending",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_Sequence finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_Sequence finding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_Sequence operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_Sequence operator=",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_Sequence clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_Sequence clearing",0);
- ////////////////////////////////Perf_Meter aNAssi ("NCollection_Sequence Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_Sequence a1, a2;
- QANCollection_SequencePerf a1, a2;
- ////////////////////////////////aNAppe.Start();
- PERF_START_METER("NCollection_Sequence appending")
- for (j=1; j<=theSize; j++)
- {
- ItemType anItem;
- Random(anItem);
- a1.Append(anItem);
- }
- ////////////////////////////////aNAppe.Stop();
- PERF_STOP_METER("NCollection_Sequence appending")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_Sequence finding")
- for (j=1; j<=theSize; j++)
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a1.Value(iIndex+1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_Sequence finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_Sequence operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_Sequence operator=")
- ////////////////////////////////aNAssi.Start();
- PERF_START_METER("NCollection_Sequence Assign")
- a2.Assign(a1);
- ////////////////////////////////aNAssi.Stop();
- PERF_STOP_METER("NCollection_Sequence Assign")
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_Sequence clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_Sequence clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- TColgp_SequenceOfPnt a1, a2;
- ////////////////////////////////aTAppe.Start();
- PERF_START_METER("TCollection_Sequence appending")
- for (j=1; j<=theSize; j++)
- {
- ItemType anItem;
- Random(anItem);
- a1.Append(anItem);
- }
- ////////////////////////////////aTAppe.Stop();
- PERF_STOP_METER("TCollection_Sequence appending")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_Sequence finding")
- for (j=1; j<=theSize; j++)
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a1.Value(iIndex+1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_Sequence finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_Sequence operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_Sequence operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_Sequence clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_Sequence clearing")
- }
- PERF_PRINT_ALL
-}
-
-#endif
+++ /dev/null
-// Created on: 2002-04-30
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_PerfMaps_HeaderFile
-#define QANCollection_PerfMaps_HeaderFile
-
-#include <TColStd_MapOfReal.hxx>
-#include <TColStd_IndexedMapOfReal.hxx>
-#include <QANCollection_DataMapOfRealPnt.hxx>
-#include <QANCollection_DoubleMapOfRealInteger.hxx>
-#include <QANCollection_IndexedDataMapOfRealPnt.hxx>
-
-// ===================== Test perform of Map type ==========================
-void CompMap (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNBind ("NCollection_Map adding",0);
- ////////////////////////////////Perf_Meter aTBind ("TCollection_Map adding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_Map operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_Map operator=",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_Map finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_Map finding",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_Map clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_Map clearing",0);
- ////////////////////////////////Perf_Meter aNAssi ("NCollection_Map Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_Map a1, a2;
- QANCollection_MapPerf a1, a2;
- ////////////////////////////////aNBind.Start();
- PERF_START_METER("NCollection_Map adding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Add(aKey1);
- }
- ////////////////////////////////aNBind.Stop();
- PERF_STOP_METER("NCollection_Map adding")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_Map finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Contains(aKey1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_Map finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_Map operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_Map operator=")
- ////////////////////////////////aNAssi.Start();
- PERF_START_METER("NCollection_Map Assign")
- a2.Assign(a1);
- ////////////////////////////////aNAssi.Stop();
- PERF_STOP_METER("NCollection_Map Assign")
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_Map clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_Map clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- TColStd_MapOfReal a1, a2;
- ////////////////////////////////aTBind.Start();
- PERF_START_METER("TCollection_Map adding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Add(aKey1);
- }
- ////////////////////////////////aTBind.Stop();
- PERF_STOP_METER("TCollection_Map adding")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_Map finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Contains(aKey1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_Map finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_Map operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_Map operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_Map clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_Map clearing")
- }
- PERF_PRINT_ALL
-}
-
-// ===================== Test perform of DataMap type ==========================
-void CompDataMap (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNBind ("NCollection_DataMap binding",0);
- ////////////////////////////////Perf_Meter aTBind ("TCollection_DataMap binding",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_DataMap finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_DataMap finding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_DataMap operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_DataMap operator=",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_DataMap clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_DataMap clearing",0);
- //////////////////////////////////Perf_Meter aNAssi ("NCollection_DataMap Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_DataMap a1, a2;
- QANCollection_DataMapPerf a1, a2;
- ////////////////////////////////aNBind.Start();
- PERF_START_METER("NCollection_DataMap binding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- ItemType anItem;
- Random(aKey1);
- Random(anItem);
- a1.Bind(aKey1,anItem);
- }
- ////////////////////////////////aNBind.Stop();
- PERF_STOP_METER("NCollection_DataMap binding")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_DataMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.IsBound(aKey1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_DataMap finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_DataMap operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_DataMap operator=")
- //aNAssi.Start();
- //a2.Assign(a1);
- //aNAssi.Stop();
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_DataMap clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_DataMap clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- QANCollection_DataMapOfRealPnt a1, a2;
- ////////////////////////////////aTBind.Start();
- PERF_START_METER("TCollection_DataMap binding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- ItemType anItem;
- Random(aKey1);
- Random(anItem);
- a1.Bind(aKey1,anItem);
- }
- ////////////////////////////////aTBind.Stop();
- PERF_STOP_METER("TCollection_DataMap binding")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_DataMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.IsBound(aKey1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_DataMap finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_DataMap operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_DataMap operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_DataMap clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_DataMap clearing")
- }
- PERF_PRINT_ALL
-}
-
-// ===================== Test perform of DoubleMap type ==========================
-void CompDoubleMap (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
- Standard_Integer iFail1=0, iFail2=0;
-
- ////////////////////////////////Perf_Meter aNBind ("NCollection_DoubleMap binding",0);
- ////////////////////////////////Perf_Meter aTBind ("TCollection_DoubleMap binding",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_DoubleMap finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_DoubleMap finding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_DoubleMap operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_DoubleMap operator=",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_DoubleMap clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_DoubleMap clearing",0);
- //////////////////////////////////Perf_Meter aNAssi ("NCollection_DoubleMap Assign",0);
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_DoubleMap a1, a2;
- QANCollection_DoubleMapPerf a1, a2;
- ////////////////////////////////aNBind.Start();
- PERF_START_METER("NCollection_DoubleMap binding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Key2Type aKey2;
- do {
- Random(aKey1);
- Random(aKey2);
- iFail1++;
- }
- while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
- iFail1--;
- a1.Bind(aKey1,aKey2);
- }
- ////////////////////////////////aNBind.Stop();
- PERF_STOP_METER("NCollection_DoubleMap binding")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_DoubleMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Key2Type aKey2;
- Random(aKey1);
- Random(aKey2);
- a1.AreBound(aKey1,aKey2);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_DoubleMap finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_DoubleMap operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_DoubleMap operator=")
- //aNAssi.Start();
- //a2.Assign(a1);
- //aNAssi.Stop();
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_DoubleMap clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_DoubleMap clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- QANCollection_DoubleMapOfRealInteger a1, a2;
- ////////////////////////////////aTBind.Start();
- PERF_START_METER("TCollection_DoubleMap binding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Key2Type aKey2;
- do {
- Random(aKey1);
- Random(aKey2);
- iFail2++;
- }
- while (a1.IsBound1(aKey1) || a1.IsBound2(aKey2));
- iFail2--;
- a1.Bind(aKey1,aKey2);
- }
- ////////////////////////////////aTBind.Stop();
- PERF_STOP_METER("TCollection_DoubleMap binding")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_DoubleMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Key2Type aKey2;
- Random(aKey1);
- Random(aKey2);
- a1.AreBound(aKey1,aKey2);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_DoubleMap finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_DoubleMap operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_DoubleMap operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_DoubleMap clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_DoubleMap clearing")
- }
- PERF_PRINT_ALL
- if (iFail1 || iFail2)
- cout << "Warning : N map failed " << iFail1 << " times, T map - " <<
- iFail2 << endl;
-}
-
-// ===================== Test perform of IndexedMap type ==========================
-void CompIndexedMap (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedMap adding",0);
- ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedMap adding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedMap operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedMap operator=",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedMap finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedMap finding",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedMap clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedMap clearing",0);
- ////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedMap Assign",0);
-
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_IndexedMap a1, a2;
- QANCollection_IndexedMapPerf a1, a2;
- ////////////////////////////////aNBind.Start();
- PERF_START_METER("NCollection_IndexedMap adding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Add(aKey1);
- }
- ////////////////////////////////aNBind.Stop();
- PERF_STOP_METER("NCollection_IndexedMap adding")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_IndexedMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Contains(aKey1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_IndexedMap finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_IndexedMap operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_IndexedMap operator=")
- ////////////////////////////////aNAssi.Start();
- PERF_START_METER("NCollection_IndexedMap Assign")
- a2.Assign(a1);
- ////////////////////////////////aNAssi.Stop();
- PERF_STOP_METER("NCollection_IndexedMap Assign")
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_IndexedMap clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_IndexedMap clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- TColStd_IndexedMapOfReal a1, a2;
- ////////////////////////////////aTBind.Start();
- PERF_START_METER("TCollection_IndexedMap adding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Add(aKey1);
- }
- ////////////////////////////////aTBind.Stop();
- PERF_STOP_METER("TCollection_IndexedMap adding")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_IndexedMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Contains(aKey1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_IndexedMap finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_IndexedMap operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_IndexedMap operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_IndexedMap clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_IndexedMap clearing")
- }
- PERF_PRINT_ALL
-}
-
-// ===================== Test perform of IndexedDataMap type ==========================
-void CompIndexedDataMap (const Standard_Integer theRep,
- const Standard_Integer theSize)
-{
- Standard_Integer i,j;
-
- ////////////////////////////////Perf_Meter aNBind ("NCollection_IndexedDataMap binding",0);
- ////////////////////////////////Perf_Meter aTBind ("TCollection_IndexedDataMap binding",0);
- ////////////////////////////////Perf_Meter aNFind ("NCollection_IndexedDataMap finding",0);
- ////////////////////////////////Perf_Meter aTFind ("TCollection_IndexedDataMap finding",0);
- ////////////////////////////////Perf_Meter aNOper ("NCollection_IndexedDataMap operator=",0);
- ////////////////////////////////Perf_Meter aTOper ("TCollection_IndexedDataMap operator=",0);
- ////////////////////////////////Perf_Meter aNClea ("NCollection_IndexedDataMap clearing",0);
- ////////////////////////////////Perf_Meter aTClea ("TCollection_IndexedDataMap clearing",0);
- //////////////////////////////////Perf_Meter aNAssi ("NCollection_IndexedDataMap Assign",0);
-
- for (i=0; i<theRep; i++)
- {
- ////////////////////////////////QANCollection_IDMap a1, a2;
- QANCollection_IDMapPerf a1, a2;
- ////////////////////////////////aNBind.Start();
- PERF_START_METER("NCollection_IndexedDataMap binding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- ItemType anItem;
- Random(aKey1);
- Random(anItem);
- a1.Add(aKey1,anItem);
- }
- ////////////////////////////////aNBind.Stop();
- PERF_STOP_METER("NCollection_IndexedDataMap binding")
- ////////////////////////////////aNFind.Start();
- PERF_START_METER("NCollection_IndexedDataMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Contains(aKey1);
- }
- ////////////////////////////////aNFind.Stop();
- PERF_STOP_METER("NCollection_IndexedDataMap finding")
- ////////////////////////////////aNOper.Start();
- PERF_START_METER("NCollection_IndexedDataMap operator=")
- a2 = a1;
- ////////////////////////////////aNOper.Stop();
- PERF_STOP_METER("NCollection_IndexedDataMap operator=")
- //aNAssi.Start();
- //a2.Assign(a1);
- //aNAssi.Stop();
- ////////////////////////////////aNClea.Start();
- PERF_START_METER("NCollection_IndexedDataMap clearing")
- a2.Clear();
- ////////////////////////////////aNClea.Stop();
- PERF_STOP_METER("NCollection_IndexedDataMap clearing")
- }
-
- for (i=0; i<theRep; i++)
- {
- QANCollection_IndexedDataMapOfRealPnt a1, a2;
- ////////////////////////////////aTBind.Start();
- PERF_START_METER("TCollection_IndexedDataMap binding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- ItemType anItem;
- Random(aKey1);
- Random(anItem);
- a1.Add(aKey1,anItem);
- }
- ////////////////////////////////aTBind.Stop();
- PERF_STOP_METER("TCollection_IndexedDataMap binding")
- ////////////////////////////////aTFind.Start();
- PERF_START_METER("TCollection_IndexedDataMap finding")
- for (j=1; j<=theSize; j++)
- {
- Key1Type aKey1;
- Random(aKey1);
- a1.Contains(aKey1);
- }
- ////////////////////////////////aTFind.Stop();
- PERF_STOP_METER("TCollection_IndexedDataMap finding")
- ////////////////////////////////aTOper.Start();
- PERF_START_METER("TCollection_IndexedDataMap operator=")
- a2 = a1;
- ////////////////////////////////aTOper.Stop();
- PERF_STOP_METER("TCollection_IndexedDataMap operator=")
- ////////////////////////////////aTClea.Start();
- PERF_START_METER("TCollection_IndexedDataMap clearing")
- a2.Clear();
- ////////////////////////////////aTClea.Stop();
- PERF_STOP_METER("TCollection_IndexedDataMap clearing")
- }
- PERF_PRINT_ALL
-}
-
-#endif
+++ /dev/null
-// Created on: 2002-05-15
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef QANCollection_PerfSparseArray_HeaderFile
-#define QANCollection_PerfSparseArray_HeaderFile
-
-#define PERF_ENABLE_METERS
-#include <OSD_PerfMeter.hxx>
-////////////////////////////////#include <Perf_Meter.hxx>
-#include <NCollection_SparseArray.hxx>
-#include <NCollection_SparseArrayBase.hxx>
-
-// ===================== Test perform of SparseArray type ==========================
-void CompSparseArray (const Standard_Integer theRep, const Standard_Integer theSize)
-{
- Standard_Integer i,j;
- for (i=0; i<theRep; i++)
- {
- PERF_START_METER("NCollection_SparseArray creation")
-
- NCollection_SparseArray<Standard_Integer> a1(theSize),a2(theSize);
-
- PERF_STOP_METER("NCollection_SparseArray creation")
-
- PERF_START_METER("NCollection_SparseArray filling")
- for( j=0;j<theSize;j++ )
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a1.SetValue(j,iIndex+1);
- }
-
- PERF_STOP_METER("NCollection_SparseArray filling")
-
- PERF_START_METER("NCollection_SparseArray size")
- Standard_Size sizeSparseArray=a1.Size();
- (void)sizeSparseArray; // avoid compiler warning on unused variable
- PERF_STOP_METER("NCollection_SparseArray size")
-
- PERF_START_METER("NCollection_Array1 Assign")
- a2.Assign(a1);
- PERF_STOP_METER("NCollection_Array1 Assign")
- PERF_START_METER("NCollection_SparseArray HasValue")
- for (j=0; j<theSize; j++)
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a2.HasValue(iIndex+1);
- }
- PERF_STOP_METER("NCollection_SparseArray HasValue")
- PERF_START_METER("NCollection_SparseArray UnsetValue")
- for (j=0; j<theSize; j++)
- {
- Standard_Integer iIndex;
- Random(iIndex,theSize);
- a1.UnsetValue(iIndex+1);
- }
- PERF_STOP_METER("NCollection_SparseArray UnsetValue")
-
- PERF_START_METER("NCollection_SparseArray Clear")
- a1.Clear();
- a2.Clear();
- PERF_STOP_METER("NCollection_SparseArray Clear")
-
- }
-
- PERF_PRINT_ALL
-}
-
-#endif
+++ /dev/null
-// Created on: 2002-05-15
-// Created by: Alexander KARTOMIN (akm)
-// Copyright (c) 2002-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// Purpose: To test the performance of NCollection classes
-
-#ifndef QANCollection_PerfTest_HeaderFile
-#define QANCollection_PerfTest_HeaderFile
-
-#include <gp_Pnt.hxx>
-#include <QANCollection_Common3.hxx>
-
-// ===================== Test methods for each type ===========================
-// TCollection classes compared are the containers with
-// ValueType - gp_Pnt
-// Key1Type - Standard_Real
-// Key2Type - Standard_Integer
-
-#include <QANCollection_PerfArrays.hxx>
-#include <QANCollection_PerfLists.hxx>
-#include <QANCollection_PerfMaps.hxx>
-
-#endif
--- /dev/null
+// Created on: 2004-03-05
+// Created by: Mikhail KUZMITCHEV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <QANCollection.hxx>
+#include <Draw_Interpretor.hxx>
+
+#include <OSD_PerfMeter.hxx>
+
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+
+#include <NCollection_Sequence.hxx>
+#include <NCollection_Array1.hxx>
+#include <NCollection_IncAllocator.hxx>
+
+typedef NCollection_Array1<gp_Pnt> MyArray1;
+typedef NCollection_Sequence<gp_Pnt> MySequence;
+
+const Standard_Integer REPEAT = 100;
+
+void printAllMeters ()
+{
+ PERF_PRINT_ALL
+}
+
+static void createArray (TColgp_Array1OfPnt& anArrPnt)
+{
+ OSD_PerfMeter aPerfMeter("Create array");
+
+ for (Standard_Integer j = 0; j < 2*REPEAT; j++) {
+ PERF_START_METER("Create array")
+ for (Standard_Integer i = anArrPnt.Lower(); i <= anArrPnt.Upper(); i++)
+ anArrPnt(i).SetCoord ((double)i, (double)(i+1), (double)(i+2));
+ PERF_STOP_METER("Create array")
+ }
+}
+
+static void createSequence (TColgp_SequenceOfPnt& aSeq)
+{
+ for (Standard_Integer j = 0; j < REPEAT; j++) {
+ PERF_START_METER("Clear sequence")
+ aSeq.Clear();
+ PERF_STOP_METER("Clear sequence")
+ PERF_START_METER("Create sequence")
+ for (Standard_Integer i = 0; i < 100000; i++)
+ aSeq.Append (gp_Pnt((double)i, (double)(i+1), (double)(i+2)));
+ PERF_STOP_METER("Create sequence")
+ }
+}
+
+static void createSequence (MySequence& aSeq)
+{
+ for (Standard_Integer j = 0; j < REPEAT; j++) {
+ PERF_START_METER("Clear sequence")
+ aSeq.Clear();
+ PERF_STOP_METER("Clear sequence")
+ PERF_START_METER("Create sequence")
+ for (Standard_Integer i = 0; i < 100000; i++)
+ aSeq.Append (gp_Pnt((double)i, (double)(i+1), (double)(i+2)));
+ PERF_STOP_METER("Create sequence")
+ }
+}
+
+static void assignSequence (TColgp_SequenceOfPnt& aDest,
+ const TColgp_SequenceOfPnt& aSrc)
+{
+ for (Standard_Integer i = 0; i < REPEAT; i++) {
+ PERF_START_METER("Assign sequence to sequence")
+ aDest = aSrc;
+ PERF_STOP_METER("Assign sequence to sequence")
+ }
+}
+
+static void assignSequence (MySequence& aDest, const MySequence& aSrc)
+{
+ for (Standard_Integer i = 0; i < REPEAT; i++) {
+ PERF_START_METER("Assign sequence to sequence")
+ aDest = aSrc;
+ PERF_STOP_METER("Assign sequence to sequence")
+ }
+}
+
+static void createArray (MyArray1& anArrPnt)
+{
+ for (Standard_Integer j = 0; j < 2*REPEAT; j++) {
+ PERF_START_METER("Create array")
+ for (Standard_Integer i = anArrPnt.Lower(); i <= anArrPnt.Upper(); i++)
+ anArrPnt(i).SetCoord ((double)i, (double)(i+1), (double)(i+2));
+ PERF_STOP_METER("Create array")
+ }
+}
+
+static void assignArray (TColgp_Array1OfPnt& aDest, const TColgp_Array1OfPnt& aSrc)
+{
+ for (Standard_Integer i = 0; i < 2*REPEAT; i++) {
+ PERF_START_METER("Assign array to array")
+ aDest = aSrc;
+ PERF_STOP_METER("Assign array to array")
+ }
+}
+
+template <class MyBaseCollPnt>
+void assignCollection (MyBaseCollPnt& aDest,
+ const MyBaseCollPnt& aSrc,
+ const char * MeterName)
+{
+ for (Standard_Integer i = 0; i < REPEAT; i++) {
+ perf_start_meter (MeterName);
+ aDest.Assign(aSrc);
+ perf_stop_meter (MeterName);
+ }
+}
+
+static void assignArray (MyArray1& aDest, const MyArray1& aSrc)
+{
+ for (Standard_Integer i = 0; i < 2*REPEAT; i++) {
+ PERF_START_METER("Assign array to array")
+ aDest = aSrc;
+ PERF_STOP_METER("Assign array to array")
+ }
+}
+
+static void checkArray (const Standard_Boolean isNewColl)
+{
+ if (isNewColl) {
+ MyArray1 anArrPnt (1, 100000), anArrPnt1 (1, 100000);
+ createArray (anArrPnt);
+ assignArray (anArrPnt1, anArrPnt);
+ assignCollection (anArrPnt1, anArrPnt, "Assign collect to array");
+ } else {
+ TColgp_Array1OfPnt anArrPnt (1,100000), anArrPnt1 (1, 100000);
+ createArray (anArrPnt);
+ assignArray (anArrPnt1, anArrPnt);
+ }
+ printAllMeters ();
+}
+
+static void checkSequence (const Standard_Boolean isNewColl,
+ const Standard_Boolean isIncr)
+{
+ if (isNewColl) {
+ Handle(NCollection_BaseAllocator) anAlloc[2];
+ if (isIncr) {
+ anAlloc[0] = new NCollection_IncAllocator;
+ anAlloc[1] = new NCollection_IncAllocator;
+ }
+ MySequence aSeqPnt (anAlloc[0]), aSeqPnt1(anAlloc[1]);
+ createSequence (aSeqPnt);
+ assignSequence (aSeqPnt1, aSeqPnt);
+ assignCollection (aSeqPnt1, aSeqPnt, "Assign collect to sequence");
+ } else {
+ TColgp_SequenceOfPnt aSeqPnt, aSeqPnt1;
+ createSequence (aSeqPnt);
+ assignSequence (aSeqPnt1, aSeqPnt);
+ }
+ printAllMeters ();
+}
+
+//=======================================================================
+//function : QANColCheckArray1
+//purpose :
+//=======================================================================
+static Standard_Integer QANColCheckArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc > 2) {
+ di << "Usage : " << argv[0] << " [-n]" << "\n";
+ return 1;
+ }
+
+ Standard_Boolean isNewColl = Standard_False;
+ if (argc > 1) {
+ if (strcmp (argv[1], "-n") == 0) isNewColl = Standard_True;
+ }
+ checkArray (isNewColl);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColCheckSequence
+//purpose :
+//=======================================================================
+static Standard_Integer QANColCheckSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc > 2) {
+ di << "Usage : " << argv[0] << " [-n]/[-ni]/[-in]" << "\n";
+ return 1;
+ }
+
+ Standard_Boolean isNewColl = Standard_False, isIncr = Standard_False;
+ if (argc > 1) {
+ if (strcmp (argv[1], "-n") == 0) isNewColl = Standard_True;
+ if (strcmp (argv[1], "-ni") == 0 || strcmp (argv[1], "-in") == 0)
+ {
+ isNewColl = Standard_True;
+ isIncr = Standard_True;
+ }
+ }
+ checkSequence (isNewColl, isIncr);
+ return 0;
+}
+
+void QANCollection::CommandsSimple(Draw_Interpretor& theCommands) {
+ const char *group = "QANCollection";
+
+ // from agvCollTest/src/AgvColEXE/TestEXE.cxx
+ theCommands.Add("QANColCheckArray1", "QANColCheckArray1 [-n]", __FILE__, QANColCheckArray1, group);
+ theCommands.Add("QANColCheckSequence", "QANColCheckSequence [-n]/[-ni]/[-in]", __FILE__, QANColCheckSequence, group);
+
+ return;
+}
--- /dev/null
+// Created on: 2004-03-05
+// Created by: Mikhail KUZMITCHEV
+// Copyright (c) 2004-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <QANCollection.hxx>
+#include <QANCollection_Common.hxx>
+
+#include <Draw.hxx>
+#include <Draw_Interpretor.hxx>
+
+#include <gp_Pnt.hxx>
+
+#define ItemType gp_Pnt
+#define Key1Type Standard_Real
+#define Key2Type Standard_Integer
+
+#include <NCollection_DefineArray1.hxx>
+#include <NCollection_DefineHArray1.hxx>
+////////////////////////////////DEFINE_ARRAY1(QANCollection_Array1,QANCollection_BaseCol,ItemType)
+////////////////////////////////DEFINE_HARRAY1(QANCollection_HArray1,QANCollection_Array1)
+DEFINE_ARRAY1(QANCollection_Array1Func,QANCollection_BaseColFunc,ItemType)
+DEFINE_HARRAY1(QANCollection_HArray1Func,QANCollection_Array1Func)
+IMPLEMENT_HARRAY1(QANCollection_HArray1Func)
+
+#include <NCollection_DefineArray2.hxx>
+#include <NCollection_DefineHArray2.hxx>
+////////////////////////////////DEFINE_ARRAY2(QANCollection_Array2,QANCollection_BaseCol,ItemType)
+////////////////////////////////DEFINE_HARRAY2(QANCollection_HArray2,QANCollection_Array2)
+DEFINE_ARRAY2(QANCollection_Array2Func,QANCollection_BaseColFunc,ItemType)
+DEFINE_HARRAY2(QANCollection_HArray2Func,QANCollection_Array2Func)
+IMPLEMENT_HARRAY2(QANCollection_HArray2Func)
+
+#include <NCollection_DefineMap.hxx>
+#include <NCollection_DefineDataMap.hxx>
+#include <NCollection_DefineDoubleMap.hxx>
+#include <NCollection_DefineIndexedMap.hxx>
+#include <NCollection_DefineIndexedDataMap.hxx>
+////////////////////////////////DEFINE_MAP(QANCollection_Map,QANCollection_Key1BaseCol,Key1Type)
+////////////////////////////////DEFINE_DATAMAP(QANCollection_DataMap,QANCollection_BaseCol,Key1Type,ItemType)
+////////////////////////////////DEFINE_DOUBLEMAP(QANCollection_DoubleMap,QANCollection_Key2BaseCol,Key1Type,Key2Type)
+////////////////////////////////DEFINE_INDEXEDMAP(QANCollection_IndexedMap,QANCollection_Key1BaseCol,Key1Type)
+////////////////////////////////DEFINE_INDEXEDDATAMAP(QANCollection_IDMap,QANCollection_BaseCol,Key1Type,ItemType)
+DEFINE_MAP(QANCollection_MapFunc,QANCollection_Key1BaseColFunc,Key1Type)
+DEFINE_DATAMAP(QANCollection_DataMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
+DEFINE_DOUBLEMAP(QANCollection_DoubleMapFunc,QANCollection_Key2BaseColFunc,Key1Type,Key2Type)
+DEFINE_INDEXEDMAP(QANCollection_IndexedMapFunc,QANCollection_Key1BaseColFunc,Key1Type)
+DEFINE_INDEXEDDATAMAP(QANCollection_IDMapFunc,QANCollection_BaseColFunc,Key1Type,ItemType)
+
+#include <NCollection_DefineList.hxx>
+////////////////////////////////DEFINE_LIST(QANCollection_List,QANCollection_BaseCol,ItemType)
+DEFINE_LIST(QANCollection_ListFunc,QANCollection_BaseColFunc,ItemType)
+
+#include <NCollection_DefineSequence.hxx>
+#include <NCollection_DefineHSequence.hxx>
+////////////////////////////////DEFINE_SEQUENCE(QANCollection_Sequence,QANCollection_BaseCol,ItemType)
+////////////////////////////////DEFINE_HSEQUENCE(QANCollection_HSequence,QANCollection_Sequence)
+DEFINE_SEQUENCE(QANCollection_SequenceFunc,QANCollection_BaseColFunc,ItemType)
+DEFINE_HSEQUENCE(QANCollection_HSequenceFunc,QANCollection_SequenceFunc)
+IMPLEMENT_HSEQUENCE(QANCollection_HSequenceFunc)
+
+// HashCode and IsEquel must be defined for key types of maps
+Standard_Integer HashCode(const gp_Pnt thePnt, int theUpper)
+{
+ return HashCode(thePnt.X(),theUpper);
+}
+
+Standard_Boolean IsEqual(const gp_Pnt& theP1, const gp_Pnt& theP2)
+{
+ return theP1.IsEqual(theP2,gp::Resolution());
+}
+
+////////////////////////////////void printCollection (QANCollection_Key1BaseCol& aColl,
+template <class Coll>
+void printCollection (Coll& aColl, const char * str)
+{
+ printf ("%s:\n",str);
+ Standard_Integer iSize = aColl.Size();
+ ////////////////////////////////QANCollection_Key1BaseCol::Iterator& anIter = aColl.CreateIterator();
+ typename Coll::Iterator anIter (aColl);
+ if (!anIter.More())
+ {
+ if (iSize==0)
+ printf (" <Empty collection>\n");
+ else
+ printf ("Error : empty collection has size==%d",iSize);
+ }
+ else
+ {
+ printf (" Size==%d\n",iSize);
+ for (; anIter.More(); anIter.Next())
+ PrintItem(anIter.Value());
+ }
+}
+
+////////////////////////////////void AssignCollection (QANCollection_BaseCol& aCollSrc,
+//////////////////////////////// QANCollection_BaseCol& aCollDst)
+template <class Coll>
+void AssignCollection (Coll& aCollSrc, Coll& aCollDst)
+{
+ printCollection (aCollSrc,"Source collection");
+ aCollDst.Assign(aCollSrc);
+ printCollection (aCollDst,"Target collection");
+}
+
+// ===================== Test methods of Array1 type ==========================
+////////////////////////////////void TestArray1 (QANCollection_Array1& theA1)
+static void TestArray1 (QANCollection_Array1Func& theA1)
+{
+ // Bounds
+ Standard_Integer iLow=theA1.Lower();
+ Standard_Integer iUpp=theA1.Upper();
+ Standard_Integer i;
+
+ printf ("Info: testing Array1(%d,%d), %s\n",
+ iLow, iUpp, (theA1.IsDeletable()?"deletable":"frozen"));
+ // C-array constructor, Length, Init
+ ItemType anItem;
+ Random(anItem);
+ theA1.Init (anItem);
+ ItemType * rBlock = new ItemType[theA1.Length()];
+ ////////////////////////////////QANCollection_Array1 aCArr(*rBlock, iLow-100, iUpp-100);
+ QANCollection_Array1Func aCArr(*rBlock, iLow-100, iUpp-100);
+ printf (" created the same sized preallocated array (%d,%d), %s\n",
+ aCArr.Lower(),aCArr.Upper(),(aCArr.IsDeletable()?"deletable":"frozen"));
+ // *Value, operator()
+ for (i=iLow+1; i<iUpp; i++)
+ {
+ Random (aCArr.ChangeValue (i-101));
+ aCArr.SetValue (i-100, ItemType(aCArr.Value(i-101)));
+ aCArr(i-99) = aCArr(i-100) = aCArr(i-101);
+ }
+ // Handle, copy constructor (including operator=)
+ ////////////////////////////////Handle(QANCollection_HArray1) aHa = new QANCollection_HArray1(aCArr);
+ Handle(QANCollection_HArray1Func) aHa = new QANCollection_HArray1Func(aCArr);
+ // Assign
+ AssignCollection (aHa->ChangeArray1(), theA1);
+}
+
+// ===================== Test methods of Array2 type ==========================
+////////////////////////////////void TestArray2 (QANCollection_Array2& theA2)
+static void TestArray2 (QANCollection_Array2Func& theA2)
+{
+ // Bounds
+ Standard_Integer iLR=theA2.LowerRow(), iLC=theA2.LowerCol();
+ Standard_Integer iUR=theA2.UpperRow(), iUC=theA2.UpperCol();
+ Standard_Integer i,j;
+
+ printf ("Info: testing Array2 (%d,%d)(%d,%d), %s\n",
+ iLR, iUR, iLC, iUC, (theA2.IsDeletable()?"deletable":"frozen"));
+ // C-array constructor, Length, Init, RowLength, ColLength
+ ItemType anItem;
+ Random(anItem);
+ theA2.Init (anItem);
+ ItemType * rBlock = new ItemType[theA2.Length()];
+ ////////////////////////////////QANCollection_Array2 aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
+ QANCollection_Array2Func aCArr(*rBlock, iLR-100, iUR-100, iLC, iUC);
+ printf (" created the same sized preallocated array (%d*%d), %s\n",
+ aCArr.RowLength(), aCArr.ColLength(),
+ (aCArr.IsDeletable()?"deletable":"frozen"));
+ // *Value, operator()
+ for (i=iLR+1; i<iUR; i++)
+ {
+ for (j=iLC; j<=iUC; j++)
+ {
+ Random (aCArr.ChangeValue (i-101, j));
+ aCArr.SetValue (i-100, j,
+ ItemType(aCArr.Value(i-101,j)));
+ aCArr(i-99,j) = aCArr(i-100,j) = aCArr(i-101,j);
+ }
+ }
+ // Handle, copy constructor (including operator=)
+ ////////////////////////////////Handle(QANCollection_HArray2) aHa = new QANCollection_HArray2(aCArr);
+ Handle(QANCollection_HArray2Func) aHa = new QANCollection_HArray2Func(aCArr);
+ // Assign
+ AssignCollection (aHa->ChangeArray2(), theA2);
+}
+
+// ===================== Test methods of List type ==========================
+////////////////////////////////void TestList (QANCollection_List& theL)
+static void TestList (QANCollection_ListFunc& theL)
+{
+ // Extent
+ Standard_Integer iExt=theL.Extent();
+ Standard_Integer i;
+
+ printf ("Info: testing List(%d)\n", iExt);
+ // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
+ // Remove, RemoveFirst, First, Last
+ ItemType anItem;
+ ////////////////////////////////QANCollection_List aL, aL1;
+ QANCollection_ListFunc aL, aL1;
+ for (i=0; i<4; i++)
+ {
+ Random (anItem);
+ aL.Append (anItem); // #1
+ aL.Append (aL1); // #2
+ Random (anItem);
+ aL1.Prepend (anItem); // #3
+ aL1.Prepend (aL); // #4
+ ////////////////////////////////QANCollection_List::Iterator anI(theL);
+ QANCollection_ListFunc::Iterator anI(theL);
+ if (anI.More())
+ {
+ Random (anItem);
+ theL.InsertBefore (anItem, anI); // #5
+ theL.InsertBefore (aL1, anI); // #6
+ Random (anItem);
+ theL.InsertAfter (anItem, anI); // #7
+ theL.InsertAfter (aL, anI); // #8
+ theL.Remove (anI); // #9
+ if (theL.Extent() > 0)
+ theL.RemoveFirst(); // #10
+ }
+ else
+ {
+ theL.Prepend (anItem);
+ PrintItem(theL.First());
+ PrintItem(theL.Last());
+ }
+ }
+ // Copy constructor + operator=
+ ////////////////////////////////aL = QANCollection_List(theL);
+ aL = QANCollection_ListFunc(theL);
+
+ // Assign
+ AssignCollection (theL, aL);
+
+ // Clear
+ aL.Clear();
+}
+
+// ===================== Test methods of Sequence type ========================
+////////////////////////////////void TestSequence (QANCollection_Sequence& theS)
+static void TestSequence (QANCollection_SequenceFunc& theS)
+{
+ Standard_Integer i;
+
+ printf ("Info: testing Sequence\n");
+ // Append(2)
+ ItemType anItem;
+ ////////////////////////////////QANCollection_Sequence aS, aS1;
+ QANCollection_SequenceFunc aS, aS1;
+ // Append(2), Prepend(2), InsertBefore(2), InsertAfter(2),
+ // Remove, RemoveFirst, First, Last
+ for (i=0; i<4; i++)
+ {
+ Random (anItem);
+ aS.Append (anItem); // #1
+ aS.Append (aS1); // #2
+ Random (anItem);
+ aS1.Prepend (anItem); // #3
+ aS1.Prepend (aS); // #4
+ if (theS.Length() > 0)
+ {
+ Random (anItem);
+ theS.InsertBefore (1, anItem); // #5
+ theS.InsertBefore (2, aS1); // #6
+ Random (anItem);
+ theS.InsertAfter (1, anItem); // #7
+ theS.InsertAfter (2, aS); // #8
+ theS.Remove (1); // #9
+ if (theS.Length() > 0)
+ theS.Remove(1); // #10
+ }
+ else
+ {
+ theS.Prepend (anItem);
+ PrintItem(theS.First());
+ PrintItem(theS.Last());
+ }
+ }
+
+ // ()
+ PrintItem(theS(1));
+
+ // Handle, Split
+ ////////////////////////////////Handle(QANCollection_HSequence) aHS = new QANCollection_HSequence(aS1);
+ Handle(QANCollection_HSequenceFunc) aHS = new QANCollection_HSequenceFunc(aS1);
+ theS.Split (3, aHS->ChangeSequence());
+
+ // Assign
+ AssignCollection (theS, aS);
+
+ // Clear
+ aS.Clear();
+}
+
+// ===================== Test methods of Map type =============================
+////////////////////////////////void TestMap (QANCollection_Map& theM)
+static void TestMap (QANCollection_MapFunc& theM)
+{
+ // Extent
+ Standard_Integer iExt=theM.Extent();
+ Standard_Integer i;
+
+ printf ("Info: testing Map(l=%d)\n", iExt);
+ theM.Statistics(cout);
+ // Resize
+ theM.ReSize(8);
+ theM.Statistics(cout);
+ cout.flush();
+ // Constructor
+ ////////////////////////////////QANCollection_Map aM;
+ QANCollection_MapFunc aM;
+ // Add
+ Key1Type aKey;
+ for (i=0; i<8; i++)
+ {
+ Random (aKey);
+ aM.Add (aKey);
+ }
+ // Contains, Remove
+ if (!aM.Contains(aKey))
+ {
+ printf("Error : map says that it does not contain its key ");
+ PrintItem(aKey);
+ }
+ else
+ {
+ aM.Remove(aKey);
+ printf(" successfully removed item, l=%d\n", aM.Size());
+ }
+ // Copy constructor (including operator=)
+ ////////////////////////////////QANCollection_Map aM2 = QANCollection_Map(aM);
+ QANCollection_MapFunc aM2 = QANCollection_MapFunc(aM);
+ // Assign
+ AssignCollection (aM2,theM);
+
+ // Clear
+ aM.Clear();
+}
+
+// ===================== Test methods of DataMap type =========================
+////////////////////////////////void TestDataMap (QANCollection_DataMap& theM)
+static void TestDataMap (QANCollection_DataMapFunc& theM)
+{
+ // Extent
+ Standard_Integer iExt=theM.Extent();
+ Standard_Integer i;
+
+ printf ("Info: testing DataMap(l=%d)\n", iExt);
+ theM.Statistics(cout);
+ // Resize
+ theM.ReSize(8);
+ theM.Statistics(cout);
+ cout.flush();
+ // Constructor
+ ////////////////////////////////QANCollection_DataMap aM;
+ QANCollection_DataMapFunc aM;
+ // Bind, Find, ChangeFind, ()
+ Key1Type aKey;
+ ItemType anItem;
+ for (i=0; i<8; i++)
+ {
+ Random (aKey);
+ Random (anItem);
+ aM.Bind (aKey, anItem);
+ PrintItem(aM.Find(aKey));
+ Random(aM(aKey));
+ }
+ // IsBound, UnBind
+ if (!aM.IsBound(aKey))
+ {
+ printf("Error : map says that it does not contain its key ");
+ PrintItem(aKey);
+ }
+ else
+ {
+ aM.UnBind(aKey);
+ printf(" successfully unbound the key, l=%d\n", aM.Size());
+ }
+ // Copy constructor (including operator=)
+ ////////////////////////////////theM = QANCollection_DataMap(aM);
+ theM = QANCollection_DataMapFunc(aM);
+ // Assign - prohibited
+ // AssignCollection (aM2,theM);
+ printCollection (theM, "DataMap:");
+
+ // Clear
+ aM.Clear();
+}
+
+
+// ===================== Test methods of DoubleMap type =======================
+////////////////////////////////void TestDoubleMap (QANCollection_DoubleMap& theM)
+static void TestDoubleMap (QANCollection_DoubleMapFunc& theM)
+{
+ // Extent
+ Standard_Integer iExt=theM.Extent();
+ Standard_Integer i;
+
+ printf ("Info: testing DoubleMap(l=%d)\n", iExt);
+ theM.Statistics(cout);
+ // Resize
+ theM.ReSize(8);
+ theM.Statistics(cout);
+ cout.flush();
+ // Constructor
+ ////////////////////////////////QANCollection_DoubleMap aM;
+ QANCollection_DoubleMapFunc aM;
+ // Bind, Find?,
+ Key1Type aKey1;
+ Key2Type aKey2;
+ for (i=0; i<8; i++)
+ {
+ Random (aKey1);
+ Random (aKey2);
+ aM.Bind (aKey1, aKey2);
+ PrintItem(aM.Find1(aKey1));
+ if (!aM.IsBound1(aKey1))
+ {
+ printf("Error : map says that it does not contain its key ");
+ PrintItem(aKey1);
+ }
+ PrintItem(aM.Find2(aKey2));
+ if (!aM.IsBound2(aKey2))
+ {
+ printf("Error : map says that it does not contain its key ");
+ PrintItem(aKey2);
+ }
+ }
+ // AreBound, UnBind
+ if (!aM.AreBound(aKey1,aKey2))
+ {
+ printf("Error : map says that it does not contain its keys ");
+ PrintItem(aKey1);
+ PrintItem(aKey2);
+ }
+ else
+ {
+ if (aM.UnBind2(aKey2))
+ printf(" successfully unbound the key, l=%d\n", aM.Size());
+ if (aM.UnBind1(aKey1))
+ printf("Error : unbound both keys?!\n");
+ }
+ // Copy constructor (including operator=)
+ ////////////////////////////////theM = QANCollection_DoubleMap(aM);
+ theM = QANCollection_DoubleMapFunc(aM);
+ // Assign - prohibited
+ // AssignCollection (aM2,theM);
+ printCollection (theM, "DoubleMap:");
+
+ // Clear
+ aM.Clear();
+}
+
+// ===================== Test methods of IndexedMap type ======================
+////////////////////////////////void TestIndexedMap (QANCollection_IndexedMap& theM)
+static void TestIndexedMap (QANCollection_IndexedMapFunc& theM)
+{
+ // Extent
+ Standard_Integer iExt=theM.Extent();
+ Standard_Integer i;
+
+ printf ("Info: testing IndexedMap(l=%d)\n", iExt);
+ theM.Statistics(cout);
+ // Resize
+ theM.ReSize(8);
+ theM.Statistics(cout);
+ cout.flush();
+ // Constructor
+ ////////////////////////////////QANCollection_IndexedMap aM;
+ QANCollection_IndexedMapFunc aM;
+ // Add, FindKey, FindIndex
+ Key1Type aKey;
+ for (i=0; i<8; i++)
+ {
+ Random (aKey);
+ aM.Add (aKey);
+ Standard_Integer iIndex=aM.FindIndex(aKey);
+ printf (" added a key, i=%d, k=",iIndex);
+ PrintItem(aM(iIndex));
+ }
+ // Contains, Remove
+ if (!aM.Contains(aM.FindKey(aM.FindIndex(aKey))))
+ {
+ printf("Error : map says that it does not contain its key ");
+ PrintItem(aKey);
+ }
+ else
+ {
+ aM.RemoveLast();
+ printf(" successfully removed item, l=%d\n", aM.Size());
+ }
+ // Substitute
+ Random(aKey);
+ aM.Substitute(1,aKey);
+ // Copy constructor (including operator=)
+ ////////////////////////////////QANCollection_IndexedMap aM2 = QANCollection_IndexedMap(aM);
+ QANCollection_IndexedMapFunc aM2 = QANCollection_IndexedMapFunc(aM);
+ // Assign
+ AssignCollection (aM2,theM);
+
+ // Clear
+ aM.Clear();
+}
+
+// ===================== Test methods of IndexedDataMap type ==================
+////////////////////////////////void TestIndexedDataMap (QANCollection_IDMap& theM)
+static void TestIndexedDataMap (QANCollection_IDMapFunc& theM)
+{
+ // Extent
+ Standard_Integer iExt=theM.Extent();
+ Standard_Integer i;
+
+ printf ("Info: testing IndexedDataMap(l=%d)\n", iExt);
+ theM.Statistics(cout);
+ // Resize
+ theM.ReSize(8);
+ theM.Statistics(cout);
+ cout.flush();
+ // Constructor
+ ////////////////////////////////QANCollection_IDMap aM;
+ QANCollection_IDMapFunc aM;
+ // Add, FindKey, FindIndex, FindFromIndex, Change..., ()
+ Key1Type aKey;
+ ItemType anItem;
+ for (i=0; i<8; i++)
+ {
+ Random (aKey);
+ Random (anItem);
+ aM.Add (aKey, anItem);
+ Standard_Integer iIndex=aM.FindIndex(aKey);
+ printf (" added a key, i=%d, k=",iIndex);
+ PrintItem(aM.FindKey(iIndex));
+ PrintItem(aM(iIndex));
+ Random(aM.ChangeFromIndex(iIndex));
+ }
+ // Contains, Remove, FindFromKey
+ if (!aM.Contains(aM.FindKey(aM.FindIndex(aKey))))
+ {
+ printf("Error : map says that it does not contain its key ");
+ PrintItem(aKey);
+ }
+ else
+ {
+ anItem = aM.FindFromKey(aKey);
+ aM.RemoveLast();
+ printf(" successfully removed item, l=%d\n", aM.Size());
+ }
+ // Substitute
+ Random(aKey);
+ aM.Substitute (1, aKey, anItem);
+ // Copy constructor (including operator=)
+ ////////////////////////////////theM = QANCollection_IDMap(aM);
+ theM = QANCollection_IDMapFunc(aM);
+ // Assign - prohibited
+ // AssignCollection (aM2,theM);
+ printCollection (theM, "DoubleMap:");
+
+ // Clear
+ aM.Clear();
+}
+
+//=======================================================================
+//function : CheckArguments1
+//purpose :
+//=======================================================================
+Standard_Integer CheckArguments1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& Lower, Standard_Integer& Upper)
+{
+ if ( argc != 3) {
+ di << "Usage : " << argv[0] << " Lower Upper" << "\n";
+ return 1;
+ }
+ Lower = Draw::Atoi(argv[1]);
+ Upper = Draw::Atoi(argv[2]);
+ if ( Lower > Upper ) {
+ di << "Lower > Upper" << "\n";
+ return 1;
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : CheckArguments2
+//purpose :
+//=======================================================================
+Standard_Integer CheckArguments2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv, Standard_Integer& LowerRow, Standard_Integer& UpperRow, Standard_Integer& LowerCol, Standard_Integer& UpperCol)
+{
+ if ( argc != 5) {
+ di << "Usage : " << argv[0] << " LowerRow UpperRow LowerCol UpperCol" << "\n";
+ return 1;
+ }
+ LowerRow = Draw::Atoi(argv[1]);
+ UpperRow = Draw::Atoi(argv[2]);
+ LowerCol = Draw::Atoi(argv[3]);
+ UpperCol = Draw::Atoi(argv[4]);
+ if ( LowerRow > UpperRow ) {
+ di << "LowerRow > UpperRow" << "\n";
+ return 1;
+ }
+ if ( LowerCol > UpperCol ) {
+ di << "LowerCol UpperCol> " << "\n";
+ return 1;
+ }
+ return 0;
+}
+
+
+//=======================================================================
+//function : QANColTestArray1
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestArray1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer Lower, Upper;
+ if ( CheckArguments1(di, argc, argv, Lower, Upper) ) {
+ return 1;
+ }
+ QANCollection_Array1Func anArr1(Lower, Upper);
+ TestArray1(anArr1);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestArray2
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestArray2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ Standard_Integer LowerRow, UpperRow, LowerCol, UpperCol;
+ if ( CheckArguments2(di, argc, argv, LowerRow, UpperRow, LowerCol, UpperCol) ) {
+ return 1;
+ }
+ QANCollection_Array2Func anArr2(LowerRow, UpperRow, LowerCol, UpperCol);
+ TestArray2(anArr2);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_MapFunc aMap;
+ TestMap(aMap);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestDataMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_DataMapFunc aDataMap;
+ TestDataMap(aDataMap);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestDoubleMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestDoubleMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_DoubleMapFunc aDoubleMap;
+ TestDoubleMap(aDoubleMap);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestIndexedMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestIndexedMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_IndexedMapFunc aIndexedMap;
+ TestIndexedMap(aIndexedMap);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestIndexedDataMap
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestIndexedDataMap(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_IDMapFunc aIDMap;
+ TestIndexedDataMap(aIDMap);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestList
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestList(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_ListFunc aList;
+ TestList(aList);
+ return 0;
+}
+
+//=======================================================================
+//function : QANColTestSequence
+//purpose :
+//=======================================================================
+static Standard_Integer QANColTestSequence(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if ( argc != 1) {
+ di << "Usage : " << argv[0] << "\n";
+ return 1;
+ }
+ QANCollection_SequenceFunc aSeq;
+ TestSequence(aSeq);
+ return 0;
+}
+
+void QANCollection::CommandsTest(Draw_Interpretor& theCommands) {
+ const char *group = "QANCollection";
+
+ // from agvCollTest/src/CollectionEXE/FuncTestEXE.cxx
+ theCommands.Add("QANColTestArray1", "QANColTestArray1", __FILE__, QANColTestArray1, group);
+ theCommands.Add("QANColTestArray2", "QANColTestArray2", __FILE__, QANColTestArray2, group);
+ theCommands.Add("QANColTestMap", "QANColTestMap", __FILE__, QANColTestMap, group);
+ theCommands.Add("QANColTestDataMap", "QANColTestDataMap", __FILE__, QANColTestDataMap, group);
+ theCommands.Add("QANColTestDoubleMap", "QANColTestDoubleMap", __FILE__, QANColTestDoubleMap, group);
+ theCommands.Add("QANColTestIndexedMap", "QANColTestIndexedMap", __FILE__, QANColTestIndexedMap, group);
+ theCommands.Add("QANColTestIndexedDataMap", "QANColTestIndexedDataMap", __FILE__, QANColTestIndexedDataMap, group);
+ theCommands.Add("QANColTestList", "QANColTestList", __FILE__, QANColTestList, group);
+ theCommands.Add("QANColTestSequence", "QANColTestSequence", __FILE__, QANColTestSequence, group);
+
+ return;
+}