51#ifndef DOXYGEN_SHOULD_SKIP_THIS
61 template <
typename TABLE >
69 GUM_CONSTRUCTOR(ScheduleDeletion);
73 template <
typename TABLE >
74 ScheduleDeletion< TABLE >::ScheduleDeletion(
const ScheduleDeletion< TABLE >& from) :
75 ScheduleOperator(from), _arg_(from._arg_), _is_executed_(from._is_executed_) {
80 GUM_CONS_CPY(ScheduleDeletion);
84 template <
typename TABLE >
85 ScheduleDeletion< TABLE >::ScheduleDeletion(ScheduleDeletion< TABLE >&& from) :
86 ScheduleOperator(
std::move(from)), _arg_(from._arg_), _is_executed_(from._is_executed_) {
88 _args_ = std::move(from._args_);
91 GUM_CONS_MOV(ScheduleDeletion);
95 template <
typename TABLE >
96 ScheduleDeletion< TABLE >* ScheduleDeletion< TABLE >::clone()
const {
97 return new ScheduleDeletion< TABLE >(*
this);
101 template <
typename TABLE >
102 ScheduleDeletion< TABLE >::~ScheduleDeletion() {
104 GUM_DESTRUCTOR(ScheduleDeletion);
108 template <
typename TABLE >
109 ScheduleDeletion< TABLE >&
110 ScheduleDeletion< TABLE >::operator=(
const ScheduleDeletion< TABLE >& from) {
114 _is_executed_ = from._is_executed_;
115 ScheduleOperator::operator=(from);
120 template <
typename TABLE >
121 ScheduleDeletion< TABLE >&
122 ScheduleDeletion< TABLE >::operator=(ScheduleDeletion< TABLE >&& from) {
124 _args_ = std::move(from._args_);
125 _is_executed_ = from._is_executed_;
126 ScheduleOperator::operator=(std::move(from));
131 template <
typename TABLE >
132 bool ScheduleDeletion< TABLE >::operator==(
const ScheduleDeletion< TABLE >& op)
const {
133 return (*_arg_ == *op._arg_);
137 template <
typename TABLE >
138 bool ScheduleDeletion< TABLE >::operator==(
const ScheduleOperator& op)
const {
140 const ScheduleDeletion< TABLE >& real_op
141 =
dynamic_cast< const ScheduleDeletion< TABLE >&
>(op);
142 return ScheduleDeletion< TABLE >::operator==(real_op);
143 }
catch (std::bad_cast&) {
return false; }
147 template <
typename TABLE >
148 bool ScheduleDeletion< TABLE >::operator!=(
const ScheduleDeletion< TABLE >& op)
const {
149 return !ScheduleDeletion< TABLE >::operator==(op);
153 template <
typename TABLE >
154 bool ScheduleDeletion< TABLE >::operator!=(
const ScheduleOperator& op)
const {
155 return !ScheduleDeletion< TABLE >::operator==(op);
159 template <
typename TABLE >
160 bool ScheduleDeletion< TABLE >::hasSimilarArguments(
const ScheduleDeletion< TABLE >& op)
const {
161 return _arg_->hasSameVariables(*op._arg_);
165 template <
typename TABLE >
166 bool ScheduleDeletion< TABLE >::hasSimilarArguments(
const ScheduleOperator& op)
const {
168 const ScheduleDeletion< TABLE >& real_op
169 =
dynamic_cast< const ScheduleDeletion< TABLE >&
>(op);
170 return ScheduleDeletion< TABLE >::hasSimilarArguments(real_op);
171 }
catch (std::bad_cast&) {
return false; }
175 template <
typename TABLE >
176 bool 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 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 const ScheduleMultiDim< TABLE >& ScheduleDeletion< TABLE >::arg()
const {
213 template <
typename TABLE >
214 const Sequence< const IScheduleMultiDim* >& ScheduleDeletion< TABLE >::args()
const {
219 template <
typename TABLE >
220 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 bool ScheduleDeletion< TABLE >::isExecuted()
const {
254 return _is_executed_;
258 template <
typename TABLE >
259 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 double ScheduleDeletion< TABLE >::nbOperations()
const {
278 template <
typename TABLE >
279 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