/* teamtrack-record.h -- Python wrapper round TSRecord class
   Gareth Rees, Ravenbrook Limited, 2000-08-07
   $Id: //info.ravenbrook.com/project/p4dti/branch/2000-12-07/document-history/code/python-teamtrack-interface/teamtrack-record.h#2 $

   See "Python interface to TeamTrack: design" for the design
   <master/design/python-teamtrack-interface/>. */

/* Copyright 2000 Ravenbrook Limited.  This document is provided "as is",
   without any express or implied warranty. In no event will the authors
   be held liable for any damages arising from the use of this document.
   You may make and distribute copies and derivative works of this
   document provided that (1) you do not charge a fee for this document or
   for its distribution, and (2) you retain as they appear all copyright
   and licence notices and document history entries, and (3) you append
   descriptions of your modifications to the document history. */

#if !defined(TEAMTRACK_RECORD_H)
#define TEAMTRACK_RECORD_H


#include "teamtrack-python.h"
#include "teamtrack-server.h"
#include "TSRecord.h"


/* A teamtrack_record object is a Python wrapper around a TSRecord object. */

typedef struct {
  PyObject_HEAD
  TSRecord *r; /* The wrapped record. */
  teamtrack_server *server; /* Python wrapper round server this record belongs
                               to. */
  int delete_p; /* Delete the TSRecord object when Python wrapper deleted? */
} teamtrack_record;


/* teamtrack_record_type is the type object for teamtrack_record objects. */

extern PyTypeObject teamtrack_record_type;


/* teamtrack_record_p(x) is true iff x (which must be a Python object) is a
   teamtrack_record. */

#define teamtrack_record_p(x) ((x)->ob_type == &teamtrack_record_type)



/* teamtrack_record_new(r, server, delete_p) returns a Python wrapper for the
   TSRecord object r, or 0 if there is an error.  The server argument is the
   Python wrapper for the TSServer object to which the record belongs.  Iff
   delete_p is true, then the TSRecord object will be deleted when the Python
   wrapper is deleted. */

extern PyObject *
teamtrack_record_new(TSRecord *r, teamtrack_server *server, int delete_p);


#endif /* !defined(TEAMTRACK_RECORD_H) */


/* B. Document History

   2000-08-07  GDR  Created.

   2000-08-29  GDR  Changed "tTrack" to "TeamTrack" throughout.

   2000-08-31 GDR The Python wrapper round TSRecord now stores the Python
   wrapper around the TSServer object that the record belongs to.  This is so
   that the record object can provide add, update, submit and transition
   methods.

*/

