mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Adds a couple of TODOs and some further documentation.
This commit is contained in:
parent
77b241af4f
commit
417ece2386
@ -29,15 +29,30 @@
|
|||||||
If the held object is a subclass of ClockingHint::Source, this template will register as an
|
If the held object is a subclass of ClockingHint::Source, this template will register as an
|
||||||
observer and potentially stop clocking or stop delaying clocking until just-in-time references
|
observer and potentially stop clocking or stop delaying clocking until just-in-time references
|
||||||
as directed.
|
as directed.
|
||||||
|
|
||||||
|
TODO: can TargetTimeScale be inferred from the argument type of T::run_for?
|
||||||
|
|
||||||
|
TODO: incorporate and codify AsyncJustInTimeActor.
|
||||||
*/
|
*/
|
||||||
template <class T, int multiplier = 1, int divider = 1, class LocalTimeScale = HalfCycles, class TargetTimeScale = LocalTimeScale> class JustInTimeActor:
|
template <class T, int multiplier = 1, int divider = 1, class LocalTimeScale = HalfCycles, class TargetTimeScale = LocalTimeScale> class JustInTimeActor:
|
||||||
public ClockingHint::Observer {
|
public ClockingHint::Observer {
|
||||||
private:
|
private:
|
||||||
|
/*!
|
||||||
|
A std::unique_ptr deleter which causes an update_sequence_point to occur on the actor supplied
|
||||||
|
to it at construction if it implements get_next_sequence_point(). Otherwise destruction is a no-op.
|
||||||
|
|
||||||
|
**Does not delete the object.**
|
||||||
|
|
||||||
|
This is used by the -> operators below, which provide a unique pointer to the enclosed object and
|
||||||
|
update their sequence points upon its destruction — i.e. after the caller has made whatever call
|
||||||
|
or calls as were relevant to the enclosed object.
|
||||||
|
*/
|
||||||
class SequencePointAwareDeleter {
|
class SequencePointAwareDeleter {
|
||||||
public:
|
public:
|
||||||
explicit SequencePointAwareDeleter(JustInTimeActor<T, multiplier, divider, LocalTimeScale, TargetTimeScale> *actor) : actor_(actor) {}
|
explicit SequencePointAwareDeleter(JustInTimeActor<T, multiplier, divider, LocalTimeScale, TargetTimeScale> *actor) noexcept
|
||||||
|
: actor_(actor) {}
|
||||||
|
|
||||||
void operator ()(const T *const) const {
|
forceinline void operator ()(const T *const) const {
|
||||||
if constexpr (has_sequence_points<T>::value) {
|
if constexpr (has_sequence_points<T>::value) {
|
||||||
actor_->update_sequence_point();
|
actor_->update_sequence_point();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user