The LIBCAMERA_DECLARE_PRIVATE() macro, used by the library classes that inherit from libcamera::Extensible in order to implement the PIMPL pattern, expands to: public: \ class Private; \ friend class Private; The 'klass' argument is not used and it might confuse developers as it might hint that the class that defines the pattern's implementation can be freely named, while it is actually hardcoded to 'Private'. Drop the argument from the macro definition. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Hanlin Chen <hanlinchen@google.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2018, Google Inc.
|
|
*
|
|
* camera_manager.h - Camera management
|
|
*/
|
|
#ifndef __LIBCAMERA_CAMERA_MANAGER_H__
|
|
#define __LIBCAMERA_CAMERA_MANAGER_H__
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <sys/types.h>
|
|
#include <vector>
|
|
|
|
#include <libcamera/class.h>
|
|
#include <libcamera/object.h>
|
|
#include <libcamera/signal.h>
|
|
|
|
namespace libcamera {
|
|
|
|
class Camera;
|
|
|
|
class CameraManager : public Object, public Extensible
|
|
{
|
|
LIBCAMERA_DECLARE_PRIVATE()
|
|
public:
|
|
CameraManager();
|
|
~CameraManager();
|
|
|
|
int start();
|
|
void stop();
|
|
|
|
std::vector<std::shared_ptr<Camera>> cameras() const;
|
|
std::shared_ptr<Camera> get(const std::string &name);
|
|
std::shared_ptr<Camera> get(dev_t devnum);
|
|
|
|
void addCamera(std::shared_ptr<Camera> camera,
|
|
const std::vector<dev_t> &devnums);
|
|
void removeCamera(std::shared_ptr<Camera> camera);
|
|
|
|
static const std::string &version() { return version_; }
|
|
|
|
Signal<std::shared_ptr<Camera>> cameraAdded;
|
|
Signal<std::shared_ptr<Camera>> cameraRemoved;
|
|
|
|
private:
|
|
LIBCAMERA_DISABLE_COPY(CameraManager)
|
|
|
|
static const std::string version_;
|
|
static CameraManager *self_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|
|
|
|
#endif /* __LIBCAMERA_CAMERA_MANAGER_H__ */
|