Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Scroom::Utils Namespace Reference

Namespaces

namespace  anonymous_namespace{tweak-view.cc}
 
namespace  Detail
 

Classes

class  Base
 
class  Context
 
class  Count
 
class  Counted
 
class  Counter
 
class  ITweakPositionTextBox
 
class  ITweakPresentationPosition
 
class  ITweakRulers
 
class  ITweakSelection
 
class  Observable
 
class  on_scope_exit
 
class  optional_cleanup
 
class  ParentContext
 
class  Point
 
class  ProgressInterfaceBroadcaster
 
class  ProgressInterfaceFromProgressStateInterface
 
class  ProgressInterfaceFromProgressStateInterfaceForwarder
 
class  ProgressInterfaceMultiplexer
 
class  ProgressStateInterface
 
class  ProgressStateInterfaceFromProgressInterface
 
class  ProgressStateInterfaceFromProgressInterfaceForwarder
 
class  Rectangle
 
class  RecursiveContext
 
class  Segment
 
class  SingleContext
 
class  TweakGridSelection
 
class  TweakPixelSelection
 
class  TweakPositionTextBox
 
class  TweakPresentationPosition
 
class  TweakRulers
 
class  TweakSelection
 

Typedefs

using Stuff = std::shared_ptr< void >
 
using StuffWeak = std::weak_ptr< void >
 
using StuffList = std::list< Stuff >
 
template<typename K , typename V >
using WeakKeyMap = std::map< K, V, std::owner_less< K > >
 
template<typename K >
using WeakKeySet = std::set< K, std::owner_less< K > >
 

Functions

ITweakPresentationPosition::Ptr getDefaultTweakPresentationPosition ()
 
ITweakRulers::Ptr getDefaultTweakRulers ()
 
ITweakSelection::Ptr getDefaultTweakSelection ()
 
ITweakSelection::Map getDefaultTweakSelectionMap ()
 
ITweakPositionTextBox::Ptr getDefaultTweakPositionTextBox ()
 
template<typename T >
get (const Context::ConstPtr &context, std::string name)
 
template<typename T >
get (const Context::ConstPtr &context)
 
template<typename T >
std::optional< T > try_get (const Context::ConstPtr &context, std::string name)
 
template<typename T >
std::optional< T > try_get (const Context::ConstPtr &context)
 
template<typename T , typename Callable >
auto get_or (const Context::ConstPtr &context, std::string name, const Callable &default_value) -> std::enable_if_t< std::is_same_v< T, std::remove_reference_t< decltype(default_value())> >, T >
 
template<typename T , typename Callable >
auto get_or (const Context::ConstPtr &context, const Callable &default_value) -> std::enable_if_t< std::is_same_v< T, std::remove_reference_t< decltype(default_value())> >, T >
 
template<typename T >
get_or (const Context::ConstPtr &context, std::string name, T default_value)
 
template<typename T >
get_or (const Context::ConstPtr &context, T default_value)
 
template<typename T >
void set (const Context::Ptr &context, std::string name, T value)
 
template<typename T >
void set (const Context::Ptr &context, T value)
 
template<typename Callable >
void setFactory (const Context::Ptr &context, std::string name, Callable value)
 
template<typename Callable >
void setFactory (const Context::Ptr &context, Callable value)
 
template<typename T >
bool isZero (T v)
 
template<>
bool isZero< int > (int v)
 
template<>
bool isZero< double > (double v)
 
template<typename T >
bool areEqual (T a, T b)
 
template<typename T >
Segment< T > make_segment (T start, T size)
 
template<typename T >
Segment< T > make_segment_from_start_end (T start, T end)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Segment< T > &s)
 
Segment< double > roundOutward (Segment< double > s)
 
template<typename T >
center (Segment< T > s)
 
template<typename T >
Point< T > make_point (T x, T y)
 
template<typename T >
Point< T > make_point (T c)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Point< T > &p)
 
template<typename T , typename U >
Point< std::common_type_t< T, U > > operator- (Point< T > left, Point< U > right)
 
template<typename T , typename U >
Point< std::common_type_t< T, U > > operator+ (Point< T > left, Point< U > right)
 
template<typename T , typename U >
Point< std::common_type_t< T, U > > operator* (Point< T > left, Point< U > right)
 
template<typename T , typename U >
Point< std::common_type_t< T, U > > operator/ (Point< T > left, Point< U > right)
 
template<typename T , typename U >
Point< std::common_type_t< T, U > > operator/ (T left, Point< U > right)
 
