OpendTect  6.6
namedobj.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: Bert
8  Date: Sep 1994, Aug 2006, Mar 2015
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "basicmod.h"
15 #include "notify.h"
16 #include "bufstring.h"
17 
18 
22 {
23 public:
24 
26 
27  virtual ~ObjectWithName() {}
28 
29  virtual const name_type& name() const = 0;
30 
31  mDeprecatedObs inline bool hasName( const char* nm ) const
32  { return name() == nm; }
33  mDeprecatedObs inline bool hasName( const name_type& nm ) const
34  { return name() == nm; }
35 
36  void putNameInPar(IOPar&) const;
37 };
38 
42 {
43 public:
44 
45  NamedObject( const char* nm=nullptr )
46  : name_(nm) {}
47  NamedObject( const NamedObject& oth )
48  : name_(oth.getName()) {}
49  virtual ~NamedObject() {}
50  NamedObject& operator =(const NamedObject&);
51  mDeprecatedObs bool operator ==( const NamedObject& oth ) const
52  { return name_ == oth.getName(); }
53 
54  virtual const name_type& name() const { return name_; }
55  virtual BufferString getName() const { return name_; }
56  virtual void setName( const char* nm ) { name_ = nm; }
57 
58  bool getNameFromPar(const IOPar&);
59 
60 protected:
61 
63 
64 };
65 
66 
71  , public NamedObject
72 {
73 public:
74 
75  NamedCallBacker(const char* nm=0);
77 
78  inline bool operator ==( const NamedCallBacker& oth ) const
79  { return name_ == oth.getName(); }
80  inline bool operator ==( const NamedObject& oth ) const
81  { return name_ == oth.getName(); }
82 
84  { return mSelf().delnotif_; }
85 
86 protected:
87 
90  void sendDelNotif() const;
91 
92 };
93 
94 
95 mGlobal(Basic) inline bool operator >( const ObjectWithName& obj1,
96  const ObjectWithName& obj2 )
97 {
98  return obj1.name() > obj2.name();
99 }
NamedObject
object with a name.
Definition: namedobj.h:42
ObjectWithName::putNameInPar
void putNameInPar(IOPar &) const
NamedCallBacker
CallBacker object with a name. Use if you want your object to be able to send and receive CallBack's,...
Definition: namedobj.h:72
NamedObject::NamedObject
NamedObject(const NamedObject &oth)
Definition: namedobj.h:47
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
notify.h
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
NamedObject::~NamedObject
virtual ~NamedObject()
Definition: namedobj.h:49
NamedCallBacker::NamedCallBacker
NamedCallBacker(const NamedCallBacker &)
CallBacker
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
operator==
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:81
bufstring.h
ObjectWithName::name_type
OD::String name_type
Definition: namedobj.h:25
ObjectWithName::name
virtual const name_type & name() const =0
NamedObject::name
virtual const name_type & name() const
Definition: namedobj.h:54
ObjectWithName::hasName
bool hasName(const name_type &nm) const
Definition: namedobj.h:33
NamedCallBacker::delnotif_
Notifier< NamedCallBacker > delnotif_
Definition: namedobj.h:88
ObjectWithName::~ObjectWithName
virtual ~ObjectWithName()
Definition: namedobj.h:27
NamedCallBacker::sendDelNotif
void sendDelNotif() const
Notifier< NamedCallBacker >
NamedCallBacker::objectToBeDeleted
virtual Notifier< NamedCallBacker > & objectToBeDeleted() const
Definition: namedobj.h:83
ObjectWithName
object with a name.
Definition: namedobj.h:22
NamedObject::name_
BufferString name_
Definition: namedobj.h:62
NamedCallBacker::delalreadytriggered_
Threads::Atomic< bool > delalreadytriggered_
Definition: namedobj.h:89
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
mDeprecatedObs
#define mDeprecatedObs
Definition: plfdefs.h:217
ObjectWithName::hasName
bool hasName(const char *nm) const
Definition: namedobj.h:31
OD::String
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
mSelf
#define mSelf()
Definition: commondefs.h:144
operator>
bool operator>(const ObjectWithName &obj1, const ObjectWithName &obj2)
Definition: namedobj.h:95
NamedObject::setName
virtual void setName(const char *nm)
Definition: namedobj.h:56
NamedObject::getName
virtual BufferString getName() const
Definition: namedobj.h:55
NamedObject::NamedObject
NamedObject(const char *nm=nullptr)
Definition: namedobj.h:45
Threads::Atomic< bool >
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
NamedObject::getNameFromPar
bool getNameFromPar(const IOPar &)
NamedCallBacker::NamedCallBacker
NamedCallBacker(const char *nm=0)

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