28 #ifndef DOXYGEN_SHOULD_SKIP_THIS 30 # include <agrum/agrum.h> 36 template <
typename GUM_SCALAR >
37 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::ScheduleSeparatorStoreMultiDim(
38 const ScheduleMultiDim< GUM_SCALAR >& table,
39 ArcProperty< Set<
const MultiDimImplementation< GUM_SCALAR >* > >& separator_tables,
41 ScheduleOperation< GUM_SCALAR >(
42 ScheduleOperation< GUM_SCALAR >::Type::SEPARATOR_STORE_MULTIDIM),
43 _table_(table), _tableSet_(&separator_tables), _separator_(separator), _args_(0) {
45 GUM_CONSTRUCTOR(ScheduleSeparatorStoreMultiDim);
49 template <
typename GUM_SCALAR >
50 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::ScheduleSeparatorStoreMultiDim(
51 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& from) :
52 ScheduleOperation< GUM_SCALAR >(from),
53 _table_(from._table_), _tableSet_(from._tableSet_), _separator_(from._separator_), _args_(0) {
55 GUM_CONS_CPY(ScheduleSeparatorStoreMultiDim);
59 template <
typename GUM_SCALAR >
60 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >*
61 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::newFactory()
const {
62 return new ScheduleSeparatorStoreMultiDim< GUM_SCALAR >(*
this);
66 template <
typename GUM_SCALAR >
67 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::~ScheduleSeparatorStoreMultiDim() {
69 GUM_DESTRUCTOR(ScheduleSeparatorStoreMultiDim);
71 if (_args_)
delete _args_;
75 template <
typename GUM_SCALAR >
76 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&
77 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::operator=(
78 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& from) {
81 ScheduleOperation< GUM_SCALAR >::operator=(from);
82 _table_ = from._table_;
83 _tableSet_ = from._tableSet_;
84 _separator_ = from._separator_;
88 _args_->insert(&_table_);
96 template <
typename GUM_SCALAR >
97 bool ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::operator==(
98 const ScheduleOperation< GUM_SCALAR >& op)
const {
99 if (
this->type() != op.type())
return false;
101 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& real_op
102 =
static_cast<
const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& >(op);
103 return ((_table_ == real_op._table_) && (_tableSet_ == real_op._tableSet_)
104 && (_separator_ == real_op._separator_));
108 template <
typename GUM_SCALAR >
109 bool ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::operator!=(
110 const ScheduleOperation< GUM_SCALAR >& op)
const {
111 if (
this->type() != op.type())
return true;
113 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& real_op
114 =
static_cast<
const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& >(op);
115 return ((_table_ != real_op._table_) || (_tableSet_ != real_op._tableSet_)
116 || (_separator_ != real_op._separator_));
120 template <
typename GUM_SCALAR >
121 void ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::execute() {
122 const MultiDimImplementation< GUM_SCALAR >& multidim = _table_.multiDim();
124 if (!_tableSet_->exists(_separator_)) {
125 _tableSet_->insert(_separator_, Set<
const MultiDimImplementation< GUM_SCALAR >* >());
128 _tableSet_->operator[](_separator_).insert(&multidim);
133 template <
typename GUM_SCALAR >
134 INLINE
float ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::nbOperations()
const {
139 template <
typename GUM_SCALAR >
140 INLINE std::pair<
long,
long > ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::memoryUsage()
const {
141 return std::pair<
long,
long >(0, 0);
145 template <
typename GUM_SCALAR >
146 INLINE
const Sequence<
const ScheduleMultiDim< GUM_SCALAR >* >&
147 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::multiDimArgs()
const {
149 _args_ =
new Sequence<
const ScheduleMultiDim< GUM_SCALAR >* >;
150 _args_->insert(&_table_);
157 template <
typename GUM_SCALAR >
158 INLINE
const Sequence<
const ScheduleMultiDim< GUM_SCALAR >* >&
159 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::multiDimResults()
const {
160 static Sequence<
const ScheduleMultiDim< GUM_SCALAR >* > empty_seq;
161 # ifdef GUM_DEBUG_MODE 165 static bool first_time =
true;
169 __debug__::_inc_deletion_(
"Sequence", __FILE__, __LINE__,
"destructor of", (
void*)&empty_seq);
170 __debug__::_inc_deletion_(
"SequenceImplementation",
182 template <
typename GUM_SCALAR >
183 std::string ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::toString()
const {
185 s <<
"store ( " << _table_.toString() <<
", separator " << _separator_ <<
" )";