libcamera/include/libcamera/camera.h
Laurent Pinchart 21ff749a79 libcamera: camera: Handle camera objects through shared pointers
The Camera class is explicitly reference-counted to manage the lifetime
of camera objects. Replace this open-coded implementation with usage of
the std::shared_ptr<> class.

This API change prevents pipeline handlers from subclassing the Camera
class. This isn't deemed to be an issue. Mark the class final to make
this explicit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-21 11:13:53 +02:00

34 lines
616 B
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* camera.h - Camera object interface
*/
#ifndef __LIBCAMERA_CAMERA_H__
#define __LIBCAMERA_CAMERA_H__
#include <memory>
#include <string>
namespace libcamera {
class Camera final
{
public:
static std::shared_ptr<Camera> create(const std::string &name);
Camera(const Camera &) = delete;
void operator=(const Camera &) = delete;
const std::string &name() const;
private:
explicit Camera(const std::string &name);
~Camera();
std::string name_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_CAMERA_H__ */