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 >* > >&
42 ScheduleOperation< GUM_SCALAR >(
43 ScheduleOperation< GUM_SCALAR >::Type::SEPARATOR_STORE_MULTIDIM),
44 table__(table), tableSet__(&separator_tables), separator__(separator),
47 GUM_CONSTRUCTOR(ScheduleSeparatorStoreMultiDim);
51 template <
typename GUM_SCALAR >
52 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::ScheduleSeparatorStoreMultiDim(
53 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& from) :
54 ScheduleOperation< GUM_SCALAR >(from),
55 table__(from.table__), tableSet__(from.tableSet__),
56 separator__(from.separator__), args__(0) {
58 GUM_CONS_CPY(ScheduleSeparatorStoreMultiDim);
62 template <
typename GUM_SCALAR >
63 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >*
64 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::newFactory()
const {
65 return new ScheduleSeparatorStoreMultiDim< GUM_SCALAR >(*
this);
69 template <
typename GUM_SCALAR >
70 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::~ScheduleSeparatorStoreMultiDim() {
72 GUM_DESTRUCTOR(ScheduleSeparatorStoreMultiDim);
74 if (args__)
delete args__;
78 template <
typename GUM_SCALAR >
79 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >&
80 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::operator=(
81 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& from) {
84 ScheduleOperation< GUM_SCALAR >::operator=(from);
85 table__ = from.table__;
86 tableSet__ = from.tableSet__;
87 separator__ = from.separator__;
91 args__->insert(&table__);
99 template <
typename GUM_SCALAR >
100 bool ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::operator==(
101 const ScheduleOperation< GUM_SCALAR >& op)
const {
102 if (
this->type() != op.type())
return false;
104 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& real_op
105 =
static_cast<
const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& >(op);
106 return ((table__ == real_op.table__) && (tableSet__ == real_op.tableSet__)
107 && (separator__ == real_op.separator__));
111 template <
typename GUM_SCALAR >
112 bool ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::operator!=(
113 const ScheduleOperation< GUM_SCALAR >& op)
const {
114 if (
this->type() != op.type())
return true;
116 const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& real_op
117 =
static_cast<
const ScheduleSeparatorStoreMultiDim< GUM_SCALAR >& >(op);
118 return ((table__ != real_op.table__) || (tableSet__ != real_op.tableSet__)
119 || (separator__ != real_op.separator__));
123 template <
typename GUM_SCALAR >
124 void ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::execute() {
125 const MultiDimImplementation< GUM_SCALAR >& multidim = table__.multiDim();
127 if (!tableSet__->exists(separator__)) {
128 tableSet__->insert(separator__,
129 Set<
const MultiDimImplementation< GUM_SCALAR >* >());
132 tableSet__->operator[](separator__).insert(&multidim);
137 template <
typename GUM_SCALAR >
138 INLINE
float ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::nbOperations()
const {
143 template <
typename GUM_SCALAR >
144 INLINE std::pair<
long,
long >
145 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::memoryUsage()
const {
146 return std::pair<
long,
long >(0, 0);
150 template <
typename GUM_SCALAR >
151 INLINE
const Sequence<
const ScheduleMultiDim< GUM_SCALAR >* >&
152 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::multiDimArgs()
const {
154 args__ =
new Sequence<
const ScheduleMultiDim< GUM_SCALAR >* >;
155 args__->insert(&table__);
162 template <
typename GUM_SCALAR >
163 INLINE
const Sequence<
const ScheduleMultiDim< GUM_SCALAR >* >&
164 ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::multiDimResults()
const {
165 static Sequence<
const ScheduleMultiDim< GUM_SCALAR >* > empty_seq;
166 # ifdef GUM_DEBUG_MODE 170 static bool first_time =
true;
174 __debug__::inc_deletion__(
"Sequence",
179 __debug__::inc_deletion__(
"SequenceImplementation",
191 template <
typename GUM_SCALAR >
192 std::string ScheduleSeparatorStoreMultiDim< GUM_SCALAR >::toString()
const {
194 s <<
"store ( " << table__.toString() <<
", separator " << separator__ <<
" )";