0024784: Move documentation in CDL files to proper location
[occt.git] / src / SelectMgr / SelectMgr_CompareResults.hxx
CommitLineData
b311480e 1// Created on: 2003-10-23
2// Created by: Alexander GRIGORIEV
973c2be1 3// Copyright (c) 2003-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16#include <SelectMgr_IndexedDataMapOfOwnerCriterion.hxx>
17#include <SelectMgr_SortCriterion.hxx>
18#include <TCollection_CompareOfInteger.hxx>
19
ff8178ef 20// Purpose: Redefine CompareOfInteger from TCollection, to be used
21// in method SortResult from class ViewerSelector
22
7fd59977 23class SelectMgr_CompareResults: public TCollection_CompareOfInteger
24{
25 public:
26 SelectMgr_CompareResults
27 (const SelectMgr_IndexedDataMapOfOwnerCriterion& aMapOfCriterion)
28 : myMapOfCriterion (aMapOfCriterion) {}
29 Standard_Boolean IsLower
30 (const Standard_Integer&, const Standard_Integer&) const;
31 Standard_Boolean IsGreater
32 (const Standard_Integer&, const Standard_Integer&) const;
33 private:
34 const SelectMgr_IndexedDataMapOfOwnerCriterion& myMapOfCriterion;
d390b166 35 void operator= (const SelectMgr_CompareResults& );
7fd59977 36};
37
38//=======================================================================
39//function : IsLower
40//purpose : The sort order should be inverse (the greatest to come first)
41//=======================================================================
42
43inline Standard_Boolean SelectMgr_CompareResults::IsLower
44 (const Standard_Integer &Left,const Standard_Integer &Right) const
45{
46 return (myMapOfCriterion.FindFromIndex(Left) >
47 myMapOfCriterion.FindFromIndex(Right));
48}
49
50//=======================================================================
51//function : IsGreater
52//purpose : The sort order should be inverse (the greatest to come first)
53//=======================================================================
54
55inline Standard_Boolean SelectMgr_CompareResults::IsGreater
56 (const Standard_Integer &Left,const Standard_Integer &Right) const
57{
58 return (myMapOfCriterion.FindFromIndex(Left) <
59 myMapOfCriterion.FindFromIndex(Right));
60}