libcamera::Message Class Reference

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

Inheritance diagram for libcamera::Message:

## Public Types

enum | Type { None = 0 , InvokeMessage = 1 , ThreadMoveMessage = 2 , 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.
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 method reserves and returns the next available user-defined message type.

The recommended way to use this method 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:34
libcamera::Message::Type
Type
The message type.
Definition: message.h:24
libcamera::Message::Message
Message(Type type)
Construct a message object of type type.
Definition: message.cpp:60
libcamera::Message::registerMessageType
static Type registerMessageType()
Reserve and register a custom user-defined message type.
Definition: message.cpp:108

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/internal/message.h
- src/libcamera/message.cpp