OpendTect  6.6
odqtobjset.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Nanne Hemstra
8  Date: April 2008
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 
15 #include "sets.h"
16 
17 
18 template<class OD,class QT>
20 {
21 public:
23 
24  int size() const { return odobjs_.size(); }
25 
26  void add(OD*,QT*);
27  void remove(const OD&);
28 
29  OD* getODObject(const QT&);
30  QT* getQtObject(const OD&);
31 
32  OD* getODObject(int idx);
33  QT* getQtObject(int idx);
34 
35 protected:
36 
39 };
40 
41 
42 template<class OD,class QT>
43 void ODQtObjectSet<OD,QT>::add( OD* odobj, QT* qtobj )
44 {
45  odobjs_ += odobj;
46  qtobjs_ += qtobj;
47 }
48 
49 
50 template<class OD,class QT>
51 void ODQtObjectSet<OD,QT>::remove( const OD& obj )
52 {
53  const int idx = odobjs_.indexOf( &obj );
54  if ( idx<0 ) return;
55 
56  odobjs_.removeSingle( idx );
57  qtobjs_.removeSingle( idx );
58 }
59 
60 
61 template<class OD,class QT>
63 {
64  const int idx = qtobjs_.indexOf( &qtobj );
65  return idx<0 ? 0 : odobjs_[idx];
66 }
67 
68 
69 template<class OD,class QT>
71 {
72  const int idx = odobjs_.indexOf( &obj );
73  return idx<0 ? 0 : qtobjs_[idx];
74 }
75 
76 
77 template<class OD,class QT>
79 {
80  return odobjs_.validIdx(idx) ? odobjs_[idx] : 0;
81 }
82 
83 
84 template<class OD,class QT>
86 {
87  return qtobjs_.validIdx(idx) ? qtobjs_[idx] : 0;
88 }
89 
90 
ODQtObjectSet::qtobjs_
ObjectSet< QT > qtobjs_
Definition: odqtobjset.h:38
ObjectSet< OD >
ODQtObjectSet
Definition: odqtobjset.h:20
OD
OpendTect.
Definition: commontypes.h:28
ODQtObjectSet::remove
void remove(const OD &)
Definition: odqtobjset.h:51
ODQtObjectSet::ODQtObjectSet
ODQtObjectSet()
Definition: odqtobjset.h:22
ODQtObjectSet::getODObject
OD * getODObject(const QT &)
Definition: odqtobjset.h:62
File::remove
bool remove(const char *)
ODQtObjectSet::odobjs_
ObjectSet< OD > odobjs_
Definition: odqtobjset.h:37
mClass
#define mClass(module)
Definition: commondefs.h:181
ODQtObjectSet::getQtObject
QT * getQtObject(const OD &)
Definition: odqtobjset.h:70
ODQtObjectSet::add
void add(OD *, QT *)
Definition: odqtobjset.h:43
ODQtObjectSet::size
int size() const
Definition: odqtobjset.h:24
sets.h

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021