29 #ifndef DOXYGEN_SHOULD_SKIP_THIS 37 template <
typename GUM_SCALAR >
39 const ScheduleMultiDim< GUM_SCALAR >& table,
40 const Set< const DiscreteVariable* >& del_vars,
41 MultiDimImplementation< GUM_SCALAR >* (*project)(
42 const MultiDimImplementation< GUM_SCALAR >&,
43 const Set< const DiscreteVariable* >&)) :
44 ScheduleOperation< GUM_SCALAR >(
45 ScheduleOperation< GUM_SCALAR >::Type::PROJECT_MULTIDIM),
46 __table(table), __del_vars(del_vars), __args(0), __results(0),
52 Sequence< const DiscreteVariable* > vars =
__table.variablesSequence();
54 for (
const auto var : del_vars)
59 __result =
new ScheduleMultiDim< GUM_SCALAR >(vars);
63 template <
typename GUM_SCALAR >
65 const ScheduleProject< GUM_SCALAR >& f) :
75 template <
typename GUM_SCALAR >
76 ScheduleProject< GUM_SCALAR >*
78 return new ScheduleProject< GUM_SCALAR >(*this);
82 template <
typename GUM_SCALAR >
94 template <
typename GUM_SCALAR >
96 operator=(
const ScheduleProject< GUM_SCALAR >& from) {
121 template <
typename GUM_SCALAR >
123 operator==(
const ScheduleOperation< GUM_SCALAR >& op)
const {
124 if (this->
type() != op.type())
return false;
126 const ScheduleProject< GUM_SCALAR >& real_op =
127 static_cast< const ScheduleProject< GUM_SCALAR >&
>(op);
133 template <
typename GUM_SCALAR >
135 operator!=(
const ScheduleOperation< GUM_SCALAR >& op)
const {
136 if (this->
type() != op.type())
return true;
138 const ScheduleProject< GUM_SCALAR >& real_op =
139 static_cast< const ScheduleProject< GUM_SCALAR >&
>(op);
145 template <
typename GUM_SCALAR >
148 const MultiDimImplementation< GUM_SCALAR >& t =
__table.multiDim();
156 template <
typename GUM_SCALAR >
158 return float(
__table.domainSize());
162 template <
typename GUM_SCALAR >
165 const Sequence< const DiscreteVariable* >& seq =
__table.variablesSequence();
167 for (
const auto var : seq)
169 if (std::numeric_limits< long >::max() / (long)var->domainSize() < size) {
170 GUM_ERROR(OutOfBounds,
"memory usage out of long int range");
173 size *= long(var->domainSize());
176 return std::pair< long, long >(size, size);
180 template <
typename GUM_SCALAR >
181 INLINE
const ScheduleMultiDim< GUM_SCALAR >&
187 template <
typename GUM_SCALAR >
188 INLINE
const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >&
191 __args =
new Sequence< const ScheduleMultiDim< GUM_SCALAR >* >;
199 template <
typename GUM_SCALAR >
200 INLINE
const Sequence< const ScheduleMultiDim< GUM_SCALAR >* >&
203 __results =
new Sequence< const ScheduleMultiDim< GUM_SCALAR >* >;
211 template <
typename GUM_SCALAR >
213 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
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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)