/**
 * File: contextxmlfactoryatomic.h
 * Created by: <Joern Reimerdes>
 * Created on: 2004/10/13 18:00
 * @file
 * $Id$
 * $Revision$
 * $Author$
 * $Date$
 *
 * This file is a part of The iWear Framework.
 * In particular is this file a part of the Framework context Library
 *
 * The iWear Framework 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 as in version 2 of the License.

 * 
 * The iWear Framework 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
 * The iWear Framework; if not, write to the Free Software Foundation, Inc., 59
 * Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __CONTEXT_XML_FACTORY_ATOMIC_H_
#define __CONTEXT_XML_FACTORY_ATOMIC_H_

#include <string>
#include <list>
#include <iwear-context/atomiccontext.h>
#include <iwear-context/atomicfactorysensor.h>
#include <iwear-context/contextxmlhandler.h>
#include <iwear-context/contextmanager.h>

using namespace std;
using namespace iwear::context;
using namespace iwear::xml;

namespace iwear{ 
namespace context{

/** The ContextXMLFactoryAtomic handles the creation of all
 * AtomicContexts.
 *
 * @note If you want to be able to use a new AtomicContext within the
 * context management system and if you want to specify the context
 * with xml you can write a new class that inherits from
 * AtomicFactoryInterface and integrate this class in the switch case
 * structure in this class. See AtomicFactorySensor and
 * AtomicFactoryLocation for examples.
 *
 */
class ContextXMLFactoryAtomic
{
public:

    /** Creates a new ContextXMLFactoryAtomic
     * @param ContextManager* context_manager The context manager that is
     *  userd to register contexts.
     * @param ContextXMLHandler* context_xml_handler The context xml
     *  handler for utility functions.
     */
    ContextXMLFactoryAtomic(ContextManager* context_manager, 
			    ContextXMLHandler* context_xml_handler);

    /** Destroys the context atomic factory for xml context definitions.
     *
     */
    virtual ~ContextXMLFactoryAtomic();

    /** 
     *
     */
    ContextObject* create_atomic_context(string context_name, 
					 DOMElement* atomic_context_node);
    
protected:

private:

    /** The Factory for AtomicSensorContexts.
     */
    AtomicFactorySensor* atomic_factory_sensor;
    
    /** Map for AtomicType XML names to enum values. */
    map<const string, AtomicType>* atomic_type_enum_map;

    /** The contextmanager to wich the parsed contexts should be
     * registered to.
     */
    ContextManager* context_manager;

    /** The ContextXMLHandler is used for dealing with xml files and DOM
     * trees. It has some helper methods to support the traversing of
     * the tree.
     * @note The instance will be deleted within the destructer of the
     *  ContextXMLParser.
     */
    ContextXMLHandler* context_xml_handler;
    

}; // ContextXMLFactoryAtomic
}  // context
}  // iwear

#endif	//__CONTEXT_XML_FACTORY_ATOMIC_H_