template<typename T , typename U >
Point< std::common_type_t< T, U > > operator/ (Point< T > left, U right)
 
template<typename T >
Point< T > rounded_divide_by (Point< T > value, T factor)
 
template<typename T >
Point< T > ceiled_divide_by (Point< T > value, T factor)
 
template<typename T >
Point< T > floored_divide_by (Point< T > value, T factor)
 
template<typename T >
Point< T > rounded_divide_by (Point< T > value, Point< T > factor)
 
template<typename T >
Point< T > ceiled_divide_by (Point< T > value, Point< T > factor)
 
template<typename T >
Point< T > floored_divide_by (Point< T > value, Point< T > factor)
 
template<typename T >
Point< T > ceil (Point< T > p)
 
template<typename T >
Rectangle< T > make_rect (T x, T y, T width, T height)
 
template<typename T >
Rectangle< T > make_rect (Point< T > position, Point< T > size)
 
template<typename T >
Rectangle< T > make_rect_from_start_end (Point< T > start, Point< T > end)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Rectangle< T > &r)
 
std::ostream & operator<< (std::ostream &os, const cairo_rectangle_int_t &r)
 
template<typename T , typename U >
Rectangle< std::common_type_t< T, U > > operator* (Rectangle< T > left, U right)
 
template<typename T , typename U >
Rectangle< std::common_type_t< T, U > > operator* (T left, Rectangle< U > right)
 
Rectangle< double > operator* (cairo_rectangle_int_t const &r, Point< double > const &p)
 
Rectangle< double > operator* (Point< double > const &p, cairo_rectangle_int_t const &r)
 
template<typename T , typename U >
Rectangle< std::common_type_t< T, U > > operator- (Rectangle< T > left, Point< U > right)
 
Rectangle< double > roundOutward (Rectangle< double > r)
 
Rectangle< double > roundCorners (Rectangle< double > r)
 
template<typename T >
Point< T > center (Rectangle< T > r)
 
Stuff Empty ()
 
template<typename F >
std::shared_ptr< voidon_destruction (F f)
 
std::shared_ptr< unsigned char > shared_malloc (size_t size)
 
void dumpCounts ()
 

Variables

constexpr double epsilon = 1e-6
 

Typedef Documentation

◆ Stuff

using Scroom::Utils::Stuff = typedef std::shared_ptr<void>

Stuff is a pointer to some private data.

◆ StuffList

using Scroom::Utils::StuffList = typedef std::list<Stuff>

◆ StuffWeak

using Scroom::Utils::StuffWeak = typedef std::weak_ptr<void>

◆ WeakKeyMap

template<typename K , typename V >
using Scroom::Utils::WeakKeyMap = typedef std::map<K, V, std::owner_less<K> >

◆ WeakKeySet

template<typename K >
using Scroom::Utils::WeakKeySet = typedef std::set<K, std::owner_less<K> >

Function Documentation

◆ areEqual()

template<typename T >
bool Scroom::Utils::areEqual ( a,
b 
)
39 {
40 return isZero(a - b);
41 }
std::shared_ptr< A > a
Definition async-deleter-tests.cc:60
Blob::Ptr const b
Definition blob-tests.cc:118
bool isZero(T v)

Referenced by Scroom::Utils::Segment< T >::operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ceil()

template<typename T >
Point< T > Scroom::Utils::ceil ( Point< T >  p)
229 {
230 using std::ceil;
231 return {ceil(p.x), ceil(p.y)};
232 }
PresentationInterfaceStub::Ptr const p
Definition determine-size-test.cc:172
Point< T > ceil(Point< T > p)
Definition point.hh:228

Referenced by ceil().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ceiled_divide_by() [1/2]

template<typename T >
Point< T > Scroom::Utils::ceiled_divide_by ( Point< T >  value,
Point< T >  factor 
)
215 {
216 using ::ceiled_divide_by;
217 return {ceiled_divide_by(value.x, factor.x), ceiled_divide_by(value.y, factor.y)};
218 }
const uint8_t value
Definition blob-tests.cc:114
value_type y
Definition point.hh:112
value_type x
Definition point.hh:111
double ceiled_divide_by(double value, double factor)
Definition rounding.hh:13
Here is the call graph for this function:

◆ ceiled_divide_by() [2/2]

template<typename T >
Point< T > Scroom::Utils::ceiled_divide_by ( Point< T >  value,
factor 
)
194 {
195 using ::ceiled_divide_by;
196 return {ceiled_divide_by(value.x, factor), ceiled_divide_by(value.y, factor)};
197 }

