#ifndef TTABLE_H
# define TTABLE_H        5541

# ifndef STDCXX_HXX
#  include <stdcxx.hxx>
# endif
# ifndef STRING_H
#  include <_String.h>
# endif
# ifndef BLOCK_H
#  include <Block.h>
# endif
# ifndef RANGE_H
#  include <Range.h>
# endif
# ifndef OBJECTXXXH
#  include <Objection.h>
# endif

Rangedeclare(double)

Blockdeclare(float)
typedef Block(float)	B_f;
Blockdeclare(B_f)

class twotable_c {
			C Range(double) xr, yr;
			double xratio, yratio;
			C String name;
			BOOL upxok, dnxok, upyok, dnyok;
			Block(B_f) data;
			twotable_c();
			public:
			enum {No_outside=0, X_up=1, X_dn=2, Y_up=4, Y_dn=8};
			twotable_c(C Range(double)& xxr, C Range(double)& yyr,
						int nx, int ny,
						double (*f)(double x, double y, C void *p),
						C void *p=0, BITS ok=No_outside, C char *nm = 0);
			twotable_c(C Range(double)& xxr, C Range(double)& yyr,
						int nx, int ny, C short *C*d,
						BITS ok=No_outside, C char *nm = 0);
			twotable_c(C Range(double)& xxr, C Range(double)& yyr,
						int nx, int ny, C int *C*d,
						BITS ok=No_outside, C char *nm = 0);
			twotable_c(C Range(double)& xxr, C Range(double)& yyr,
						int nx, int ny, C float *C*d,
						BITS ok=No_outside, C char *nm = 0);
			double operator()(double x, double y) C;

			// The only Objection raised while evaluating
			// is for argument out of range.
			// The error-handler is passed a string which is
			// "table table_name: [x,y] [above,below] range: ###.###".
			// A return value of 1 from the error handler causes the
			// table to return either 'error_return' or
			// 'default_error_return'.
			static Objection default_error;
			static double default_error_return;
			Objection error;	// used if available
			double error_return;
			};

#endif
