/* * osgART/TrackerManager * osgART: AR ToolKit for OpenSceneGraph * * Copyright (c) 2005-2007 ARToolworks, Inc. All rights reserved. * * Rev Date Who Changes * 1.0 2006-12-08 --- Version 1.0 release. * */ /* * This file is part of osgART - AR Toolkit for OpenSceneGraph * * Copyright (c) 2005-2007 ARToolworks, Inc. All rights reserved. * * (See the AUTHORS file in the root of this distribution.) * * * OSGART 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. * * OSGART 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 OSGART; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef OSGART_TRACKERMANAGER #define OSGART_TRACKERMANAGER 1 // STL include #include // local include #include "osgART/Export" #include "osgART/GenericTracker" namespace osgART { /** * class TrackerManager. * */ class OSGART_EXPORT TrackerManager { public: /** * \brief singleton constructor. * Based on a singleton pattern, user can get the instance of the tracker manager * actually used by the program. * \return an instance of a tracker manager */ static TrackerManager* getInstance(); /** * \brief destructor. */ ~TrackerManager(); /** * \brief register a tracker. * Register in the tracker manager a tracker. * \param tracker the tracker to register * \return the id of the tracker */ int addTracker(GenericTracker* tracker); /** * \brief unregister a tracker. * Unregister a tracker from the tracker manager. * \param tracker the tracker to unregister */ void removeTracker(GenericTracker* tracker); /** * \brief obtain a tracker. * Return instance of a tracker identified by his id. * \return an instance of a tracker */ GenericTracker* getTracker(int idTracker); /** * Explicitly delete the instance of the Tracker. * This method will also destroy all attached * Tracker and free their memory if they are not * referenced any more. */ static void destroy(); /** * Creates and registers a tracker from an external plugin. * \param plugin name of the plugin (excluding the system specific extension) * \param trackerconfig configuration parameters for the tracker * \return pointer to the instance of the tracker */ static GenericTracker* createTrackerFromPlugin(const std::string& plugin); /** function signature for creating a tracker instance */ typedef GenericTracker* (*p_TrackerCreateFunc)(void); protected: TrackerManager(); typedef std::map > TrackerMap; int m_trackercount; TrackerMap m_trackermap; private: static TrackerManager* s_instance; }; }; #endif