Referenced by ceiled_divide_by(), and ceiled_divide_by().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ center() [1/2]

template<typename T >
Point< T > Scroom::Utils::center ( Rectangle< T >  r)
inline
354 {
356 }
const Segment< value_type > & getVertically() const
Definition rectangle.hh:259
const Segment< value_type > & getHorizontally() const
Definition rectangle.hh:257
T center(Segment< T > s)
Definition linearsegment.hh:246
Point< T > make_point(T x, T y)
Definition point.hh:116
Scroom::Utils::Rectangle< double > const r
Definition transformpresentation_test.cc:65
Here is the call graph for this function:

◆ center() [2/2]

template<typename T >
T Scroom::Utils::center ( Segment< T >  s)
247 {
248 return s.getStart() + s.getSize() / 2;
249 }
BitmapSurface::Ptr const s
Definition transformpresentation_test.cc:70

Referenced by center(), and Scroom::Utils::anonymous_namespace{tweak-view.cc}::find_closest_corner().

Here is the caller graph for this function:

◆ dumpCounts()

void Scroom::Utils::dumpCounts ( )
24{ Counter::instance()->dump(); }
static Counter * instance()
Definition counter.cc:49
void dump()
Definition counter.cc:69
Here is the call graph for this function:

◆ Empty()

Stuff Scroom::Utils::Empty ( )
inline
21{ return {}; }

Referenced by Pnm::open(), and Tiff::open().

Here is the caller graph for this function:

◆ floored_divide_by() [1/2]

template<typename T >
Point< T > Scroom::Utils::floored_divide_by ( Point< T >  value,
Point< T >  factor 
)
222 {
223 using ::floored_divide_by;
224 return {floored_divide_by(value.x, factor.x), floored_divide_by(value.y, factor.y)};
225 }
double floored_divide_by(double value, double factor)
Definition rounding.hh:14
Here is the call graph for this function:

◆ floored_divide_by() [2/2]

template<typename T >
Point< T > Scroom::Utils::floored_divide_by ( Point< T >  value,
factor 
)
201 {
202 using ::floored_divide_by;
203 return {floored_divide_by(value.x, factor), floored_divide_by(value.y, factor)};
204 }

Referenced by floored_divide_by(), and floored_divide_by().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [1/2]

template<typename T >
T Scroom::Utils::get ( const Context::ConstPtr context)
71 {
72 return get<T>(context, typeid(T).name());
73 }

◆ get() [2/2]

template<typename T >
T Scroom::Utils::get ( const Context::ConstPtr context,
std::string  name 
)
56 {
57 const std::any& result = context->get(std::move(name));
58 try
59 {
60 return std::any_cast<T>(result);
61 }
62 catch(std::bad_any_cast&)
63 {
64 using F = std::function<T()>;
65 return std::any_cast<F>(result)();
66 }
67 }
SampleIterator< const uint8_t > result
Definition sampleiterator-tests.cc:94

◆ get_or() [1/4]

template<typename T , typename Callable >
auto Scroom::Utils::get_or ( const Context::ConstPtr context,
const Callable &  default_value 
) -> std::enable_if_t<std::is_same_v<T, std::remove_reference_t<decltype(default_value())>>, T>
111 {
112 return get_or<T>(context, typeid(T).name(), default_value);
113 }

◆ get_or() [2/4]

template<typename T , typename Callable >
auto Scroom::Utils::get_or ( const Context::ConstPtr context,
std::string  name,
const Callable &  default_value 
) -> std::enable_if_t<std::is_same_v<T, std::remove_reference_t<decltype(default_value())>>, T>
97 {
98 try
99 {
100 return get<T>(context, std::move(name));
101 }
102 catch(Context::name_not_found&)
103 {
104 return default_value();
105 }
106 }

◆ get_or() [3/4]

template<typename T >
T Scroom::Utils::get_or ( const Context::ConstPtr context,
std::string  name,
default_value 
)
117 {
118 return get_or<T>(context, std::move(name), [&default_value] { return std::move(default_value); });
119 }

◆ get_or() [4/4]

template<typename T >
T Scroom::Utils::get_or ( const Context::ConstPtr context,
default_value 
)
123 {
124 return get_or<T>(context, typeid(T).name(), [&default_value] { return std::move(default_value); });
125 }

◆ getDefaultTweakPositionTextBox()

