DynamicOuterOp
This commit is contained in:
parent
4601061934
commit
34161f10cb
2 changed files with 83 additions and 0 deletions
|
@ -40,5 +40,55 @@ namespace MultiArrayTools
|
|||
return std::make_shared<DynamicOperation<T,Operation>>(*this);
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
DynamicOuterOp<T,Operation,Ranges...>::DynamicOuterOp(const Operation& op,
|
||||
const std::shared_ptr<typename Ranges::IndexType>&... inds)
|
||||
: mOp(op)
|
||||
{
|
||||
//...!!!
|
||||
// setup operations
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
OpH<ConstOperationRoot<T,Ranges...>> DynamicOuterOp<T,Operation,Ranges...>::get(const DExtT& pos) const
|
||||
{
|
||||
mOp.get(pos.expl<ET>());
|
||||
//...
|
||||
// execute assignment... care about threads!!!
|
||||
return OpH<ConstOperationRoot<T,Ranges...>>(); // empty
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
DynamicOperationBase<OpH<ConstOperationRoot<T,Ranges...>>>&
|
||||
DynamicOuterOp<T,Operation,Ranges...>::set(const DExtT& pos)
|
||||
{
|
||||
mOp.set(pos.expl<ET>());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
DExtT DynamicOuterOp<T,Operation,Ranges...>::rootSteps(std::intptr_t iPtrNum) const
|
||||
{
|
||||
return DExtT(mkDExt(mkExtT(mOp.rootSteps(iPtrNum))),None(0));
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
DynamicExpression DynamicOuterOp<T,Operation,Ranges...>::loop(const DynamicExpression& exp) const
|
||||
{
|
||||
return mOp.loop(exp);
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
const OpH<ConstOperationRoot<T,Ranges...>>* DynamicOuterOp<T,Operation,Ranges...>::data() const
|
||||
{
|
||||
return &mProto;
|
||||
}
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
std::shared_ptr<DynamicOperationBase<OpH<ConstOperationRoot<T,Ranges...>>>>
|
||||
DynamicOuterOp<T,Operation,Ranges...>::deepCopy() const
|
||||
{
|
||||
return std::make_shared<DynamicOuterOp<T,Operation,Ranges...>>(*this);
|
||||
}
|
||||
|
||||
} // namespace MultiArrayTools
|
||||
|
|
|
@ -58,6 +58,39 @@ namespace MultiArrayTools
|
|||
virtual std::shared_ptr<DynamicOperationBase<T>> deepCopy() const override final;
|
||||
};
|
||||
|
||||
template <class Op>
|
||||
struct OpH
|
||||
{
|
||||
Op mOp;
|
||||
};
|
||||
|
||||
template <typename T, class Operation, class... Ranges>
|
||||
class DynamicOuterOp : public DynamicOperationBase<OpH<ConstOperationRoot<T,Ranges...>>>
|
||||
{
|
||||
private:
|
||||
Operation mOp;
|
||||
//ConstOperationRoot<T,Ranges...> mProto;
|
||||
OpH<ConstOperationRoot<T,Ranges...>> mProto;
|
||||
public:
|
||||
typedef decltype(mOp.rootSteps()) ET;
|
||||
//typedef decltype(std::declval<Operation>().rootSteps()) ET;
|
||||
|
||||
DynamicOuterOp() = default;
|
||||
DynamicOuterOp(const DynamicOuterOp& in) = default;
|
||||
DynamicOuterOp(DynamicOuterOp&& in) = default;
|
||||
DynamicOuterOp& operator=(const DynamicOuterOp& in) = default;
|
||||
DynamicOuterOp& operator=(DynamicOuterOp&& in) = default;
|
||||
|
||||
DynamicOuterOp(const Operation& op, const std::shared_ptr<typename Ranges::IndexType>&... inds);
|
||||
|
||||
virtual OpH<ConstOperationRoot<T,Ranges...>> get(const DExtT& pos) const override final;
|
||||
virtual DynamicOperationBase<OpH<ConstOperationRoot<T,Ranges...>>>& set(const DExtT& pos) override final;
|
||||
virtual DExtT rootSteps(std::intptr_t iPtrNum = 0) const override final;
|
||||
virtual DynamicExpression loop(const DynamicExpression& exp) const override final;
|
||||
virtual const OpH<ConstOperationRoot<T,Ranges...>>* data() const override final;
|
||||
virtual std::shared_ptr<DynamicOperationBase<OpH<ConstOperationRoot<T,Ranges...>>>> deepCopy() const override final;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class DynamicO : public OperationTemplate<T,DynamicO<T>>
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue