61 using Traits = TraitsT;
62 using Scalar =
typename TraitsT::Scalar;
63 enum { numPhases = 2 };
69 using LETParams =
typename LETTwoPhaseLaw::Params;
72 template <
class ParamT>
75 inline void operator () (
void* ptr )
77 delete static_cast< ParamT*
> (ptr);
81 using ParamPointerType = std::shared_ptr<void>;
95 setApproach( other.approach() );
101 setApproach( other.approach() );
105 void setApproach(SatCurveMultiplexerApproach newApproach)
107 assert(realParams_ == 0);
108 approach_ = newApproach;
110 switch (approach()) {
111 case SatCurveMultiplexerApproach::LET:
112 realParams_ = ParamPointerType(
new LETParams, Deleter< LETParams > () );
115 case SatCurveMultiplexerApproach::PiecewiseLinear:
116 realParams_ = ParamPointerType(
new PLParams, Deleter< PLParams > () );
121 SatCurveMultiplexerApproach approach()
const
122 {
return approach_; }
125 template <SatCurveMultiplexerApproach approachV>
126 typename std::enable_if<approachV == SatCurveMultiplexerApproach::LET, LETParams>::type&
129 assert(approach() == approachV);
130 return this->
template castTo<LETParams>();
133 template <SatCurveMultiplexerApproach approachV>
134 typename std::enable_if<approachV == SatCurveMultiplexerApproach::LET, const LETParams>::type&
135 getRealParams()
const
137 assert(approach() == approachV);
138 return this->
template castTo<LETParams>();
142 template <SatCurveMultiplexerApproach approachV>
143 typename std::enable_if<approachV == SatCurveMultiplexerApproach::PiecewiseLinear, PLParams>::type&
146 assert(approach() == approachV);
147 return this->
template castTo<PLParams>();
150 template <SatCurveMultiplexerApproach approachV>
151 typename std::enable_if<approachV == SatCurveMultiplexerApproach::PiecewiseLinear, const PLParams>::type&
152 getRealParams()
const
154 assert(approach() == approachV);
155 return this->
template castTo<PLParams>();
158 template<
class Serializer>
159 void serializeOp(Serializer& serializer)
161 switch (approach()) {
162 case SatCurveMultiplexerApproach::LET:
163 serializer(castTo<LETParams>());
166 case SatCurveMultiplexerApproach::PiecewiseLinear:
167 serializer(castTo<PLParams>());
173 template <
class ParamT>
176 return *(
static_cast<ParamT *
> (realParams_.operator->()));
179 template <
class ParamT>
180 const ParamT& castTo()
const
182 return *(
static_cast<const ParamT *
> (realParams_.operator->()));
185 SatCurveMultiplexerApproach approach_;
186 ParamPointerType realParams_;
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30