kangaroo  1.0
the cbls library
singleVarTabuDoCallback.hpp
Go to the documentation of this file.
1 
12 #ifndef SingleVarTabuDoCallbackHppIncluded
13 #define SingleVarTabuDoCallbackHppIncluded
14 
15 
16 
17 #include "cbls/frames/index.hpp"
19 
20 
21 
23 
24 
25 
35 {
36  public:
37 
40 
41  xb<Variable *> const & TabuUpdates() const;
42 
44 
45  protected:
46 
49 
51  SingleVarTabuDoCallback(System * const pSystem);
52 
53  SingleVarTabuDoCallback(SingleVarTabuDoCallback && that) noexcept = delete;
54  SingleVarTabuDoCallback(SingleVarTabuDoCallback const & that) = delete;
55  SingleVarTabuDoCallback & operator = (SingleVarTabuDoCallback && that) noexcept = delete;
57 
59 
62 
63  virtual void adjustMemAuto() override;
64 
66 
69 
70  void callbackFuncs();
71  void registerCallbackFunc(Function * const pFunction);
72 
74 
77 
78  xb<Function *> mCallbackFuncs;
79  xb<Variable *> mTabuUpdates;
80 
82 };
83 
84 
86 
87 
88 
89 
95 {
96  WatchError
98  setCallback(true);
99  CatchError
100 }
101 
102 
103 
108 {
109  WatchError
110  // nothing to be done.
111  CatchError
112 }
113 
114 
115 
119 inline xb<Variable *> const & SingleVarTabuDoCallback::TabuUpdates() const
120 {
121  WatchError
122  return mTabuUpdates;
123  CatchError
124 }
125 
126 
127 
132 {
133  WatchError
134  mCallbackFuncs.adjustMemAuto();
135  mTabuUpdates.adjustMemAuto();
137  CatchError
138 }
139 
140 
141 
146 {
147  WatchError
148  mCallbackFuncs.insertMem(pFunction);
149  CatchError
150 }
151 
152 
153 
154 
155 
160 {
161  WatchError
162  for (Index tIndex = 0; tIndex < mCallbackFuncs.ItemCount(); ++tIndex)
163  callbackFunc(mCallbackFuncs[tIndex]);
164  CatchError
165 }
166 
167 
169 
170 
171 
172 #endif // SingleVarTabuDoCallbackHppIncluded
xb< Variable * > const & TabuUpdates() const
Get the updated variables.
Definition: singleVarTabuDoCallback.hpp:119
SingleVarTabuDoCallback & operator=(SingleVarTabuDoCallback &&that) noexcept=delete
Copy assignment.
Functions that depend on other expressions.
Definition: function0.hpp:31
SingleVarTabuDoCallback SvTabuDoCall
Shortcut for SingleVarTabuDoCallback.
Definition: singleVarTabuDoCallback.hpp:85
void setTabuModel(Identifier const pModel)
Set tabu model.
Definition: tabubase1.hpp:65
static void callbackFunc(Function *const pFunction)
Call back a function for tabu update.
Definition: tabubase1.hpp:190
#define openKangarooSpace
Open the project namespace.
Definition: project.hpp:74
virtual void adjustMemAuto() override
Adjust memory automatically.
Definition: singleVarTabu.hpp:197
xb< Function * > mCallbackFuncs
Functions requiring updates.
Definition: singleVarTabuDoCallback.hpp:78
Single variable tabu family.
void registerCallbackFunc(Function *const pFunction)
Register a function.
Definition: singleVarTabuDoCallback.hpp:145
SingleVarTabuDoCallback(System *const pSystem)
Param constructor.
Definition: singleVarTabuDoCallback.hpp:93
Index for Library Frames.
Unique identifier of a class.
void setCallback(Bool const SetNotUnset)
Set callback support.
Definition: tabubase1.hpp:29
virtual void adjustMemAuto() override
Adjust memory automatically.
Definition: singleVarTabuDoCallback.hpp:131
Single variable tabu with callbacks.
Definition: singleVarTabuDoCallback.hpp:34
xb< Variable * > mTabuUpdates
The variables with new status.
Definition: singleVarTabuDoCallback.hpp:79
Constraint-based local search systems.
Definition: system0.hpp:45
void callbackFuncs()
Call back functions.
Definition: singleVarTabuDoCallback.hpp:159
#define closeKangarooSpace
Close the project namespace.
Definition: project.hpp:75
~SingleVarTabuDoCallback()
Destructor.
Definition: singleVarTabuDoCallback.hpp:107
Single variable tabu family.
Definition: singleVarTabu.hpp:30