2024-02-03 22:02:01 +01:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
|
|
|
|
@file include/xpr/xpr_base.cc.h
|
|
|
|
@brief Xpression base template implementations.
|
|
|
|
|
|
|
|
Copyright (c) 2024 Christian Zimmermann. All rights reserved.
|
|
|
|
Mail: chizeta@f3l.de
|
|
|
|
|
|
|
|
**/
|
2022-10-13 19:12:23 +02:00
|
|
|
|
|
|
|
#ifndef __cxz_xpr_base_cc_h__
|
|
|
|
#define __cxz_xpr_base_cc_h__
|
|
|
|
|
|
|
|
#include "xpr_base.h"
|
|
|
|
|
|
|
|
namespace CNORXZ
|
|
|
|
{
|
|
|
|
|
|
|
|
/************
|
|
|
|
* VXpr *
|
|
|
|
************/
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T, class Xpr>
|
|
|
|
VXpr<T,Xpr>::VXpr(const XprInterface<Xpr>& a) :
|
2022-10-13 19:12:23 +02:00
|
|
|
Xpr(a.THIS())
|
|
|
|
{}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T, class Xpr>
|
|
|
|
Uptr<VXprBase<T>> VXpr<T,Xpr>::copy() const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2022-10-23 18:29:07 +02:00
|
|
|
return std::make_unique<VXpr<T,Xpr>>(*this);
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T, class Xpr>
|
|
|
|
T VXpr<T,Xpr>::vexec(const DPos& last) const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2023-11-19 19:17:55 +01:00
|
|
|
return (*this)(last);
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T, class Xpr>
|
|
|
|
T VXpr<T,Xpr>::vexec() const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2023-11-19 18:43:42 +01:00
|
|
|
return (*this)();
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T, class Xpr>
|
|
|
|
DPos VXpr<T,Xpr>::vrootSteps(const IndexId<0>& id) const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2022-10-16 23:05:48 +02:00
|
|
|
return DPos(this->rootSteps(id));
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/************
|
|
|
|
* DXpr *
|
|
|
|
************/
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T>
|
2022-10-13 19:12:23 +02:00
|
|
|
template <class Xpr>
|
2022-10-23 18:29:07 +02:00
|
|
|
DXpr<T>::DXpr(const Xpr& a) :
|
|
|
|
ObjHandle<VXprBase<T>>(std::make_unique<VXpr<T,Xpr>>(a))
|
2022-10-13 19:12:23 +02:00
|
|
|
{}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T>
|
|
|
|
inline T DXpr<T>::operator()(const DPos& last) const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2022-10-23 18:29:07 +02:00
|
|
|
return VB::mC->vexec(last);
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T>
|
|
|
|
inline T DXpr<T>::operator()() const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2022-10-23 18:29:07 +02:00
|
|
|
return VB::mC->vexec();
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
|
2022-10-23 18:29:07 +02:00
|
|
|
template <typename T>
|
2022-10-16 18:37:14 +02:00
|
|
|
template <SizeT I>
|
2022-10-23 18:29:07 +02:00
|
|
|
inline DPos DXpr<T>::rootSteps(const IndexId<I>& id) const
|
2022-10-13 19:12:23 +02:00
|
|
|
{
|
2022-10-23 18:29:07 +02:00
|
|
|
return VB::mC->vrootSteps(IndexId<0>(id.id()));
|
2022-10-13 19:12:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|