#ifndef _DATABASEHANDLES_H_ #define _DATABASEHANDLES_H_ /** @file DatabaseHandles.h @brief Header file for the DatabaseHandles class. @date $Date$ @version $Rev$ @author - Lance Deaver @copyright (©) Copyright 2006 by GATS Inc. 11864 Canon Blvd., Suite 101, Newport News, VA 23606 All Rights Reserved. No part of this software or publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise without the prior written permission of GATS Inc. @see gatsDBpp::GATS_DB @see gatsDBpp::ColData @bug None known $Id$ */ #include #include #include #include // forward declaration class CMarkup; namespace gatsDBpp { class DatabaseHandles; /** * @relates gatsDB::DatabaseHandles * @brief Creates a static DatabaseHandles instance and returns a pointer to that instance. */ DatabaseHandles* GetDatabaseHandles(); //forward declarations and typedefs class DBTable; class GATS_DB; typedef boost::shared_ptr GATS_DBptr; typedef boost::shared_ptr DBTable_ptr; class DatabaseHandles { public: /** * @brief Default DatabaseHandles constructor. */ DatabaseHandles(); /** * @brief The DatabaseHandles destructor. */ virtual ~DatabaseHandles(); /** * @brief Insert a GATS_DB Database connection handle into the class; */ void Add(const std::string& connectionName, GATS_DBptr dbhandle); /** * @brief Retrieve the GATS_DB Database connection handle. */ GATS_DBptr Get(const std::string& connectionName) ; /** * @brief Remove a GATS_DB database connection handle from the class. */ void Remove(const std::string& connectionName) ; /** * @brief Return the number of GATS_DB connection handles contained in this class. */ int NumberOfHandles() const ; /** * @brief Determine if a GATS_DB connection handle with a particular name exists in the class. */ bool HandleExists(const std::string& connectionName) const ; /** * @brief Return the names of all the GATS_DB connection handles in this class. */ std::vector GetHandleNames() const ; /** * @brief Establish one or more GATS_DB connection handles from data provided via XML data. */ void Init( CMarkup* _cmarkup, const bool clearit = true); /** * @brief Map out the description of a database table from data provided via XML. */ void InitTables(CMarkup* _cmarkup, const bool clearit =true); /** @brief Terminate all the established database connections handles */ void KillAll() ; private: std::map _DBMap; std::map _TableMap; }; } // namespace #endif //_DATABASEHANDLES_H_