Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
common-services.cpp
Go to the documentation of this file.
1/*
2 CommonServices - integrate some library facilities with common system services
3
4 Copyright (C)
5 2012, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12* *****************************************************************/
13
14
39#include "lib/error.hpp"
40#include "lib/format-string.hpp"
41
42namespace error = lumiera::error;
43
44
45
46/* =========== Advice System integrations ================== */
47
50#include "lib/time/timecode.hpp"
51#include "lib/time/mutation.hpp"
52#include "common/advice.hpp"
53
54
55namespace lib {
56namespace time {
57
58 namespace { // implementation helper to access the Advice system...
59
60 using util::_Fmt;
61
62 namespace advice = lumiera::advice;
63
64
65 PQuant
67 {
68 advice::Request<PQuant> query(gridID);
69 PQuant grid_found = query.getAdvice();
70 if (!grid_found)
71 throw error::Logic (_Fmt("unable to resolve the time quantisation grid with ID=\"%s\" -- was it already defined?")
72 % gridID
73 , LUMIERA_ERROR_UNKNOWN_GRID);
74 return grid_found;
75 }
76 }//(End) implementation helpers
77
78
87 : Time(raw)
88 , quantiser_(retrieveQuantiser (gridID))
89 { }
90
91
96 PQuant
98 {
99 return retrieveQuantiser (gridID);
100 }
101
111 {
112 return Quantiser::retrieve(gridID)->gridPoint (time);
113 }
114
115
116
124 Mutation::nudge (int adjustment, Symbol gridID)
125 {
126 return nudge (adjustment, Quantiser::retrieve(gridID));
127 }
128
129
130
131}} // namespace lib::time
Expecting Advice and giving Advice: a cross-cutting collaboration of loosely coupled participants.
Template to build polymorphic value objects.
Token or Atom with distinct identity.
Definition symbol.hpp:120
static FrameCnt quant(Time const &, Symbol gridID)
convenience shortcut: time grid to frame number
static EncapsulatedMutation nudge(int adjustment)
build a time mutation to nudge the target time value by an offset, defined as number of steps on an i...
Definition mutation.cpp:336
QuTime(TimeValue raw, Symbol gridID)
build a quantised time value, referring the time grid by-name.
static PQuant retrieve(Symbol gridID)
Access an existing grid definition or quantiser, known by the given symbolic ID.
basic constant internal time value.
Lumiera's internal time value datatype.
Access point for the advised entity (client).
Definition advice.hpp:430
AD const & getAdvice() const
Definition advice.hpp:460
A front-end for using printf-style formatting.
Lumiera error handling (C++ interface).
Front-end for printf-style string template interpolation.
Modifying time and timecode values.
int64_t FrameCnt
relative framecount or frame number.
Definition digxel.hpp:310
std::shared_ptr< const Quantiser > PQuant
Definition formats.hpp:58
Implementation namespace for support and library code.
LumieraError< LERR_(LOGIC)> Logic
Definition error.hpp:207
Library functions to support the formation of grid-aligned time values.
Timecode handling library This header defines the foundation interface TCode to represent a grid alig...
Support library to represent grid-aligned time specifications This is part of Lumiera's time and time...