26 #ifndef DOXYGEN_SHOULD_SKIP_THIS 34 template <
typename GUM_SCALAR >
36 const ScheduleMultiDim< GUM_SCALAR >& table,
37 const Set< const DiscreteVariable* >& del_vars,
38 MultiDimImplementation< GUM_SCALAR >* (*project)(
39 const MultiDimImplementation< GUM_SCALAR >&,
40 const Set< const DiscreteVariable* >&)) :
41 ScheduleOperation< GUM_SCALAR >(
42 ScheduleOperation< GUM_SCALAR >::Type::PROJECT_MULTIDIM),
43 __table(table), __del_vars(del_vars), __args(0), __results(0),
49 Sequence< const DiscreteVariable* > vars =
__table.variablesSequence();
51 for (
const auto var : del_vars)
56 __result =
new ScheduleMultiDim< GUM_SCALAR >(vars);
60 template <
typename GUM_SCALAR >
62 const ScheduleProject< GUM_SCALAR >& f) :
72 template <
typename GUM_SCALAR >
73 ScheduleProject< GUM_SCALAR >*
75 return new ScheduleProject< GUM_SCALAR >(*this);
79 template <
typename GUM_SCALAR >
91 template <
typename GUM_SCALAR >
93 operator=(
const ScheduleProject< GUM_SCALAR >& from) {
118 template <
typename GUM_SCALAR >
120 operator==(
const ScheduleOperation< GUM_SCALAR >& op)
const {
121 if (this->
type() != op.type())
return false;
123 const ScheduleProject< GUM_SCALAR >& real_op =
124 static_cast< const ScheduleProject< GUM_SCALAR >&
>(op);
130 template <
typename GUM_SCALAR >
132 operator!=(
const ScheduleOperation< GUM_SCALAR >& op)
const {
133 if (this->
type() != op.type())
return true;
135 const ScheduleProject< GUM_SCALAR >& real_op =
136 static_cast< const ScheduleProject< GUM_SCALAR >&
>(op);
142 template <
typename GUM_SCALAR >
145 const MultiDimImplementation< GUM_SCALAR >& t =
__table.multiDim();
153 template <
typename GUM_SCALAR >
155 return float(
__table.domainSize());
159 template <
typename GUM_SCALAR >
162 const Sequence< const DiscreteVariable* >& seq =
__table.variablesSequence();
164 for (
const auto var : seq)
166 if (std::numeric_limits< long >::max() / (long)var->domainSize() < size) {
167 GUM_ERROR(OutOfBounds,
"memory usage out of long int range");
170 size *= long(var->domainSize());
173 return std::pair< long, long >(size, size);
177 template <
typename GUM_SCALAR >
178 INLINE
const ScheduleMultiDim< GUM_SCALAR >&
184 template <
typename GUM_SCALAR >
185 INLINE
const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >&
188 __args =
new Sequence< const ScheduleMultiDim< GUM_SCALAR >* >;
196 template <
typename GUM_SCALAR >
197 INLINE
const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >&
200 __results =
new Sequence< const ScheduleMultiDim< GUM_SCALAR >* >;
208 template <
typename GUM_SCALAR >
210 return __result->toString() +
" = project ( " +
__table.toString() +
" , " virtual ScheduleProject< GUM_SCALAR > * newFactory() const
virtual copy constructor: creates a clone of the operation
const ScheduleMultiDim< GUM_SCALAR > & result() const
returns the scheduleMultidim resulting from the execution of the operation
Type type() const
returns the name of the operation
std::pair< long, long > memoryUsage() const
returns the memory consumption used during the operation
float nbOperations() const
returns an estimation of the number of elementary operations needed to perform the ScheduleOperation ...
ScheduleMultiDim< GUM_SCALAR > __table
gum is the global namespace for all aGrUM entities
void execute()
executes the operation
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimArgs() const
returns the set of multidims passed in argument to the operation
bool operator!=(const ScheduleOperation< GUM_SCALAR > &) const
operator !=
ScheduleMultiDim< GUM_SCALAR > * __result
the result of the operation
Sequence< const ScheduleMultiDim< GUM_SCALAR > *> * __results
the set of ScheduleMultidims resulting from the operation
virtual ~ScheduleProject()
destructor
std::string toString() const
displays the content of the operation
const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimResults() const
returns the set of multidims that should be the result of the operation
ScheduleOperation(Type t)
default constructor
ScheduleOperation< GUM_SCALAR > & operator=(const ScheduleOperation< GUM_SCALAR > &)
copy operator
bool operator==(const ScheduleOperation< GUM_SCALAR > &) const
operator ==
ScheduleProject(const ScheduleMultiDim< GUM_SCALAR > &table, const Set< const DiscreteVariable * > &del_vars, MultiDimImplementation< GUM_SCALAR > *(*project)(const MultiDimImplementation< GUM_SCALAR > &, const Set< const DiscreteVariable * > &))
default constructor
ScheduleProject< GUM_SCALAR > & operator=(const ScheduleProject< GUM_SCALAR > &)
copy operator
Set< const DiscreteVariable *> __del_vars
Sequence< const ScheduleMultiDim< GUM_SCALAR > *> * __args
the set of ScheduleMultidims passed in arguments
MultiDimImplementation< GUM_SCALAR > *(* __project)(const MultiDimImplementation< GUM_SCALAR > &, const Set< const DiscreteVariable * > &)
the projection operator
#define GUM_ERROR(type, msg)