omni::log::ILogChannelFilterList

Defined in omni/log/ILogChannelFilter.h

class omni::log::ILogChannelFilterList : public omni::core::Generated<omni::log::ILogChannelFilterList_abi>

A list of channel filters that will be applied as channels are added to the log.

This object is a list of ILogChannelFilter objects. Filters can be added, removed, and replaced.

This object can be attached to one or more ILog objects. As channels are added to the ILog, this object will apply its filters, thereby setting the new channel’s state.

If multiple filters match a channel, only the first filter’s settings will be applied.

This API is thread safe.

Public Functions

inline void append(omni::core::ObjectParam<omni::log::ILogChannelFilter> filter) noexcept

Adds a filter to the end of the filter list.

This method is thread safe.

inline std::vector<omni::core::ObjectPtr<omni::log::ILogChannelFilter>> getFilters() noexcept

Returns the list of filters.

This method is thread safe.

inline void insert(uint32_t index, omni::core::ObjectParam<omni::log::ILogChannelFilter> filter) noexcept

Inserts the given filter at the given index.

Existing filters at and after the given index are moved to the next slot in the list.

If index is equal to or greater than the number of existing filters, the given filter is added to the end of the filter list.

The given filter must not be nullptr.

This method is thread safe.

inline omni::core::Result replace(uint32_t index, omni::core::ObjectParam<omni::log::ILogChannelFilter> oldFilter, omni::core::ObjectParam<omni::log::ILogChannelFilter> newFilter) noexcept

Replace the filter at the given index with a new filter.

oldFilter is the current filter at index while newFilter is the filter to replace the old filter.

If oldFilter is not currently at index, it is assumed another thread has modified the list. In this case, this function does nothing and returns kResultInvalidState.

oldFilter and newFilter must not be nullptr.

Returns kResultSuccess if the filter was successfully replaced.

This method is thread safe.

inline omni::core::Result remove(uint32_t index, omni::core::ObjectParam<omni::log::ILogChannelFilter> filter) noexcept

Removes the filter at the given index.

If filter is not currently at index, it is assumed another thread has modified the list. In this case, this function does nothing and returns kResultInvalidState.

filter must not be nullptr.

Returns kResultSuccess if the filter was successfully replaced.

This method is thread safe.

inline void apply(omni::core::ObjectParam<omni::log::ILog> log, omni::str::IReadOnlyCString *const *channels, uint32_t channelsCount) noexcept

Applies each filter to the given list of channels.

log must not be nullptr.

channels is an array of channel names in the given log. This object will apply all filters to each channel.

If the channels array is nullptr, this method will call ILog::getChannelNames() to get the list of channels.

This method is thread safe.

inline void addUpdateConsumer(omni::core::ObjectParam<omni::log::ILogChannelFilterListUpdateConsumer> consumer) noexcept

Adds an update consumer to this list.

This added consumer will be notified each time an filter is added, removed, or replaced in this list.

The given consumer may be notified in parallel.

Notifications may be consolidated (i.e. multiple items in the list were updated).

The given consumer may be notified spuriously.

consumer must not be nullptr.

This method is thread safe.

inline omni::core::ObjectPtr<omni::log::ILogChannelFilterListUpdateConsumer> addUpdateConsumer(std::function<void(omni::log::ILogChannelFilterList *list)> fun) noexcept

Adds an update consumer to this list.

This added consumer will be notified each time an filter is added, removed, or replaced in this list.

The given consumer may be notified in parallel.

Notifications may be consolidated (i.e. multiple items in the list were updated).

The given consumer may be notified spuriously.

consumer must not be nullptr.

This method is thread safe.

inline void removeUpdateConsumer(omni::core::ObjectParam<omni::log::ILogChannelFilterListUpdateConsumer> consumer) noexcept

Removes the given consumer from the internal consumer list.

This method silently accepts nullptr.

This method silently accepts consumers that have not been registered with this object.

Calling ILog::removeOnMessageConsumer() from ILogOnMessageConsumer::onMessage_abi() will lead to undefined behavior.

This method is thread safe.

inline void clear() noexcept

Removes all filters from this list.

This method is thread safe.