49#ifndef DOXYGEN_SHOULD_SKIP_THIS
59 template <
typename TABLE >
67 GUM_CONSTRUCTOR(ScheduleDeletion);
71 template <
typename TABLE >
72 ScheduleDeletion< TABLE >::ScheduleDeletion(
const ScheduleDeletion< TABLE >& from) :
73 ScheduleOperator(from), _arg_(from._arg_), _is_executed_(from._is_executed_) {
78 GUM_CONS_CPY(ScheduleDeletion);
82 template <
typename TABLE >
83 ScheduleDeletion< TABLE >::ScheduleDeletion(ScheduleDeletion< TABLE >&& from) :
84 ScheduleOperator(
std::move(from)), _arg_(from._arg_), _is_executed_(from._is_executed_) {
86 _args_ = std::move(from._args_);
89 GUM_CONS_MOV(ScheduleDeletion);
93 template <
typename TABLE >
94 INLINE ScheduleDeletion< TABLE >* ScheduleDeletion< TABLE >::clone()
const {
95 return new ScheduleDeletion< TABLE >(*
this);
99 template <
typename TABLE >
100 ScheduleDeletion< TABLE >::~ScheduleDeletion() {
102 GUM_DESTRUCTOR(ScheduleDeletion);
106 template <
typename TABLE >
107 ScheduleDeletion< TABLE >&
108 ScheduleDeletion< TABLE >::operator=(
const ScheduleDeletion< TABLE >& from) {
112 _is_executed_ = from._is_executed_;
113 ScheduleOperator::operator=(from);
118 template <
typename TABLE >
119 ScheduleDeletion< TABLE >&
120 ScheduleDeletion< TABLE >::operator=(ScheduleDeletion< TABLE >&& from) {
122 _args_ = std::move(from._args_);
123 _is_executed_ = from._is_executed_;
124 ScheduleOperator::operator=(std::move(from));
129 template <
typename TABLE >
130 INLINE
bool ScheduleDeletion< TABLE >::operator==(
const ScheduleDeletion< TABLE >& op)
const {
131 return (*_arg_ == *op._arg_);
135 template <
typename TABLE >
136 bool ScheduleDeletion< TABLE >::operator==(
const ScheduleOperator& op)
const {
138 const ScheduleDeletion< TABLE >& real_op
139 =
dynamic_cast< const ScheduleDeletion< TABLE >&
>(op);
140 return ScheduleDeletion< TABLE >::operator==(real_op);
141 }
catch (std::bad_cast&) {
return false; }
145 template <
typename TABLE >
146 INLINE
bool ScheduleDeletion< TABLE >::operator!=(
const ScheduleDeletion< TABLE >& op)
const {
147 return !ScheduleDeletion< TABLE >::operator==(op);
151 template <
typename TABLE >
152 INLINE
bool ScheduleDeletion< TABLE >::operator!=(
const ScheduleOperator& op)
const {
153 return !ScheduleDeletion< TABLE >::operator==(op);
157 template <
typename TABLE >
159 ScheduleDeletion< TABLE >::hasSimilarArguments(
const ScheduleDeletion< TABLE >& op)
const {
160 return _arg_->hasSameVariables(*op._arg_);
164 template <
typename TABLE >
165 bool ScheduleDeletion< TABLE >::hasSimilarArguments(
const ScheduleOperator& op)
const {
167 const ScheduleDeletion< TABLE >& real_op
168 =
dynamic_cast< const ScheduleDeletion< TABLE >&
>(op);
169 return ScheduleDeletion< TABLE >::hasSimilarArguments(real_op);
170 }
catch (std::bad_cast&) {
return false; }
174 template <
typename TABLE >
176 ScheduleDeletion< TABLE >::hasSameArguments(
const ScheduleDeletion< TABLE >& op)
const {
177 return _arg_->hasSameVariables(*op._arg_) && _arg_->hasSameContent(*op._arg_);
181 template <
typename TABLE >
182 bool ScheduleDeletion< TABLE >::hasSameArguments(
const ScheduleOperator& op)
const {
184 const ScheduleDeletion< TABLE >& real_op
185 =
dynamic_cast< const ScheduleDeletion< TABLE >&
>(op);
186 return ScheduleDeletion< TABLE >::hasSameArguments(real_op);
187 }
catch (std::bad_cast&) {
return false; }
191 template <
typename TABLE >
192 INLINE
bool ScheduleDeletion< TABLE >::isSameOperator(
const ScheduleDeletion< TABLE >& op)
const {
197 template <
typename TABLE >
198 bool ScheduleDeletion< TABLE >::isSameOperator(
const ScheduleOperator& op)
const {
200 const ScheduleDeletion< TABLE >& real_op
201 =
dynamic_cast< const ScheduleDeletion< TABLE >&
>(op);
202 return ScheduleDeletion< TABLE >::isSameOperator(real_op);
203 }
catch (std::bad_cast&) {
return false; }
207 template <
typename TABLE >
208 INLINE
const ScheduleMultiDim< TABLE >& ScheduleDeletion< TABLE >::arg()
const {
213 template <
typename TABLE >
214 INLINE
const Sequence< const IScheduleMultiDim* >& ScheduleDeletion< TABLE >::args()
const {
219 template <
typename TABLE >
220 INLINE
const Sequence< const IScheduleMultiDim* >& ScheduleDeletion< TABLE >::results()
const {
225 template <
typename TABLE >
226 void ScheduleDeletion< TABLE >::updateArgs(
const Sequence< const IScheduleMultiDim* >& new_args) {
229 if (new_args.size() != Size(1)) {
231 "Method ScheduleDeletion::updateArgs expects 1 new "
232 <<
"argument, but " << new_args.size() <<
" were passed.");
234 const ScheduleMultiDim< TABLE >* arg;
236 arg =
dynamic_cast< const ScheduleMultiDim< TABLE >*
>(new_args[0]);
237 }
catch (std::bad_cast&) {
239 "The type of the argument passed to "
240 <<
"ScheduleDeletion::updateArgs does not match what "
241 <<
"the ScheduleOperator expects");
245 _arg_ = (ScheduleMultiDim< TABLE >*)arg;
248 _is_executed_ =
false;
252 template <
typename TABLE >
253 INLINE
bool ScheduleDeletion< TABLE >::isExecuted()
const {
254 return _is_executed_;
258 template <
typename TABLE >
259 INLINE
void ScheduleDeletion< TABLE >::execute() {
260 _arg_->makeAbstract();
261 _is_executed_ =
true;
265 template <
typename TABLE >
266 void ScheduleDeletion< TABLE >::undo() {
272 template <
typename TABLE >
273 INLINE
double ScheduleDeletion< TABLE >::nbOperations()
const {
278 template <
typename TABLE >
279 INLINE std::pair< double, double > ScheduleDeletion< TABLE >::memoryUsage()
const {
280 const double size_table =
double(_arg_->domainSize()) * _arg_->sizeOfContent() +
sizeof(TABLE);
281 return {-size_table, -size_table};
285 template <
typename TABLE >
286 std::string ScheduleDeletion< TABLE >::toString()
const {
287 return "delete ( " + _arg_->toString() +
" )";
Exception : operation not allowed.
a Wrapper for multi-dimensional tables used for scheduling inferences
the base class for "low-level" operators used to schedule inferences
Exception : problem with size.
Exception : wrong type for this operation.
#define GUM_ERROR(type, msg)
gum is the global namespace for all aGrUM entities
ScheduleOperatorType
the currently supported types of "low-level" operators
@ DELETE_MULTIDIM
remove from memory a multidimensional table stored in a ScheduleMultiDim
an operator to force a ScheduleMultiDim to be abstract