From a48a000a3304830e1ccbbc400209ba6e317b45c4 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 7 Apr 2021 15:48:59 +0300 Subject: libcamera: Rename 'method' to 'function' Usage of 'method' to refer to member functions comes from Java. The C++ standard uses the term 'function' only. Replace 'method' with 'function' or 'member function' through the whole code base and documentation. While at it, fix two typos (s/backeng/backend/). The BoundMethod and Object::invokeMethod() are left as-is here, and will be addressed separately. Signed-off-by: Laurent Pinchart Reviewed-by: Paul Elder Acked-by: Kieran Bingham --- src/libcamera/base/event_dispatcher_poll.cpp | 2 +- src/libcamera/base/log.cpp | 12 ++++----- src/libcamera/base/message.cpp | 6 ++--- src/libcamera/base/object.cpp | 22 +++++++-------- src/libcamera/base/semaphore.cpp | 16 +++++------ src/libcamera/base/signal.cpp | 2 +- src/libcamera/base/thread.cpp | 40 ++++++++++++++-------------- 7 files changed, 50 insertions(+), 50 deletions(-) (limited to 'src/libcamera/base') diff --git a/src/libcamera/base/event_dispatcher_poll.cpp b/src/libcamera/base/event_dispatcher_poll.cpp index 5839373a..4f22f579 100644 --- a/src/libcamera/base/event_dispatcher_poll.cpp +++ b/src/libcamera/base/event_dispatcher_poll.cpp @@ -101,7 +101,7 @@ void EventDispatcherPoll::unregisterEventNotifier(EventNotifier *notifier) set.notifiers[type] = nullptr; /* - * Don't race with event processing if this method is called from an + * Don't race with event processing if this function is called from an * event notifier. The notifiers_ entry will be erased by * processEvents(). */ diff --git a/src/libcamera/base/log.cpp b/src/libcamera/base/log.cpp index 1801ae26..073b7c34 100644 --- a/src/libcamera/base/log.cpp +++ b/src/libcamera/base/log.cpp @@ -423,7 +423,7 @@ void Logger::backtrace() msg << "Backtrace:" << std::endl; /* - * Skip the first two entries that correspond to this method and + * Skip the first two entries that correspond to this function and * ~LogMessage(). */ for (int i = 2; i < num_entries; ++i) @@ -865,9 +865,9 @@ LogMessage::~LogMessage() * * The Loggable class allows classes to extend log messages without any change * to the way the LOG() macro is invoked. By inheriting from Loggable and - * implementing the logPrefix() virtual method, a class can specify extra + * implementing the logPrefix() virtual function, a class can specify extra * information to be automatically added to messages logged from class member - * methods. + * function. */ Loggable::~Loggable() @@ -878,7 +878,7 @@ Loggable::~Loggable() * \fn Loggable::logPrefix() * \brief Retrieve a string to be prefixed to the log message * - * This method allows classes inheriting from the Loggable class to extend the + * This function allows classes inheriting from the Loggable class to extend the * logger with an object-specific prefix output right before the log message * contents. * @@ -892,7 +892,7 @@ Loggable::~Loggable() * \param[in] fileName The file name where the message is logged from * \param[in] line The line number where the message is logged from * - * This method is used as a backeng by the LOG() macro to create a log message + * This function is used as a backend by the LOG() macro to create a log message * for locations inheriting from the Loggable class. * * \return A log message @@ -915,7 +915,7 @@ LogMessage Loggable::_log(const LogCategory *category, LogSeverity severity, * \param[in] fileName The file name where the message is logged from * \param[in] line The line number where the message is logged from * - * This function is used as a backeng by the LOG() macro to create a log + * This function is used as a backend by the LOG() macro to create a log * message for locations not inheriting from the Loggable class. * * \return A log message diff --git a/src/libcamera/base/message.cpp b/src/libcamera/base/message.cpp index f1d772e4..2da2a7ed 100644 --- a/src/libcamera/base/message.cpp +++ b/src/libcamera/base/message.cpp @@ -24,7 +24,7 @@ * thus the message shall not store any temporary data. * * The message is delivered in the context of the object's thread, through the - * Object::message() virtual method. After delivery the message is + * Object::message() virtual function. After delivery the message is * automatically deleted. */ @@ -84,10 +84,10 @@ Message::~Message() * * 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 + * problem, this function reserves and returns the next available user-defined * message type. * - * The recommended way to use this method is to subclass Message and provide a + * The recommended way to use this function is to subclass Message and provide a * static accessor for the custom message type. * * \code{.cpp} diff --git a/src/libcamera/base/object.cpp b/src/libcamera/base/object.cpp index 25410ecd..3f28768e 100644 --- a/src/libcamera/base/object.cpp +++ b/src/libcamera/base/object.cpp @@ -145,8 +145,8 @@ void Object::deleteLater() * \brief Post a message to the object's thread * \param[in] msg The message * - * This method posts the message \a msg to the message queue of the object's - * thread, to be delivered to the object through the message() method in the + * This function posts the message \a msg to the message queue of the object's + * thread, to be delivered to the object through the message() function in the * context of its thread. Message ownership is passed to the thread, and the * message will be deleted after being delivered. * @@ -169,13 +169,13 @@ void Object::postMessage(std::unique_ptr msg) * \brief Message handler for the object * \param[in] msg The message * - * This virtual method receives messages for the object. It is called in the + * This virtual function receives messages for the object. It is called in the * context of the object's thread, and can be overridden to process custom - * messages. The parent Object::message() method shall be called for any - * message not handled by the override method. + * messages. The parent Object::message() function shall be called for any + * message not handled by the override function. * * The message \a msg is valid only for the duration of the call, no reference - * to it shall be kept after this method returns. + * to it shall be kept after this function returns. */ void Object::message(Message *msg) { @@ -207,7 +207,7 @@ void Object::message(Message *msg) * \param[in] type Connection type for method invocation * \param[in] args The method arguments * - * This method invokes the member method \a func with arguments \a args, based + * This function invokes the member method \a func with arguments \a args, based * on the connection \a type. Depending on the type, the method will be called * synchronously in the same thread or asynchronously in the object's thread. * @@ -237,12 +237,12 @@ void Object::message(Message *msg) * \brief Move the object and all its children to a different thread * \param[in] thread The target thread * - * This method moves the object and all its children from the current thread to - * the new \a thread. + * This function moves the object and all its children from the current thread + * to the new \a thread. * * Before the object is moved, a Message::ThreadMoveMessage message is sent to - * it. The message() method can be reimplement in derived classes to be notified - * of the upcoming thread move and perform any required processing. + * it. The message() function can be reimplement in derived classes to be + * notified of the upcoming thread move and perform any required processing. * * Moving an object that has a parent is not allowed, and causes undefined * behaviour. diff --git a/src/libcamera/base/semaphore.cpp b/src/libcamera/base/semaphore.cpp index 7aedc6a8..bf730c87 100644 --- a/src/libcamera/base/semaphore.cpp +++ b/src/libcamera/base/semaphore.cpp @@ -21,10 +21,10 @@ namespace libcamera { * * A semaphore is a locking primitive that protects resources. It is created * with an initial number of resources (which may be 0), and offers two - * primitives to acquire and release resources. The acquire() method tries to + * primitives to acquire and release resources. The acquire() function tries to * acquire a number of resources, and blocks if not enough resources are - * available until they get released. The release() method releases a number of - * resources, waking up any consumer blocked on an acquire() call. + * available until they get released. The release() function releases a number + * of resources, waking up any consumer blocked on an acquire() call. */ /** @@ -50,7 +50,7 @@ unsigned int Semaphore::available() * \brief Acquire \a n resources * \param[in] n The resource count * - * This method attempts to acquire \a n resources. If \a n is higher than the + * This function attempts to acquire \a n resources. If \a n is higher than the * number of available resources, the call will block until enough resources * become available. */ @@ -65,7 +65,7 @@ void Semaphore::acquire(unsigned int n) * \brief Try to acquire \a n resources without blocking * \param[in] n The resource count * - * This method attempts to acquire \a n resources. If \a n is higher than the + * This function attempts to acquire \a n resources. If \a n is higher than the * number of available resources, it returns false immediately without * acquiring any resource. Otherwise it acquires the resources and returns * true. @@ -86,9 +86,9 @@ bool Semaphore::tryAcquire(unsigned int n) * \brief Release \a n resources * \param[in] n The resource count * - * This method releases \a n resources, increasing the available resource count - * by \a n. If the number of available resources becomes large enough for any - * consumer blocked on an acquire() call, those consumers get woken up. + * This function releases \a n resources, increasing the available resource + * count by \a n. If the number of available resources becomes large enough for + * any consumer blocked on an acquire() call, those consumers get woken up. */ void Semaphore::release(unsigned int n) { diff --git a/src/libcamera/base/signal.cpp b/src/libcamera/base/signal.cpp index 298b2d4b..adcfa796 100644 --- a/src/libcamera/base/signal.cpp +++ b/src/libcamera/base/signal.cpp @@ -102,7 +102,7 @@ SignalBase::SlotList SignalBase::slots() * emitted from the same thread, the slot will be called synchronously, before * Signal::emit() returns. If the signal is emitted from a different thread, * the slot will be called asynchronously from the object's thread's event - * loop, after the Signal::emit() method returns, with a copy of the signal's + * loop, after the Signal::emit() function returns, with a copy of the signal's * arguments. The emitter shall thus ensure that any pointer or reference * passed through the signal will remain valid after the signal is emitted. */ diff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp index 1232f895..bd7b7391 100644 --- a/src/libcamera/base/thread.cpp +++ b/src/libcamera/base/thread.cpp @@ -222,7 +222,7 @@ ThreadData *ThreadData::current() * The Thread class is a wrapper around std::thread that handles integration * with the Object, Signal and EventDispatcher classes. * - * Thread instances by default run an event loop until the exit() method is + * Thread instances by default run an event loop until the exit() function is * called. The event loop dispatches events (messages, notifiers and timers) * sent to the objects living in the thread. This behaviour can be modified by * overriding the run() function. @@ -318,7 +318,7 @@ void Thread::startThread() }; /* - * Make sure the thread is cleaned up even if the run method exits + * Make sure the thread is cleaned up even if the run() function exits * abnormally (for instance via a direct call to pthread_cancel()). */ thread_local ThreadCleaner cleaner(this, &Thread::finishThread); @@ -332,12 +332,12 @@ void Thread::startThread() /** * \brief Enter the event loop * - * This method enters an event loop based on the event dispatcher instance for - * the thread, and blocks until the exit() method is called. It is meant to be - * called within the thread from the run() method and shall not be called + * This function enters an event loop based on the event dispatcher instance for + * the thread, and blocks until the exit() function is called. It is meant to be + * called within the thread from the run() function and shall not be called * outside of the thread. * - * \return The exit code passed to the exit() method + * \return The exit code passed to the exit() function */ int Thread::exec() { @@ -356,14 +356,14 @@ int Thread::exec() } /** - * \brief Main method of the thread + * \brief Main function of the thread * - * When the thread is started with start(), it calls this method in the context - * of the new thread. The run() method can be overridden to perform custom - * work, either custom initialization and cleanup before and after calling the - * Thread::exec() function, or a custom thread loop altogether. When this - * method returns the thread execution is stopped, and the \ref finished signal - * is emitted. + * When the thread is started with start(), it calls this function in the + * context of the new thread. The run() function can be overridden to perform + * custom work, either custom initialization and cleanup before and after + * calling the Thread::exec() function, or a custom thread loop altogether. When + * this function returns the thread execution is stopped, and the \ref finished + * signal is emitted. * * Note that if this function is overridden and doesn't call Thread::exec(), no * events will be dispatched to the objects living in the thread. These objects @@ -392,10 +392,10 @@ void Thread::finishThread() * \brief Stop the thread's event loop * \param[in] code The exit code * - * This method interrupts the event loop started by the exec() method, causing - * exec() to return \a code. + * This function interrupts the event loop started by the exec() function, + * causing exec() to return \a code. * - * Calling exit() on a thread that reimplements the run() method and doesn't + * Calling exit() on a thread that reimplements the run() function and doesn't * call exec() will likely have no effect. * * \context This function is \threadsafe. @@ -449,8 +449,8 @@ bool Thread::wait(utils::duration duration) * \brief Check if the thread is running * * A Thread instance is considered as running once the underlying thread has - * started. This method guarantees that it returns true after the start() - * method returns, and false after the wait() method returns. + * started. This function guarantees that it returns true after the start() + * function returns, and false after the wait() function returns. * * \context This function is \threadsafe. * @@ -518,8 +518,8 @@ EventDispatcher *Thread::eventDispatcher() * \param[in] msg The message * \param[in] receiver The receiver * - * This method stores the message \a msg in the message queue of the thread for - * the \a receiver and wake up the thread's event loop. Message ownership is + * This function stores the message \a msg in the message queue of the thread + * for the \a receiver and wake up the thread's event loop. Message ownership is * passed to the thread, and the message will be deleted after being delivered. * * Messages are delivered through the thread's event loop. If the thread is not -- cgit v1.2.1