ITweakPositionTextBox::Ptr Scroom::Utils::getDefaultTweakPositionTextBox ( )
215{ return TweakPositionTextBox::create(); }
Here is the call graph for this function:

◆ getDefaultTweakPresentationPosition()

ITweakPresentationPosition::Ptr Scroom::Utils::getDefaultTweakPresentationPosition ( )
206 {
207 return std::make_shared<DefaultTweakPresentationPosition>();
208 }

◆ getDefaultTweakRulers()

ITweakRulers::Ptr Scroom::Utils::getDefaultTweakRulers ( )
209{ return TweakRulers::create(); }
Here is the call graph for this function:

◆ getDefaultTweakSelection()

ITweakSelection::Ptr Scroom::Utils::getDefaultTweakSelection ( )
210{ return std::make_shared<DefaultTweakSelection>(); }

Referenced by getDefaultTweakSelectionMap().

Here is the caller graph for this function:

◆ getDefaultTweakSelectionMap()

ITweakSelection::Map Scroom::Utils::getDefaultTweakSelectionMap ( )
212 {
214 }
std::map< std::string, ITweakSelection::Ptr > Map
Definition tweak-view.hh:45
ITweakSelection::Ptr getDefaultTweakSelection()
Definition tweak-view.cc:210
const std::string DEFAULT(GRID)
Here is the call graph for this function:

◆ isZero()

template<typename T >
bool Scroom::Utils::isZero ( v)

Referenced by areEqual(), and Scroom::Utils::Segment< T >::isEmpty().

Here is the caller graph for this function:

◆ isZero< double >()

template<>
bool Scroom::Utils::isZero< double > ( double  v)
inline
33 {
34 return std::abs(v) < epsilon;
35 }
constexpr double epsilon
Definition linearsegment.hh:20

◆ isZero< int >()

template<>
bool Scroom::Utils::isZero< int > ( int  v)
inline
27 {
28 return v == 0;
29 }

◆ make_point() [1/2]

template<typename T >
Point< T > Scroom::Utils::make_point ( c)
123 {
124 return Point<T>(c, c);
125 }
Definition point.hh:28
Semaphore c(0)
Here is the call graph for this function:

◆ make_point() [2/2]

template<typename T >
Point< T > Scroom::Utils::make_point ( x,
y 
)
117 {
118 return Point<T>(x, y);
119 }

Referenced by center(), getAspectRatio(), make_point(), make_point(), operator/(), operator/(), roundCorners(), and TransformationData::setAspectRatio().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_rect() [1/2]

template<typename T >
Rectangle< T > Scroom::Utils::make_rect ( Point< T >  position,
Point< T >  size 
)
291 {
292 return Rectangle<T>(position.x, position.y, size.x, size.y);
293 }
Definition rectangle.hh:29
Here is the call graph for this function:

◆ make_rect() [2/2]

template<typename T >
Rectangle< T > Scroom::Utils::make_rect ( x,
y,
width,
height 
)
285 {
286 return Rectangle<T>(x, y, width, height);
287 }

Referenced by make_rect(), make_rect(), View::redraw(), and Scroom::Utils::TweakRulers::tweakRulers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_rect_from_start_end()

template<typename T >
Rectangle< T > Scroom::Utils::make_rect_from_start_end ( Point< T >  start,
Point< T >  end 
)
297 {
299 }
Segment< T > make_segment_from_start_end(T start, T end)
Definition linearsegment.hh:229
const SampleIterator< const uint8_t > start(nullptr, initial_offset, bps)

Referenced by PipetteHandler::onSelectionEnd(), roundCorners(), and Scroom::Utils::anonymous_namespace{tweak-view.cc}::toRectangle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_segment()

template<typename T >
Segment< T > Scroom::Utils::make_segment ( start,
size 
)
224 {
225 return Segment<T>(start, size);
226 }
Definition linearsegment.hh:50

Referenced by make_segment().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ make_segment_from_start_end()

template<typename T >
Segment< T > Scroom::Utils::make_segment_from_start_end ( start,
end 
)
230 {
231 return Segment<T>(start, end - start);
232 }

Referenced by make_rect_from_start_end(), and roundOutward().

Here is the caller graph for this function:

◆ on_destruction()

template<typename F >
std::shared_ptr< void > Scroom::Utils::on_destruction ( f)
85 {
86 return std::make_shared<on_scope_exit<F>>(std::move(f));
87 }
f
Definition gtkhelper-tests.cc:43

