OpendTect  6.3
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 ________________________________________________________________________
10 
11 -*/
12 
13 
14 #include "sets.h"
15 
16 
17 template<class OD,class QT>
19 {
20 public:
22 
23  int size() const { return odobjs_.size(); }
24 
25  void add(OD*,QT*);
26  void remove(const OD&);
27 
28  OD* getODObject(const QT&);
29  QT* getQtObject(const OD&);
30 
31  OD* getODObject(int idx);
32  QT* getQtObject(int idx);
33 
34 protected:
35 
38 };
39 
40 
41 template<class OD,class QT>
42 void ODQtObjectSet<OD,QT>::add( OD* odobj, QT* qtobj )
43 {
44  odobjs_ += odobj;
45  qtobjs_ += qtobj;
46 }
47 
48 
49 template<class OD,class QT>
50 void ODQtObjectSet<OD,QT>::remove( const OD& obj )
51 {
52  const int idx = odobjs_.indexOf( &obj );
53  if ( idx<0 ) return;
54 
55  odobjs_.removeSingle( idx );
56  qtobjs_.removeSingle( idx );
57 }
58 
59 
60 template<class OD,class QT>
62 {
63  const int idx = qtobjs_.indexOf( &qtobj );
64  return idx<0 ? 0 : odobjs_[idx];
65 }
66 
67 
68 template<class OD,class QT>
70 {
71  const int idx = odobjs_.indexOf( &obj );
72  return idx<0 ? 0 : qtobjs_[idx];
73 }
74 
75 
76 template<class OD,class QT>
78 {
79  return odobjs_.validIdx(idx) ? odobjs_[idx] : 0;
80 }
81 
82 
83 template<class OD,class QT>
85 {
86  return qtobjs_.validIdx(idx) ? qtobjs_[idx] : 0;
87 }
ODQtObjectSet()
Definition: odqtobjset.h:21
OD * getODObject(const QT &)
Definition: odqtobjset.h:61
QT * getQtObject(const OD &)
Definition: odqtobjset.h:69
ObjectSet< QT > qtobjs_
Definition: odqtobjset.h:37
void remove(const OD &)
Definition: odqtobjset.h:50
int size() const
Definition: odqtobjset.h:23
ObjectSet< OD > odobjs_
Definition: odqtobjset.h:36
Definition: odqtobjset.h:18
OpendTect.
Definition: commontypes.h:25
#define mClass(module)
Definition: commondefs.h:161
void add(OD *, QT *)
Definition: odqtobjset.h:42

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