libcamera  v0.2.0+118-bf469526
Supporting cameras in Linux since 2019
Classes | Namespaces | Macros
class.h File Reference

Utilities to help constructing class interfaces. More...

#include <memory>
Include dependency graph for class.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  libcamera::Extensible
 Base class to manage private data through a d-pointer. More...
 
class  libcamera::Extensible::Private
 Base class for private data managed through a d-pointer. More...
 

Namespaces

 libcamera
 Top-level libcamera namespace.
 

Macros

#define LIBCAMERA_DISABLE_COPY(klass)
 Disable copy construction and assignment of the klass. More...
 
#define LIBCAMERA_DISABLE_MOVE(klass)
 Disable move construction and assignment of the klass. More...
 
#define LIBCAMERA_DISABLE_COPY_AND_MOVE(klass)
 Disable copy and move construction and assignment of the klass. More...
 
#define LIBCAMERA_DECLARE_PRIVATE()
 Declare private data for a public class. More...
 
#define LIBCAMERA_DECLARE_PUBLIC(klass)
 Declare public data for a private class. More...
 
#define LIBCAMERA_O_PTR()
 Retrieve the public instance corresponding to the private data. More...
 

Detailed Description

Utilities to help constructing class interfaces.

The extensible class can be inherited to create public classes with stable ABIs.

Macro Definition Documentation

◆ LIBCAMERA_DECLARE_PRIVATE

#define LIBCAMERA_DECLARE_PRIVATE ( )

Declare private data for a public class.

The LIBCAMERA_DECLARE_PRIVATE() macro plumbs the infrastructure necessary to make a class manage its private data through a d-pointer. It shall be used at the very top of the class definition.

◆ LIBCAMERA_DECLARE_PUBLIC

#define LIBCAMERA_DECLARE_PUBLIC (   klass)

Declare public data for a private class.

Parameters
klassThe public class name

The LIBCAMERA_DECLARE_PUBLIC() macro is the counterpart of LIBCAMERA_DECLARE_PRIVATE() to be used in the private data class. It shall be used at the very top of the private class definition, with the public class name passed as the klass parameter.

◆ LIBCAMERA_DISABLE_COPY

#define LIBCAMERA_DISABLE_COPY (   klass)

Disable copy construction and assignment of the klass.

Parameters
klassThe name of the class

Example usage:

class NonCopyable
{
public:
NonCopyable();
...
private:
};

◆ LIBCAMERA_DISABLE_COPY_AND_MOVE

#define LIBCAMERA_DISABLE_COPY_AND_MOVE (   klass)

Disable copy and move construction and assignment of the klass.

Parameters
klassThe name of the class

Example usage:

class NonCopyableNonMoveable
{
public:
NonCopyableNonMoveable();
...
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(NonCopyableNonMoveable)
};

◆ LIBCAMERA_DISABLE_MOVE

#define LIBCAMERA_DISABLE_MOVE (   klass)

Disable move construction and assignment of the klass.

Parameters
klassThe name of the class

Example usage:

class NonMoveable
{
public:
NonMoveable();
...
private:
};

◆ LIBCAMERA_O_PTR

#define LIBCAMERA_O_PTR ( )

Retrieve the public instance corresponding to the private data.

This macro is part of the libcamera::Extensible class infrastructure. It may be used in any member function of a libcamera::Extensible::Private subclass to access the public class instance corresponding to the private data.