2013-04-17 22:58:33 +02:00
|
|
|
/*
|
2014-01-13 22:30:36 +01:00
|
|
|
* Copyright (C) 2003-2014 The Music Player Daemon Project
|
2013-04-17 22:58:33 +02:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MPD_INSTANCE_HXX
|
|
|
|
#define MPD_INSTANCE_HXX
|
|
|
|
|
|
|
|
#include "check.h"
|
2014-01-11 01:01:54 +01:00
|
|
|
#include "Compiler.h"
|
2013-04-17 22:58:33 +02:00
|
|
|
|
2014-01-18 16:36:42 +01:00
|
|
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
|
|
|
#include "neighbor/Listener.hxx"
|
|
|
|
class NeighborGlue;
|
|
|
|
#endif
|
|
|
|
|
2014-01-30 20:29:48 +01:00
|
|
|
#ifdef ENABLE_DATABASE
|
|
|
|
#include "db/DatabaseListener.hxx"
|
2014-01-29 20:16:43 +01:00
|
|
|
class UpdateService;
|
2014-01-30 20:29:48 +01:00
|
|
|
#endif
|
|
|
|
|
2013-04-17 22:58:33 +02:00
|
|
|
class ClientList;
|
|
|
|
struct Partition;
|
|
|
|
|
2014-01-18 16:36:42 +01:00
|
|
|
struct Instance final
|
2014-01-30 20:29:48 +01:00
|
|
|
#if defined(ENABLE_DATABASE) || defined(ENABLE_NEIGHBOR_PLUGINS)
|
|
|
|
:
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_DATABASE
|
|
|
|
public DatabaseListener
|
2014-01-18 16:36:42 +01:00
|
|
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
2014-01-30 20:29:48 +01:00
|
|
|
,
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
|
|
|
public NeighborListener
|
2014-01-18 16:36:42 +01:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
|
|
|
NeighborGlue *neighbors;
|
|
|
|
#endif
|
|
|
|
|
2014-01-30 20:29:48 +01:00
|
|
|
#ifdef ENABLE_DATABASE
|
2014-01-29 20:16:43 +01:00
|
|
|
UpdateService *update;
|
2014-01-30 20:29:48 +01:00
|
|
|
#endif
|
2014-01-29 20:16:43 +01:00
|
|
|
|
2013-04-17 22:58:33 +02:00
|
|
|
ClientList *client_list;
|
|
|
|
|
|
|
|
Partition *partition;
|
|
|
|
|
2014-02-04 10:09:09 +01:00
|
|
|
Instance() {
|
|
|
|
#ifdef ENABLE_DATABASE
|
|
|
|
update = nullptr;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-01-30 20:29:48 +01:00
|
|
|
#ifdef ENABLE_DATABASE
|
|
|
|
|
2014-01-07 21:39:47 +01:00
|
|
|
void DeleteSong(const char *uri);
|
2013-04-17 22:58:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The database has been modified. Propagate the change to
|
|
|
|
* all subsystems.
|
|
|
|
*/
|
|
|
|
void DatabaseModified();
|
|
|
|
|
2014-01-30 20:29:48 +01:00
|
|
|
#endif
|
|
|
|
|
2013-04-17 22:58:33 +02:00
|
|
|
/**
|
2013-10-21 23:22:16 +02:00
|
|
|
* A tag in the play queue has been modified by the player
|
|
|
|
* thread. Propagate the change to all subsystems.
|
2013-04-17 22:58:33 +02:00
|
|
|
*/
|
|
|
|
void TagModified();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronize the player with the play queue.
|
|
|
|
*/
|
|
|
|
void SyncWithPlayer();
|
2014-01-11 01:01:54 +01:00
|
|
|
|
|
|
|
private:
|
2014-01-30 20:29:48 +01:00
|
|
|
#ifdef ENABLE_DATABASE
|
2014-01-11 01:01:54 +01:00
|
|
|
virtual void OnDatabaseModified();
|
2014-01-30 20:29:48 +01:00
|
|
|
#endif
|
2014-01-18 16:36:42 +01:00
|
|
|
|
|
|
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
|
|
|
/* virtual methods from class NeighborListener */
|
|
|
|
virtual void FoundNeighbor(const NeighborInfo &info) override;
|
|
|
|
virtual void LostNeighbor(const NeighborInfo &info) override;
|
|
|
|
#endif
|
2013-04-17 22:58:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|