Referenced by Scroom::TiledBitmap::scheduleLoadingBitmap().

Here is the caller graph for this function:

◆ operator*() [1/5]

Rectangle< double > Scroom::Utils::operator* ( cairo_rectangle_int_t const &  r,
Point< double > const &  p 
)
inline
325{ return Rectangle<double>(r) * p; }

◆ operator*() [2/5]

Rectangle< double > Scroom::Utils::operator* ( Point< double > const &  p,
cairo_rectangle_int_t const &  r 
)
inline
327{ return Rectangle<double>(r) * p; }

◆ operator*() [3/5]

template<typename T , typename U >
Point< std::common_type_t< T, U > > Scroom::Utils::operator* ( Point< T >  left,
Point< U >  right 
)
155 {
156 using R = std::common_type_t<T, U>;
157
158 Point<R> result(left);
160 return result;
161 }
Segment< int > const right(3, 7)

◆ operator*() [4/5]

template<typename T , typename U >
Rectangle< std::common_type_t< T, U > > Scroom::Utils::operator* ( Rectangle< T >  left,
right 
)
313 {
315 result *= static_cast<std::common_type_t<T, U>>(right);
316 return result;
317 }

◆ operator*() [5/5]

template<typename T , typename U >
Rectangle< std::common_type_t< T, U > > Scroom::Utils::operator* ( left,
Rectangle< U >  right 
)
321 {
322 return right * left;
323 }

◆ operator+()

template<typename T , typename U >
Point< std::common_type_t< T, U > > Scroom::Utils::operator+ ( Point< T >  left,
Point< U >  right 
)
145 {
146 using R = std::common_type_t<T, U>;
147
148 Point<R> result(left);
150 return result;
151 }

◆ operator-() [1/2]

template<typename T , typename U >
Point< std::common_type_t< T, U > > Scroom::Utils::operator- ( Point< T >  left,
Point< U >  right 
)
135 {
136 using R = std::common_type_t<T, U>;
137
138 Point<R> result(left);
140 return result;
141 }

◆ operator-() [2/2]

template<typename T , typename U >
Rectangle< std::common_type_t< T, U > > Scroom::Utils::operator- ( Rectangle< T >  left,
Point< U >  right 
)
331 {
332 using R = std::common_type_t<T, U>;
333
334 return Rectangle<R>(left) - Point<R>(right);
335 }

◆ operator/() [1/3]

template<typename T , typename U >
Point< std::common_type_t< T, U > > Scroom::Utils::operator/ ( Point< T >  left,
Point< U >  right 
)
165 {
166 using R = std::common_type_t<T, U>;
167
168 Point<R> result(left);
170 return result;
171 }

◆ operator/() [2/3]

template<typename T , typename U >
Point< std::common_type_t< T, U > > Scroom::Utils::operator/ ( Point< T >  left,
right 
)
181 {
182 return left / make_point(right, right);
183 }
Here is the call graph for this function:

◆ operator/() [3/3]

template<typename T , typename U >
Point< std::common_type_t< T, U > > Scroom::Utils::operator/ ( left,
Point< U >  right 
)
175 {
176 return make_point(left, left) / right;
177 }
Here is the call graph for this function:

◆ operator<<() [1/4]

std::ostream & Scroom::Utils::operator<< ( std::ostream &  os,
const cairo_rectangle_int_t &  r 
)
inline
309{ return os << Rectangle<double>(r); }

◆ operator<<() [2/4]

template<typename T >
std::ostream & Scroom::Utils::operator<< ( std::ostream &  os,
const Point< T > &  p 
)
129 {
130 return os << '(' << p.x << ',' << p.y << ')';
131 }

◆ operator<<() [3/4]

template<typename T >
std::ostream & Scroom::Utils::operator<< ( std::ostream &  os,
const Rectangle< T > &  r 
)
303 {
304 os << '<' << r.getLeft() << ',' << r.getTop() << ',' << r.getWidth() << ',' << r.getHeight() << '>';
305
306 return os;
307 }
value_type getTop() const
Definition rectangle.hh:108
value_type getWidth() const
Definition rectangle.hh:121
value_type getHeight() const
Definition rectangle.hh:123
value_type getLeft() const
Definition rectangle.hh:110
Here is the call graph for this function:

◆ operator<<() [4/4]

template<typename T >
std::ostream & Scroom::Utils::operator<< ( std::ostream &  os,
const Segment< T > &  s 
)
236 {
237 return os << '(' << s.getStart() << ',' << s.getSize() << ')';
238 }

