OpendTect-6_4  6.4
cmdfunction.h
Go to the documentation of this file.
1 #ifndef cmdfunction_h
2 #define cmdfunction_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Jaap Glas
9  Date: April 2011
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uicmddrivermod.h"
16 #include "bufstringset.h"
17 #include "factory.h"
18 
19 
20 class uiMainWin;
21 
22 namespace CmdDrive
23 {
24 
25 class CmdDriver;
26 class WildcardManager;
27 
28 mExpClass(uiCmdDriver) Function
29 {
30 public:
31 
32  mDefineFactory1ParamInClass( Function, const CmdDriver&, factory );
33  static void initStandardFunctions();
34  static BufferString factoryKey(const char* name);
35 
36  Function(const CmdDriver& cmddrv)
37  : drv_(cmddrv)
38  {}
39  virtual ~Function() {}
40 
41  virtual const char* name() const =0;
42  virtual bool eval(const BufferStringSet& args,
43  BufferString& res) const =0;
44 
45 
46 protected:
47 
48  static BufferString createFactoryKey(const char* keyword);
49 
50  const CmdDriver& drv_;
51 
52  bool openQDlg() const;
53  const uiMainWin* curWin() const;
54  const uiMainWin* applWin() const;
55 
56  const WildcardManager& wildcardMan() const;
57 };
58 
59 
60 #define mStartDeclFunClassNoEval(funkey,parentclass) \
61 \
62 mExpClass(uiCmdDriver) funkey##Func : public parentclass \
63 { \
64 public: \
65  funkey##Func(const CmdDriver& cmddrv) \
66  : parentclass(cmddrv) \
67  { \
68  name_ = keyWord(); \
69  *name_.getCStr() = mCast(char,tolower(*name_.buf())); \
70  } \
71 \
72  static const char* keyWord() { return #funkey; } \
73  virtual const char* name() const { return name_; } \
74 protected: \
75  BufferString name_;
76 
77 
78 #define mStartDeclFunClass(funkey,parentclass) \
79 \
80  mStartDeclFunClassNoEval(funkey,parentclass) \
81 public: \
82  virtual bool eval(const BufferStringSet& args, \
83  BufferString& res) const; \
84 \
85  static Function* createInstance(const CmdDriver& cmddrv) \
86  { return new funkey##Func(cmddrv); } \
87  static void initClass() \
88  { factory().addCreator( createInstance, \
89  createFactoryKey(keyWord()) ); }
90 
91 #define mEndDeclFunClass \
92 };
93 
94 
114 
121 
128 
131 
134 
138 
142 
145 
147 
148 }; // namespace CmdDrive
149 
150 
151 #endif
#define mExpClass(module)
Definition: commondefs.h:160
User interface main window.
Definition: uimainwin.h:36
virtual ~Function()
Definition: cmdfunction.h:39
Function(const CmdDriver &cmddrv)
Definition: cmdfunction.h:36
Command Drive
Definition: canvascommands.h:22
Definition: stattype.h:27
float Ceil(float)
Definition: searchkey.h:57
float Atan2(float y, float x)
Definition: file.h:99
Set of BufferString objects.
Definition: bufstringset.h:28
Definition: stattype.h:26
unsigned int Abs(unsigned int i)
Definition: math2.h:80
#define mDefineFactory1ParamInClass(T, P, funcname)
Definition: factory.h:447
float Floor(float)
Definition: stattype.h:26
#define mEndDeclFunClass
Definition: cmdfunction.h:91
const CmdDriver & drv_
Definition: cmdfunction.h:50
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: cmdfunction.h:28
float Exp(float)
float Sqrt(float)
#define mStartDeclFunClass(funkey, parentclass)
Definition: cmdfunction.h:78
Definition: cmddriver.h:103

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