/*
** SellaNMS
** $Id: policy_statement_then.h,v 1.5 2006/01/24 07:08:09 sella Exp $
** Copyright (c) 2001-2005 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*/

#ifndef __POLICY_STATEMENT_THEN_H__
#define __POLICY_STATEMENT_THEN_H__

#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif

#include "then.h"
#include "map_statement.h"
#include "policy_statement.h"
#include "policy_statement_then_output.h"

typedef struct policy_call_t {
	string					policy;
	variable_binding_t	arguments;
};

class PolicyStatement;
class PolicyStatementThen: public Then {
	public:
		PolicyStatementThen();
		PolicyStatementThen(Then const &src);
		PolicyStatementThen(PolicyStatementThen const &src);

		RESULT setCompiledStatements(hash_map<string, PolicyStatement> *policies, hash_map<string, MapStatement> *maps);
		RESULT getAppliedMapStatements(slist<string> &map_names);
		
		virtual ~PolicyStatementThen();
		virtual Then const& operator=(Then const &src);
		virtual PolicyStatementThen const& operator=(PolicyStatementThen const &src);

		virtual ACTION evaluate(variable_binding_t &input);
		virtual RESULT compile(ConfigNode *config);

		virtual RESULT clear();
		virtual RESULT print(unsigned long depth = 0);

	private:
		hash_map<string, PolicyStatement>   *compiledPolicies;		
		hash_map<string, MapStatement>   	*compiledMaps;		
		
		ACTION									action;
		slist<string>							maps;
		variable_binding_t					variables;
		slist<PolicyStatementThenOutput>	outputs;
		slist<policy_call_t>					policies;
		slist<string>							counters;
};

#endif

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim:
** vim: noet ts=3 sw=3 sts=3
*/
