28 template<
typename MatrixType>
49 void from(
const Eigen::Ref<const MatrixType> &
from);
51 void to(
const Eigen::Ref<MatrixType> &);
72 static void srun(
void * ca);
75 static void sdelete(
void * ca);
78 static void sfrom(
void * ca,
const typename T::SourceType & f);
81 static void sto(
void * ca,
const Eigen::Ref<MatrixType> &
from);
84 static void * sclone(
void * ca);
87 std::unique_ptr<void, void (*)(
void *)> ca_;
93 void (*fromd_)(
void *,
const double &);
97 void (*fromm_)(
void *,
const Eigen::Ref<const MatrixType> &);
99 void (*to_)(
void *,
const Eigen::Ref<MatrixType> &);
101 void * (*clone_)(
void *);
104 template<
typename MatrixType>
107 {
static_cast<T *
>(ca)->run(); }
109 template<
typename MatrixType>
111 inline void CompiledAssignmentWrapper<MatrixType>::sdelete(
void * ca)
112 {
delete static_cast<T *
>(ca); }
114 template<
typename MatrixType>
116 inline void CompiledAssignmentWrapper<MatrixType>::sfrom(
void * ca,
const typename T::SourceType & f)
117 {
static_cast<T *
>(ca)->from(f); }
119 template<
typename MatrixType>
121 inline void CompiledAssignmentWrapper<MatrixType>::sto(
void * ca,
const Eigen::Ref<MatrixType> & t)
122 {
static_cast<T *
>(ca)->to(t); }
124 template<
typename MatrixType>
126 inline void * CompiledAssignmentWrapper<MatrixType>::sclone(
void * ca)
127 {
return new T(*
static_cast<T *
>(ca)); }
129 template<
typename MatrixType>
138 w.fromd_ = &sfrom<CA>;
144 w.fromm_ = &sfrom<CA>;
147 w.clone_ = sclone<CA>;
148 w.ca_.reset(
new CA(std::forward<Args>(args)...));
152 template<
typename MatrixType>
154 : ca_(nullptr, nullptr), run_(nullptr), fromd_(nullptr), fromm_(nullptr), to_(nullptr), clone_(nullptr)
157 template<
typename MatrixType>
159 : ca_(nullptr, deleter), run_(nullptr), fromd_(nullptr), fromm_(nullptr), to_(nullptr), clone_(nullptr)
162 template<
typename MatrixType>
164 : ca_(other.clone_(other.ca_.get()), other.ca_.get_deleter()), run_(other.run_), fromd_(other.fromd_),
165 fromm_(other.fromm_), to_(other.to_), clone_(other.clone_)
168 template<
typename MatrixType>
172 ca_.reset(other.clone_(other.ca_.get()));
173 ca_.get_deleter() = other.ca_.get_deleter();
175 fromd_ = other.fromd_;
176 fromm_ = other.fromm_;
178 clone_ = other.clone_;
183 template<
typename MatrixType>
187 template<
typename MatrixType>
192 fromd_(ca_.get(), d);
196 throw std::runtime_error(
197 "Method from(double) is invalid for this assignment, try from(const Eigen::Ref<const MatrixType>&) instead");
201 template<
typename MatrixType>
206 fromm_(ca_.get(), f);
210 throw std::runtime_error(
211 "Method from(const Eigen::Ref<const MatrixType>&) is invalid for this assignment, try from(double) instead");
215 template<
typename MatrixType>
217 { to_(ca_.get(), t); }
Definition: CompiledAssignmentWrapper.h:30
CompiledAssignmentWrapper & operator=(CompiledAssignmentWrapper &&)=default
void from(double)
Definition: CompiledAssignmentWrapper.h:188
CompiledAssignmentWrapper(CompiledAssignmentWrapper &&)=default
void from(const Eigen::Ref< const MatrixType > &from)
Definition: CompiledAssignmentWrapper.h:202
~CompiledAssignmentWrapper()=default
void run()
Definition: CompiledAssignmentWrapper.h:184
CompiledAssignmentWrapper(const CompiledAssignmentWrapper &)
Definition: CompiledAssignmentWrapper.h:163
void to(const Eigen::Ref< MatrixType > &)
Definition: CompiledAssignmentWrapper.h:216
CompiledAssignmentWrapper & operator=(const CompiledAssignmentWrapper &)
Definition: CompiledAssignmentWrapper.h:169
static CompiledAssignmentWrapper make(Args &&... args)
CompiledAssignmentWrapper()
Definition: CompiledAssignmentWrapper.h:153
Definition: CompiledAssignment.h:598
Source
Definition: CompiledAssignment.h:65
@ CONSTANT
Definition: CompiledAssignment.h:71
@ EXTERNAL
Definition: CompiledAssignment.h:67
WeightMult
Definition: CompiledAssignment.h:34
AssignType
Definition: CompiledAssignment.h:22
MatrixMult
Definition: CompiledAssignment.h:45