Uniot Core
0.8.1
Loading...
Searching...
No Matches
uniot::unLisp Class Reference

#include <unLisp.h>

Inheritance diagram for uniot::unLisp:
[legend]

Public Member Functions

TaskScheduler::TaskPtr getTask ()
 Get the task associated with Lisp evaluation.
 
TaskScheduler::TaskPtr getCleanupTask ()
 
bool isCreated ()
 Check if the Lisp machine has been created.
 
bool taskIsRunning ()
 Check if the Lisp evaluation task is currently running.
 
size_t memoryUsed ()
 Get the amount of memory used by the Lisp machine.
 
void runCode (const Bytes &data)
 Run Lisp code in the interpreter.
 
unLisppushPrimitive (Primitive *primitive)
 Add a new primitive function to the Lisp environment.
 
void serializePrimitives (CBORObject &obj)
 Serialize all registered primitive functions to CBOR format.
 
const BytesgetLastCode ()
 Get the last executed Lisp code.
 
void cleanLastCode ()
 Clear the stored last executed code.
 
virtual void onEventReceived (unsigned int topic, int msg) override
 Event handler for received events.
 
- Public Member Functions inherited from uniot::EventListener< unsigned int, int, Bytes >
virtual ~EventListener ()=default
 Virtual destructor.
 
virtual type_id getTypeId () const override
 Get the type ID of this class for RTTI.
 
EventListenerlistenToEvent (unsigned int topic)
 Subscribe to events of a specific topic.
 
EventListenerstopListeningToEvent (unsigned int topic)
 Unsubscribe from events of a specific topic.
 
bool isListeningToEvent (unsigned int topic)
 Check if this listener is subscribed to a specific topic.
 
virtual ~EventListener ()=default
 Virtual destructor.
 
virtual type_id getTypeId () const override
 Get the type ID of this class for RTTI.
 
EventListenerlistenToEvent (unsigned int topic)
 Subscribe to events of a specific topic.
 
EventListenerstopListeningToEvent (unsigned int topic)
 Unsubscribe from events of a specific topic.
 
bool isListeningToEvent (unsigned int topic)
 Check if this listener is subscribed to a specific topic.
 
- Public Member Functions inherited from uniot::EventEmitter< unsigned int, int, Bytes >
virtual ~EventEmitter ()=default
 Virtual destructor to ensure proper cleanup of derived classes.
 
void emitEvent (unsigned int topic, int msg)
 Emits an event to all registered event buses.
 
virtual ~EventEmitter ()=default
 Virtual destructor to ensure proper cleanup of derived classes.
 
void emitEvent (unsigned int topic, int msg)
 Emits an event to all registered event buses.
 
- Public Member Functions inherited from uniot::EventEntity< T_topic, T_msg, T_data >
virtual ~EventEntity ()
 Destructor - disconnects from all connected EventBus instances.
 
bool sendDataToChannel (T_topic channel, T_data data)
 Sends data to a specific channel on all connected EventBus instances.
 
void receiveDataFromChannel (T_topic channel, DataChannelCallback callback)
 Receives data from a specific channel on all connected EventBus instances.
 
- Public Member Functions inherited from uniot::Singleton< unLisp >
 Singleton (const Singleton &)=delete
 Copy constructor is deleted to prevent duplicating the singleton instance.
 
Singletonoperator= (const Singleton &)=delete
 Assignment operator is deleted to prevent duplicating the singleton instance.
 

Friends

class Singleton< unLisp >
 

Additional Inherited Members

- Public Types inherited from uniot::EventEntity< T_topic, T_msg, T_data >
using DataChannelCallback = std::function<void(unsigned int, bool, T_data)>
 Callback type for handling data received from channels.
 
- Static Public Member Functions inherited from uniot::Singleton< unLisp >
static unLispgetInstance ()
 Gets the singleton instance of the derived class.
 
- Protected Member Functions inherited from uniot::EventEntity< T_topic, T_msg, T_data >
bool connectUnique (EventBus< T_topic, T_msg, T_data > *eventBus)
 Connects to an EventBus instance if not already connected.
 
- Protected Member Functions inherited from uniot::Singleton< unLisp >
 Singleton ()=default
 Default constructor is protected to prevent instantiation outside of derived classes.
 
 ~Singleton ()=default
 Default destructor is protected to prevent deletion through base class pointer.
 
- Protected Attributes inherited from uniot::EventEntity< T_topic, T_msg, T_data >
IterableQueue< EventBus< T_topic, T_msg, T_data > * > mEventBusQueue
 Queue of EventBus instances this entity is connected to.
 

Member Function Documentation

◆ cleanLastCode()

void uniot::unLisp::cleanLastCode ( )
inline

Clear the stored last executed code.

◆ getCleanupTask()

TaskScheduler::TaskPtr uniot::unLisp::getCleanupTask ( )
inline

◆ getLastCode()

const Bytes & uniot::unLisp::getLastCode ( )
inline

Get the last executed Lisp code.

Return values
BytesThe last executed code

◆ getTask()

TaskScheduler::TaskPtr uniot::unLisp::getTask ( )
inline

Get the task associated with Lisp evaluation.

Return values
TaskScheduler::TaskPtrThe task pointer for the Lisp evaluation

◆ isCreated()

bool uniot::unLisp::isCreated ( )
inline

Check if the Lisp machine has been created.

Return values
trueThe Lisp machine exists
falseThe Lisp machine does not exist

◆ memoryUsed()

size_t uniot::unLisp::memoryUsed ( )
inline

Get the amount of memory used by the Lisp machine.

Return values
memoryUsedSize in bytes of memory used

◆ onEventReceived()

virtual void uniot::unLisp::onEventReceived ( unsigned int topic,
int msg )
inlineoverridevirtual

Event handler for received events.

This method processes events directed to the Lisp environment, particularly handling incoming events from the application.

Parameters
topicThe topic of the received event
msgThe specific message type

Implements uniot::EventListener< unsigned int, int, Bytes >.

◆ pushPrimitive()

unLisp * uniot::unLisp::pushPrimitive ( Primitive * primitive)
inline

Add a new primitive function to the Lisp environment.

Parameters
primitivePointer to the primitive function
Return values
unLisp*Pointer to the unLisp instance

◆ runCode()

void uniot::unLisp::runCode ( const Bytes & data)
inline

Run Lisp code in the interpreter.

This method creates a fresh Lisp machine if needed, stores the code, refreshes event queues, evaluates the code, and manages machine lifecycle.

Parameters
dataThe Lisp code to execute as a byte array

◆ serializePrimitives()

void uniot::unLisp::serializePrimitives ( CBORObject & obj)
inline

Serialize all registered primitive functions to CBOR format.

This allows the runtime to expose information about available primitives to client applications or documentation systems.

Parameters
objCBOR object to populate with primitive information

◆ taskIsRunning()

bool uniot::unLisp::taskIsRunning ( )
inline

Check if the Lisp evaluation task is currently running.

Return values
trueThe task is running (attached)
falseThe task is not running

Friends And Related Symbol Documentation

◆ Singleton< unLisp >

friend class Singleton< unLisp >
friend

The documentation for this class was generated from the following file: