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

#ifndef __COMPOSITECONTEXT_H
#include <iwear-context/compositecontext.h>
#endif

#ifndef __LOGICCONTEXTTERM_H
#include <iwear-context/logiccontextterm.h>
#endif

#ifndef __CONSTANTS_H
#include <iwear/constants.h>
#endif

using namespace std;

namespace iwear{
namespace context{

// forward declaration
class ContextManager;

/**
 * This is a subclass of CompositeContext. In this class the value of
 * the Context should be resolved.
 */
class LogicCompositeContext : public CompositeContext{
private:

    /**
     * A LogicContextTerm Object. With this Object can get the current 
     * value of the Context (with get_value method)
     */
    LogicContextTerm* logic_context_term;
protected:
public:

    /**
     * The constructor to be used to creat a new
     * LogicCompositeContext (with the name of the LogicCompositeContext).
     * @param string name
     */
    LogicCompositeContext(string name);
    
    /**
     * The destructor.
     */
    ~LogicCompositeContext(void);

    /**
     * Set the logic_context_term
     * @param LogicContextTerm new_logic_context_term
     */  
    inline void set_logic_context_term(LogicContextTerm* new_logic_context_term){
	this->logic_context_term = new_logic_context_term;
    }
    
    /**
     * Resolve the value of the Context. This method calls the
     * get_value method of LogicContextTerm to
     * get the current value of the Context and then compares this
     * with it's old value. If the context has changed, then set it's value
     * with the current value and return true.
     * It reimplements the resolve_context method of it's fatherclass
     * @return bool
     */
    bool resolve_context(void);

    /**
     * Get the logic_context_term
     * @return LogicContextTerm
     */
    inline LogicContextTerm* get_logic_context_term(void){
    	return this->logic_context_term;
    }
    
}; // class LogicCompositeContext
 
} // namespace context
} // namespace iwear
#endif // __LOGICCOMPOSITECONTEXT_H

