Bifrost SDK
Bifrost SDK documentation
Watchpoint.h
Go to the documentation of this file.
1//-
2// ================================================================================================
3// Copyright 2024 Autodesk, Inc. All rights reserved.
4//
5// Use of this software is subject to the terms of the Autodesk license agreement provided
6// at the time of installation or download, or which otherwise accompanies this software in
7// either electronic or hard copy form.
8// ================================================================================================
9//+
10
15
16#ifndef BIFROSTGRAPH_EXECUTOR_WATCHPOINT_H
17#define BIFROSTGRAPH_EXECUTOR_WATCHPOINT_H
18
19#include <BifrostGraph/Executor/internal/ExecutorExport.h>
20
21#include <Amino/Core/Any.h>
22#include <Amino/Core/Array.h>
24#include <Amino/Core/String.h>
25#include <Amino/Core/TypeId.h>
26
27#if defined(_MSC_VER)
33#define WATCHPOINT_DEPRECATED(REASON)
34#elif defined(__clang__)
35#define WATCHPOINT_DEPRECATED(REASON) [[deprecated(REASON)]]
36#elif defined(__GNUC__)
37#define WATCHPOINT_DEPRECATED(REASON) __attribute__((deprecated))
38#else
39#define WATCHPOINT_DEPRECATED(REASON)
40#endif
41
42namespace Amino {
43class Any;
44class Type;
45class WatchPoint;
46} // namespace Amino
47
48namespace BifrostGraph {
49namespace Executor {
50
51class WatchpointLayoutFactory;
52class WatchpointLayoutPath;
53class WatchpointLayoutPtr;
54
56
68class BIFROSTGRAPH_EXECUTOR_SHARED_DECL Watchpoint {
69public:
73
76 explicit Watchpoint(String name) noexcept;
77
79 virtual ~Watchpoint() noexcept;
80
83 String getName() const noexcept;
84
86 using CreateFunc = BifrostGraph::Executor::Watchpoint* (*)();
87
137 static const char* createFuncName() noexcept;
138
140 virtual void deleteThis() noexcept = 0;
141
154 WATCHPOINT_DEPRECATED("Use getSupportedTypeIds() instead.")
155 virtual void getSupportedTypeNames(StringArray& names) const noexcept;
156
165 virtual void getSupportedTypeIds(TypeIdArray& typeIds) const noexcept = 0;
166
168 using CallBack = void (*)(const void* clientData,
169 Amino::ulong_t locationID,
170 const void* valueData);
171
176 virtual CallBack getCallBackFunction(const Amino::TypeId& typeId) const noexcept = 0;
177
182 WATCHPOINT_DEPRECATED("Use getCallBackFunction(TypeId) instead.")
183 virtual CallBack getCallBackFunction(const Amino::Type& type) const noexcept;
184
186 class BIFROSTGRAPH_EXECUTOR_SHARED_DECL Watcher {
187 public:
188 enum class Flags : unsigned { kNone = 0, kWithinALoop = 1 };
189
190 Watcher() noexcept;
191 virtual ~Watcher() noexcept;
192
194 virtual void deleteThis() noexcept = 0;
195
199 virtual WatchpointLayoutPtr getLayout(WatchpointLayoutFactory& factory) const noexcept = 0;
200
207 virtual bool getValue(WatchpointLayoutFactory const& factory,
209 Amino::String& out_value) const noexcept = 0;
210
211 private:
214 Watcher(Watcher const&) = delete;
215 Watcher(Watcher&&) = delete;
216 Watcher& operator=(Watcher const&) = delete;
217 Watcher& operator=(Watcher&&) = delete;
219 };
220
225 virtual Watcher* createWatcher(Amino::TypeId const& typeId,
226 Watcher::Flags flags = Watcher::Flags::kNone) const noexcept = 0;
227
232 virtual Watcher* createWatcher(Amino::Type const& type,
233 Watcher::Flags flags = Watcher::Flags::kNone) const noexcept;
234
239 virtual WatchpointLayoutPtr createLayout(WatchpointLayoutFactory const& factory,
240 Amino::Any const& any) const noexcept;
241
249 virtual bool getValue(WatchpointLayoutFactory const& factory,
250 Amino::Any const& any,
252 Amino::String& out_value) const noexcept;
253
263 WATCHPOINT_DEPRECATED("Use createWatcher instead.")
264 virtual bool getAvailableParameters(const Amino::Type& type,
265 StringArray& parameters) const noexcept;
266
279 WATCHPOINT_DEPRECATED("Use createWatcher instead.")
280 virtual bool getParameterDetails(const Amino::Type& type,
281 const String& parameter,
282 String& description,
283 StringArray& values,
284 StringArray& descriptions) const noexcept;
285
290 class WATCHPOINT_DEPRECATED("Use Watcher instead.") BIFROSTGRAPH_EXECUTOR_SHARED_DECL Records {
291 public:
294
295 explicit Records(const Amino::WatchPoint& watchpoint) noexcept;
296 virtual ~Records() noexcept;
297
303 bool getSetting(const String& parameter, String& value) const noexcept;
304
306 virtual void clear() noexcept = 0;
307
310 virtual void erase(const String& parameter) noexcept = 0;
311
315 virtual void set(const String& parameter, const String& value) noexcept = 0;
316
320 virtual void set(const String& parameter, const StringArray& values) noexcept = 0;
321
325 virtual void add(const String& parameter, const String& value) noexcept = 0;
326
330 virtual void add(const String& parameter, const StringArray& values) noexcept = 0;
331
332 private:
333 class Impl;
334 Impl* m_pImpl = nullptr;
335 };
336
346 WATCHPOINT_DEPRECATED("Use createWatcher instead.")
347 virtual const void* createClientData(const Amino::Type& type, Records& records) const noexcept;
348
357 WATCHPOINT_DEPRECATED("Use createWatcher instead.")
358 virtual bool releaseClientData(const Amino::Type& type, const void* clientData) const noexcept;
359
361 enum class Field : char { eIndex, eValue, eElement };
362
364 struct Sorter {
365 enum class Order : char { eAscending, eDescending };
366
367 Sorter() : m_order(Order::eAscending), m_field(Field::eIndex) {}
368 explicit Sorter(Order order) : m_order(order), m_field(Field::eIndex) {}
369 explicit Sorter(Order order, Field field) : m_order(order), m_field(field) {}
370 explicit Sorter(Order order, Amino::String elementName)
371 : m_order(order), m_field(Field::eElement), m_elementName(std::move(elementName)) {}
372
376 };
377
379 struct Filter {
381
382 enum class Conjunction : char { eAnd, eOr };
383 enum class Operation : char {
384 eLess,
385 eLessOrEqual,
386 eEqual,
387 eNotEqual,
388 eGreaterOrEqual,
389 eGreater,
390 eIsInfinite,
391 eIsNotANumber,
392 eSubFilters
393 };
394
395 explicit Filter(Conjunction conjunction, Operation operation, Amino::Any value)
396 : m_conjunction(conjunction),
397 m_operation(operation),
398 m_field(Field::eValue),
399 m_value(std::move(value)),
400 m_elementName() {}
401 explicit Filter(Conjunction conjunction,
402 Operation operation,
403 Amino::String elementName,
404 Amino::Any elementValue)
405 : m_conjunction(conjunction),
406 m_operation(operation),
407 m_field(Field::eElement),
408 m_value(std::move(elementValue)),
409 m_elementName(std::move(elementName)) {}
410 explicit Filter(Conjunction conjunction, Operation operation, Field field, Amino::Any value)
411 : m_conjunction(conjunction),
412 m_operation(operation),
413 m_field(field),
414 m_value(std::move(value)),
415 m_elementName() {}
416
417 explicit Filter(Conjunction conjunction, Filters subFilters)
418 : m_conjunction(conjunction),
419 m_operation{Operation::eSubFilters},
420 m_subFilters(std::move(subFilters)) {}
421
422 explicit Filter(Operation operation, Amino::Any value)
423 : Filter(Conjunction::eAnd, operation, std::move(value)) {}
424 explicit Filter(Operation operation, Amino::String elementName, Amino::Any elementValue)
425 : Filter(
426 Conjunction::eAnd, operation, std::move(elementName), std::move(elementValue)) {}
427 explicit Filter(Operation operation, Field field, Amino::Any value)
428 : Filter(Conjunction::eAnd, operation, field, std::move(value)) {}
429 explicit Filter(Filters subFilters) : Filter(Conjunction::eAnd, std::move(subFilters)) {}
430
437 };
440
448 virtual bool getIndices(Amino::Any const& any,
449 Filters const& filters,
450 Sorter const& sorter,
451 Indices& out_indices) const noexcept;
452
453private:
456 Watchpoint(const Watchpoint&) = delete;
457 Watchpoint(Watchpoint&&) = delete;
458 Watchpoint& operator=(const Watchpoint&) = delete;
459 Watchpoint& operator=(Watchpoint&&) = delete;
461
463 String m_name;
464};
465
466} // namespace Executor
467} // namespace BifrostGraph
468
469#endif // BIFROSTGRAPH_EXECUTOR_WATCHPOINT_H
A generic value object.
A resizable container of contiguous elements.
C++ representation of integral and floating point Amino data types at runtime.
String class.
Type identifier for types.
#define WATCHPOINT_DEPRECATED(REASON)
Definition: Watchpoint.h:39
Definition: HostData.h:33
unsigned long long ulong_t
Type alias for Amino's ulong type, an unsigned 64-bit integer.
Definition: BuiltInTypes.h:70
Definition: Ptr.h:2080
Generic value class that allows for storage of a value of any type.
Definition: Any.h:180
Define a Amino array of elements of type T.
Definition: Array.h:105
The string class used by Amino.
Definition: String.h:46
BifrostGraph Executor Watchpoint.
Definition: Watchpoint.h:68
Field
Field enumerants for indices sorter and filters.
Definition: Watchpoint.h:361
void(*)(const void *clientData, Amino::ulong_t locationID, const void *valueData) CallBack
Callback function signature.
Definition: Watchpoint.h:170
BifrostGraph::Executor::Watchpoint *(*)() CreateFunc
The signature of the function used to create the Watchpoint.
Definition: Watchpoint.h:86
virtual bool getIndices(Amino::Any const &any, Filters const &filters, Sorter const &sorter, Indices &out_indices) const noexcept
Implemenation helper to return the indices of an array value for given filters and sorter settings.
virtual ~Watchpoint() noexcept
Destructor.
Amino::Array< String > StringArray
Definition: Watchpoint.h:71
Watchpoint(String name) noexcept
Constructor.
The interface to get the watchpoint layout and value.
Definition: Watchpoint.h:186
An interface for the watchpoints to manage recorded values.
Definition: Watchpoint.h:290
Records(const Amino::WatchPoint &watchpoint) noexcept
Structure that holds the sorting settings for getIndices.
Definition: Watchpoint.h:364
Sorter(Order order, Amino::String elementName)
Definition: Watchpoint.h:370
Sorter(Order order, Field field)
Definition: Watchpoint.h:369
Structure that holds the filtering settings for getIndices.
Definition: Watchpoint.h:379
Filter(Conjunction conjunction, Operation operation, Amino::String elementName, Amino::Any elementValue)
Definition: Watchpoint.h:401
Filter(Operation operation, Field field, Amino::Any value)
Definition: Watchpoint.h:427
Filter(Conjunction conjunction, Operation operation, Amino::Any value)
Definition: Watchpoint.h:395
Filter(Conjunction conjunction, Filters subFilters)
Definition: Watchpoint.h:417
Filter(Operation operation, Amino::Any value)
Definition: Watchpoint.h:422
Filter(Operation operation, Amino::String elementName, Amino::Any elementValue)
Definition: Watchpoint.h:424
Filter(Conjunction conjunction, Operation operation, Field field, Amino::Any value)
Definition: Watchpoint.h:410
A smart pointer on WatchpointLayout objects allowing them to be easily shared and managed.
Layout factory to build layouts for types and/or values.