/* NMM - Network-Integrated Multimedia Middleware
*
* Copyright (C) 2002-2005
* NMM work group,
* Computer Graphics Lab,
* Saarland University, Germany
* http://www.networkmultimedia.org
*
* Maintainer: Michael Repplinger <repplinger@cs.uni-sb.de>
* Marco Lohse <mlohse@cs.uni-sb.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include <iostream>
#include "ClientRegistry.hpp"
#include "nmm/base/registry/PluginManager.hpp"
#include "nmm/base/NMMApplication.hpp"
#include "nmm/base/registry/Plugin.hpp"
#include "nmm/base/ProxyObject.hpp"
#include "nmm/interfaces/net/IObjectAcceptor.hpp"
#include "nmm/base/sync/MasterSlaveSourceSynchronizer.hpp"
#include "nmm/base/sync/MultiAudioVideoSynchronizer.hpp"
#include "nmm/utils/utils.hpp"
#include "nmm/base/proxy/tcp/TCPStrategy.hpp"
namespace NMM {
ClientRegistry::ClientRegistry()
: NamedObject("ClientRegistry"), __is_running(true), __init_transaction(false), __condition(__condition_mutex), __time_interval(5), __member_mutex(ThreadMutex::RECURSIVE)
{
/* Stores a pointer to the PluginManager in this address space. This is need for
* local optimization
*/
/* __internal_p_manager.reset(SPluginManager::getInstance().getInterface<IPluginManager>());*/
NMMObject* tmp_object =
dynamic_cast<NMMObject*>(&SPluginManager::getInstance());
__internal_p_manager.reset(tmp_object->getInterface<IPluginManager>());
/* start the thread to refresh ressource reservation */
activateThread();
}
ClientRegistry::~ClientRegistry() {
/* Begin> Deactivate the thread*/
__condition_mutex.lock();
__is_running = false; // set the running flag to false
__condition.notify(); // and notify the thread
__condition_mutex.unlock();
deactivateThread(); // wait until thread terminates
/* End< */
/* Begin> delete the interfaces the ClientRegistry use*/
for (RegistryIt it = __named_registry.begin(); it != __named_registry.end(); ++it) {
delete it->second.server_registry; //delete the IServerRegistry
delete it->second.plugin_manager; //delete the corresponding IPluginManager
}
/* End < */
}