/* This is -*- C -*- */
/* vim: set sw=2: */
/* $Id$ */

/*
 * template.h
 *
 * Copyright (C) 2003 The Free Software Foundation, Inc.
 *
 */

/*
 * This program 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; either version 2 of the
 * License, or (at your option) any later version.
 * 
 * This program 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA.
 */

#ifndef __TEMPLATE_H__
#define __TEMPLATE_H__

#include <glib.h>
#include <Python.h>

#include "fragment.h"

typedef struct _Template Template;
struct _Template {
  int refs;
  GPtrArray *fragments;
};

#define template_length(tpl) ((tpl) ? (tpl)->fragments->len : -1)

Template *template_new    (void);
Template *template_ref    (Template *tpl);
void      template_unref  (Template *tpl);

Fragment *template_get    (Template *tpl, int i);
void      template_append (Template *tpl, Fragment *f);

gboolean  template_is_blank         (Template *tpl);
double    template_get_metric_error (Template *tpl);

Fragment *template_next_fragment (Template *tpl);
Template *template_solve         (Template *tpl,
				  Markov *m,
				  double max_metric_error);

void      template_spew (Template *tpl);

PyObject *template_to_py   (Template *tpl);
Template *template_from_py (PyObject *obj);

/* Python Extensions */

PyObject *py_template_new (PyObject *self, PyObject *args);


#endif /* __TEMPLATE_H__ */

