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 <memory>
5
6#include "status.hpp"
7#include "types.hpp"
8
9namespace lightgraph {
10
23class Engine {
24 public:
28 explicit Engine(const EngineConfig& config = EngineConfig{});
30
31 Engine(const Engine&) = delete;
32 Engine& operator=(const Engine&) = delete;
33 Engine(Engine&&) noexcept;
34 Engine& operator=(Engine&&) noexcept;
35
40 Result<int8_t> emit(const EmitCommand& command);
41
45 void update(uint64_t millis);
46
50 void tick(uint64_t delta_millis);
51
55 void stopAll();
56
60 bool isOn() const;
64 void setOn(bool on);
65
69 bool autoEmitEnabled() const;
73 void setAutoEmitEnabled(bool enabled);
74
78 uint16_t pixelCount() const;
82 Result<Color> pixel(uint16_t index, uint8_t max_brightness = 255) const;
83
84 private:
85 struct Impl;
86 std::unique_ptr<Impl> impl_;
87};
88
89} // namespace lightgraph
Engine facade with internal method-level synchronization.
Definition engine.hpp:23
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.
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.
Error/result types for the stable Lightgraph API.
8-bit RGB color.
Definition types.hpp:16
One emit request.
Definition types.hpp:49
Engine construction configuration.
Definition types.hpp:36
Public value types and commands for the stable Lightgraph API.