/**
 * @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 __CONTEXTENUMS_H
#define __CONTEXTENUMS_H

#include <ostream>
extern "C" {
#include <stdint.h>
}


namespace iwear{
namespace context{

    enum ContextType{
	COMPOSITE,
	ATOMIC,
	num_ContextType
    };

    inline const char * to_string( ContextType ct )/*{{{*/
    {
	switch(ct)
	{
	    case COMPOSITE:
		return "iwear::context::ContextType::COMPOSITE";
		break;
	    case ATOMIC:
		return "iwear::context::ContextType::ATOMIC";
		break;
	    case num_ContextType:
		return "iwear::context::ContextType::num_ContextType";
		break;
	    default:
		return "iwear::context::ContextType::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, ContextType ct)/*{{{*/
    {
	o << to_string(ct);
	o << "(";
	o << (uint32_t)ct << ")";
	return o;
    }/*}}}*/

    enum AtomicType{
	SENSOR,
	DATABASE,
	POWER,
	LOCATION,
	num_AtomicType
    };
    
    inline const char * to_string( AtomicType at )/*{{{*/
    {
	switch(at)
	{
	    case SENSOR:
		return "iwear::context::AtomicType::SENSOR";
		break;
	    case DATABASE:
		return "iwear::context::AtomicType::DATABASE";
		break;
	    case POWER:
		return "iwear::context::AtomicType::POWER";
		break;
	    case num_AtomicType:
		return "iwear::context::AtomicType::num_AtomicType";
		break;
	    default:
		return "iwear::context::AtomicType::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, AtomicType at)/*{{{*/
    {
	o << to_string(at);
	o << "(";
	o << (uint32_t)at << ")";
	return o;
    }/*}}}*/

    /**
     * The different subclasses of AtomicContext.
     */
    enum SensorType{
	TEMPERATURE,
	LOUDNESS,
	BRIGHTNESS,
	TIME,
	SYSLOAD,
	num_SensorType
    };

    inline const char * to_string( SensorType st )/*{{{*/
    {
	switch(st)
	{
	    case TEMPERATURE:
		return "iwear::context::SensorType::TEMPERATURE";
		break;
	    case LOUDNESS:
		return "iwear::context::SensorType::LOUDNESS";
		break;
	    case BRIGHTNESS:
		return "iwear::context::SensorType::BRIGHTNESS";
		break;
	    case TIME:
		return "iwear::context::SensorType::TIME";
		break;
	    case SYSLOAD:
		return "iwear::context::SensorType::SYSLOAD";
		break;
	    case num_SensorType:
		return "iwear::context::SensorType::num_SensorType";
		break;
	    default:
		return "iwear::context::SensorType::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, SensorType st)/*{{{*/
    {
	o << to_string(st);
	o << "(";
	o << (uint32_t)st << ")";
	return o;
    }/*}}}*/
    
    /**
     * The different subclasses of AtomicContext.
     */
    enum CompositeType{
	LOGIC,
	num_CompositeType
    };

    inline const char * to_string( CompositeType ct )/*{{{*/
    {
	switch(ct)
	{
	    case LOGIC:
		return "iwear::context::CompositeType::LOGIC";
		break;
	    case num_CompositeType:
		return "iwear::context::CompositeType::num_CompositeType";
		break;
	    default:
		return "iwear::context::CompositeType::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, CompositeType ct)/*{{{*/
    {
	o << to_string(ct);
	o << "(";
	o << (uint32_t)ct << ")";
	return o;
    }/*}}}*/

    /** 
     * Enumeration for the value types of a context that is specified
     * in XML.
     */
    enum ContextValueType{
	BOOLEAN,
	DATE,
	NOMINAL,
	ORDINAL,
	DISCRETE,
	CONTINOUS,
	num_ContextValueType
    };

    inline const char * to_string( ContextValueType cvt )/*{{{*/
    {
	switch(cvt)
	{
	    case BOOLEAN:
		return "iwear::context::ContextValueType::BOOLEAN";
		break;
	    case DATE:
		return "iwear::context::ContextValueType::DATE";
		break;
	    case NOMINAL:
		return "iwear::context::ContextValueType::NOMINAL";
		break;
	    case ORDINAL:
		return "iwear::context::ContextValueType::ORDINAL";
		break;
	    case DISCRETE:
		return "iwear::context::ContextValueType::DISCRETE";
		break;
	    case CONTINOUS:
		return "iwear::context::ContextValueType::CONTINOUS";
		break;
	    case num_ContextValueType:
		return "iwear::context::ContextValueType::num_ContextValueType";
		break;
	    default:
		return "iwear::context::ContextValueType::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, ContextValueType cvt)/*{{{*/
    {
	o << to_string(cvt);
	o << "(";
	o << (uint32_t)cvt << ")";
	return o;
    }/*}}}*/


    enum Comparison{
	EQUALS,
	NOT_EQUALS,
	GREATER,
	LOWER,
	GREATER_EQUALS,
	LOWER_EQUALS,
	num_Comparison
    };

    inline const char * to_string( Comparison c )/*{{{*/
    {
	switch(c)
	{
	    case EQUALS:
		return "iwear::context::Comparison::EQUALS";
		break;
	    case NOT_EQUALS:
		return "iwear::context::Comparison::NOT_EQUALS";
		break;
	    case GREATER:
		return "iwear::context::Comparison::GREATER";
		break;
	    case LOWER:
		return "iwear::context::Comparison::LOWER";
		break;
	    case GREATER_EQUALS:
		return "iwear::context::Comparison::GREATER_EQUALS";
		break;
	    case LOWER_EQUALS:
		return "iwear::context::Comparison::LOWER_EQUALS";
		break;
	    case num_Comparison:
		return "iwear::context::Comparison::num_Comparison";
		break;
	    default:
		return "iwear::context::Comparison::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, Comparison c)/*{{{*/
    {
	o << to_string(c);
	o << "(";
	o << (uint32_t)c << ")";
	return o;
    }/*}}}*/

    enum LogicRelation{
	AND,
	OR,
	num_LogicRelation
    };

    inline const char * to_string( LogicRelation lr )/*{{{*/
    {
	switch(lr)
	{
	    case AND:
		return "iwear::context::LogicRelation::AND";
		break;
	    case OR:
		return "iwear::context::LogicRelation::OR";
		break;
	    case num_LogicRelation:
		return "iwear::context::LogicRelation::num_LogicRelation";
		break;
	    default:
		return "iwear::context::LogicRelation::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, LogicRelation lr)/*{{{*/
    {
	o << to_string(lr);
	o << "(";
	o << (uint32_t)lr << ")";
	return o;
    }/*}}}*/


    enum LocationType{
	COORDINATE,
	SYMBOL,
	num_LocationType
    };

    inline const char * to_string( LocationType lt )/*{{{*/
    {
	switch(lt)
	{
	    case COORDINATE:
		return "iwear::context::LocationType::COORDINATE";
		break;
	    case SYMBOL:
		return "iwear::context::LocationType::SYMBOL";
		break;
	    case num_LocationType:
		return "iwear::context::LocationType::num_LocationType";
		break;
	    default:
		return "iwear::context::LocationType::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, LocationType lt)/*{{{*/
    {
	o << to_string(lt);
	o << "(";
	o << (uint32_t)lt << ")";
	return o;
    }/*}}}*/

    enum TimeSpan{/*{{{*/
	SECOND,
	MINUTE,
	HOUR,
	DAY,
	WEEK,
	MONTH,
	YEAR,
	num_TimeSpan
    };/*}}}*/

    inline const char * to_string( TimeSpan lt )/*{{{*/
    {
	switch(lt)
	{
	    case SECOND:
		return "iwear::context::TimeSpan::SECOND";
		break;
	    case MINUTE:
		return "iwear::context::TimeSpan::MINUTE";
		break;
	    case HOUR:
		return "iwear::context::TimeSpan::HOUR";
		break;
	    case DAY:
		return "iwear::context::TimeSpan::DAY";
		break;
	    case WEEK:
		return "iwear::context::TimeSpan::WEEK";
		break;
	    case MONTH:
		return "iwear::context::TimeSpan::MONTH";
		break;
	    case YEAR:
		return "iwear::context::TimeSpan::YEAR";
		break;
	    case num_TimeSpan:
		return "iwear::context::TimeSpan::num_TimeSpan";
		break;
	    default:
		return "iwear::context::TimeSpan::<invalid value>";
		break;
	}
    }/*}}}*/

    inline std::ostream& operator<<(std::ostream& o, TimeSpan lt)/*{{{*/
    {
	o << to_string(lt);
	o << "(";
	o << (uint32_t)lt << ")";
	return o;
    }/*}}}*/

} // namespace context
} // namespace iwear

#endif //__CONTEXTENUMS_H

