/*
** SellaNMS
** $Id: policy_framework.h,v 1.7 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_FRAMEWORK_H__
#define __POLICY_FRAMEWORK_H__

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

#include "policy_statement.h"
#include "format_statement.h"
#include "map_statement.h"

#include <stl/slist>
#include <stl/string>
#include <stl/hash_map>

class PolicyFramework {
	public:
		PolicyFramework();

		ACTION evaluate(variable_binding_t &output, slist<variable_binding_t> &input_list);
		ACTION evaluate(variable_binding_t &output, variable_binding_t &input);

		RESULT addPolicies(ConfigNode *config, vector<string> &policy_names);
		RESULT getReferencedVariables(variable_reference_t &referenced);

		bool   empty();
		RESULT clear();
		RESULT print(unsigned long depth = 0);
		RESULT printVariableBinding(variable_binding_t &policy);

	protected:
		RESULT addMap(ConfigNode *config, string &map_name);
		RESULT addFormat(ConfigNode *config, string &format_name);
		RESULT addPolicy(ConfigNode *config, string &policy_name);

	private:
		Storage										storage;

		slist<string>								appliedPolicyStatements;
		
		hash_map<string, MapStatement>		mapStatements;
		hash_map<string, FormatStatement>	formatStatements;
		hash_map<string, PolicyStatement>	policyStatements;
};

#endif

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