◆ roundCorners()

Rectangle< double > Scroom::Utils::roundCorners ( Rectangle< double >  r)
inline
346 {
349 );
350 }
xy_type getBottomRight() const
Definition rectangle.hh:139
xy_type getTopLeft() const
Definition rectangle.hh:133
Rectangle< T > make_rect_from_start_end(Point< T > start, Point< T > end)
Definition rectangle.hh:296
T round_to_multiple_of(T value, T factor)
Definition rounding.hh:32

Referenced by Scroom::Utils::TweakGridSelection::tweakSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rounded_divide_by() [1/2]

template<typename T >
Point< T > Scroom::Utils::rounded_divide_by ( Point< T >  value,
Point< T >  factor 
)
208 {
209 using ::rounded_divide_by;
210 return {rounded_divide_by(value.x, factor.x), rounded_divide_by(value.y, factor.y)};
211 }
double rounded_divide_by(double value, double factor)
Definition rounding.hh:12
Here is the call graph for this function:

◆ rounded_divide_by() [2/2]

template<typename T >
Point< T > Scroom::Utils::rounded_divide_by ( Point< T >  value,
factor 
)
187 {
188 using ::rounded_divide_by;
189 return {rounded_divide_by(value.x, factor), rounded_divide_by(value.y, factor)};
190 }

Referenced by rounded_divide_by(), and rounded_divide_by().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ roundOutward() [1/2]

Rectangle< double > Scroom::Utils::roundOutward ( Rectangle< double >  r)
inline
338 {
339 return {
342 };
343 }
Segment< double > roundOutward(Segment< double > s)
Definition linearsegment.hh:240
Here is the call graph for this function:

◆ roundOutward() [2/2]

Segment< double > Scroom::Utils::roundOutward ( Segment< double >  s)
inline
241 {
243 }
T round_up_to_multiple_of(T value, T factor)
Definition rounding.hh:38
T round_down_to_multiple_of(T value, T factor)
Definition rounding.hh:44

Referenced by roundOutward(), and Scroom::Utils::TweakPixelSelection::tweakSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set() [1/2]

template<typename T >
void Scroom::Utils::set ( const Context::Ptr context,
std::string  name,
value 
)
129 {
130 context->set(std::move(name), std::any(std::move(value)));
131 }

Referenced by set(), and setFactory().

Here is the caller graph for this function:

◆ set() [2/2]

template<typename T >
void Scroom::Utils::set ( const Context::Ptr context,
value 
)
135 {
136 set(context, typeid(value).name(), std::move(value));
137 }
map set(2, 5)
Here is the call graph for this function:

◆ setFactory() [1/2]

template<typename Callable >
void Scroom::Utils::setFactory ( const Context::Ptr context,
Callable  value 
)
148 {
149 using T = std::remove_reference_t<decltype(value())>;
150 setFactory(context, typeid(T).name(), std::move(value));
151 }
setFactory(context, [p1] { return p1;})
Here is the call graph for this function:

◆ setFactory() [2/2]

template<typename Callable >
void Scroom::Utils::setFactory ( const Context::Ptr context,
std::string  name,
Callable  value 
)
141 {
142 using T = std::remove_reference_t<decltype(value())>;
143 set(context, std::move(name), std::function<T()>(std::move(value)));
144 }

Referenced by setFactory().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shared_malloc()

std::shared_ptr< unsigned char > Scroom::Utils::shared_malloc ( size_t  size)
inline
123{ return {static_cast<unsigned char*>(malloc(size)), free}; }

Referenced by OperationsCMYK32::cache(), OperationsCMYK16::cache(), OperationsCMYK8::cache(), and OperationsCMYK4::cache().

Here is the caller graph for this function:

◆ try_get() [1/2]

template<typename T >
std::optional< T > Scroom::Utils::try_get ( const Context::ConstPtr context)
90 {
91 return try_get<T>(context, typeid(T).name());
92 }

◆ try_get() [2/2]

template<typename T >
std::optional< T > Scroom::Utils::try_get ( const Context::ConstPtr context,
std::string  name 
)
77 {
78 try
79 {
80 return get<T>(context, std::move(name));
81 }
82 catch(Context::name_not_found&)
83 {
84 return std::nullopt;
85 }
86 }

Variable Documentation

◆ epsilon

constexpr double Scroom::Utils::epsilon = 1e-6
constexpr

Referenced by isZero< double >().