[XAudio2] avoid leak + fix voice creation for closest match
[xbmc.git] / xbmc / messaging / IMessageTarget.h
blob17adc8348ac213190ffc1beba77471414b7c9a94
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 namespace KODI
13 namespace MESSAGING
15 class ThreadMessage;
17 /*!
18 * \class IMessageTarget IMessageTarget.h "messaging/IMessageTarget.h"
19 * \brief A class wishing to receive messages should implement this
20 * and call \sa CApplicationMessenger::RegisterReceiver
21 * to start receiving messages
23 class IMessageTarget
25 public:
26 virtual ~IMessageTarget() = default;
27 /*!
28 * \brief Should return the message mask that it wishes to receive
29 * messages for
31 * The message mask is defined in "messaging/ApplicationMessenger.h"
32 * pick the next one available when creating a new
34 virtual int GetMessageMask() = 0;
36 /*!
37 * \brief This gets called whenever a message matching the registered
38 * message mask is processed.
40 * There are no ordering guarantees here so implementations should never
41 * rely on a certain ordering of messages.
43 * Cleaning up any pointers stored in the message payload is not specified
44 * and is decided by the implementer of the message.
45 * In general prefer to delete any data in this method to keep the callsites cleaner
46 * and simpler but if data is to be passed back it's perfectly valid to handle it any way
47 * that fits the situation as long as it's documented along with the message.
49 * To return a simple value the result parameter of \sa ThreadMessage can be used
50 * as it will be used as the return value for \sa CApplicationMessenger::SendMsg.
51 * It is up to the implementer to decide if this is to be used and it should be documented
52 * along with any new message implemented.
54 virtual void OnApplicationMessage(ThreadMessage* msg) = 0;