libcamera: Add parent argument to constructors of Object-derived classes
Now that the Object class implements parent-child relationships, make it possible to create EventNotifier and Timer instances with a parent by adding a parent argument to their constructors. 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>
This commit is contained in:
parent
2b25819ec0
commit
1554d0b6e6
4 changed files with 8 additions and 6 deletions
|
@ -23,7 +23,7 @@ public:
|
||||||
Exception,
|
Exception,
|
||||||
};
|
};
|
||||||
|
|
||||||
EventNotifier(int fd, Type type);
|
EventNotifier(int fd, Type type, Object *parent = nullptr);
|
||||||
virtual ~EventNotifier();
|
virtual ~EventNotifier();
|
||||||
|
|
||||||
Type type() const { return type_; }
|
Type type() const { return type_; }
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Message;
|
||||||
class Timer : public Object
|
class Timer : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Timer();
|
Timer(Object *parent = nullptr);
|
||||||
~Timer();
|
~Timer();
|
||||||
|
|
||||||
void start(unsigned int msec);
|
void start(unsigned int msec);
|
||||||
|
|
|
@ -61,9 +61,10 @@ namespace libcamera {
|
||||||
* \brief Construct an event notifier with a file descriptor and event type
|
* \brief Construct an event notifier with a file descriptor and event type
|
||||||
* \param[in] fd The file descriptor to monitor
|
* \param[in] fd The file descriptor to monitor
|
||||||
* \param[in] type The event type to monitor
|
* \param[in] type The event type to monitor
|
||||||
|
* \param[in] parent The parent Object
|
||||||
*/
|
*/
|
||||||
EventNotifier::EventNotifier(int fd, Type type)
|
EventNotifier::EventNotifier(int fd, Type type, Object *parent)
|
||||||
: fd_(fd), type_(type), enabled_(false)
|
: Object(parent), fd_(fd), type_(type), enabled_(false)
|
||||||
{
|
{
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,10 @@ LOG_DEFINE_CATEGORY(Timer)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Construct a timer
|
* \brief Construct a timer
|
||||||
|
* \param[in] parent The parent Object
|
||||||
*/
|
*/
|
||||||
Timer::Timer()
|
Timer::Timer(Object *parent)
|
||||||
: interval_(0), deadline_(0)
|
: Object(parent), interval_(0), deadline_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue