libcamera: libcamera::Message Class Reference

libcamera v0.0.1 Supporting cameras in Linux since 2019

Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
libcamera::Message Class Reference

A message that can be posted to a Thread. More...

Inheritance diagram for libcamera::Message:
[legend]

## Public Types
enum | Type { None = 0 , InvokeMessage = 1 , ThreadMoveMessage = 2 , DeferredDelete = 3 , UserMessage = 1000 }
| The message type. More...

## Public Member Functions
| Message (Type type)
| Construct a message object of type type. More...
Type | type () const
| Retrieve the message type. More...
Object * | receiver () const
| Retrieve the message receiver. More...

## Static Public Member Functions
static Type | registerMessageType ()
| Reserve and register a custom user-defined message type. More...

## Friends
class | Thread

## Detailed Description

A message that can be posted to a Thread.

## Member Enumeration Documentation

## ◆ Type

enum libcamera::Message::Type

The message type.

Enumerator
None | Invalid message type.
InvokeMessage | Asynchronous method invocation across threads.
ThreadMoveMessage | Object is being moved to a different thread.
DeferredDelete | Object is scheduled for deletion.
UserMessage | First value available for user-defined messages.

## Constructor & Destructor Documentation

## ◆ Message()

libcamera::Message::Message | ( | Message::Type | type | ) |

Construct a message object of type type.

Parameters

  [in] | type | The message type

## Member Function Documentation

## ◆ receiver()

libcamera::Message::receiver | ( |  | ) | const
| inline

Retrieve the message receiver.

Returns
  The message receiver

## ◆ registerMessageType()

Message::Type libcamera::Message::registerMessageType | ( |  | ) |
| static

Reserve and register a custom user-defined message type.

Custom message types use values starting at Message::UserMessage. Assigning custom types manually may lead to accidental duplicated types. To avoid this problem, this function reserves and returns the next available user-defined message type.

The recommended way to use this function is to subclass Message and provide a static accessor for the custom message type.

class MyCustomMessage : public Message
{
public:
MyCustomMessage() : Message(type()) {}
static Message::Type type()
{
static MessageType type = registerMessageType();
return type;
}
};
libcamera::Message::type
Type type() const
Retrieve the message type.
Definition: message.h:37
libcamera::Message::Type
Type
The message type.
Definition: message.h:26
libcamera::Message::Message
Message(Type type)
Construct a message object of type type.
Definition: message.cpp:61
libcamera::Message::registerMessageType
static Type registerMessageType()
Reserve and register a custom user-defined message type.
Definition: message.cpp:109

Returns
  A new unique message type

## ◆ type()

libcamera::Message::type | ( |  | ) | const
| inline

Retrieve the message type.

Returns
  The message type

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

- include/libcamera/base/message.h
- src/libcamera/base/message.cpp