Lightgraph
C++17 light-graph engine API reference
Loading...
Searching...
No Matches
engine.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <cstddef>
5#include <memory>
6
7#include "status.hpp"
8#include "types.hpp"
9
10namespace lightgraph {
11
24class Engine {
25 public:
29 explicit Engine(const EngineConfig& config = EngineConfig{});
31
32 Engine(const Engine&) = delete;
33 Engine& operator=(const Engine&) = delete;
34 Engine(Engine&&) noexcept;
35 Engine& operator=(Engine&&) noexcept;
36
41 Result<int8_t> emit(const EmitCommand& command);
42
44 Status setListLengths(const ListLengthUpdate* updates, size_t count);
45
49 void update(uint64_t millis);
50
54 void tick(uint64_t delta_millis);
55
59 void stopAll();
60
64 bool isOn() const;
68 void setOn(bool on);
69
73 bool autoEmitEnabled() const;
77 void setAutoEmitEnabled(bool enabled);
78
82 uint16_t pixelCount() const;
86 Result<Color> pixel(uint16_t index, uint8_t max_brightness = 255) const;
87
88 private:
89 struct Impl;
90 std::unique_ptr<Impl> impl_;
91};
92
93} // namespace lightgraph
Engine facade with internal method-level synchronization.
Definition engine.hpp:24
void setOn(bool on)
Enable or disable runtime output.
Engine(const Engine &)=delete
bool isOn() const
Return whether runtime output is enabled.
bool autoEmitEnabled() const
Return auto-emit state.
Result< int8_t > emit(const EmitCommand &command)
Emit a new light list using a value command.
Status setListLengths(const ListLengthUpdate *updates, size_t count)
Atomically update visible spans of up to 19 centered lists.
void tick(uint64_t delta_millis)
Advance runtime by a delta in milliseconds.
void setAutoEmitEnabled(bool enabled)
Enable or disable auto-emit.
uint16_t pixelCount() const
Return total pixel count for the active object.
Engine & operator=(const Engine &)=delete
Engine(Engine &&) noexcept
Engine(const EngineConfig &config=EngineConfig{})
Construct an engine instance from configuration.
Result< Color > pixel(uint16_t index, uint8_t max_brightness=255) const
Fetch a rendered pixel color by index.
void update(uint64_t millis)
Advance runtime to an absolute timestamp (milliseconds).
void stopAll()
Stop all active lights/lists.
Operation status object.
Definition status.hpp:32
Error/result types for the stable Lightgraph API.
8-bit RGB color.
Definition types.hpp:16
One emit request.
Definition types.hpp:59
Engine construction configuration.
Definition types.hpp:46
Public value types and commands for the stable Lightgraph API.