/* Template.c  -- example implementation of OOPS class

	THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
	"UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
	AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
	CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
	PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
	RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.

Author:
	K. E. Gorlen
	Bg. 12A, Rm. 2017
	Computer Systems Laboratory
	Division of Computer Research and Technology
	National Institutes of Health
	Bethesda, Maryland 20892
	Phone: (301) 496-5363
	uucp: uunet!ncifcrf.gov!nih-csl!keith
	February, 1987

Function:
	
Modification History:

$Log:	Template_c,v $
# Revision 1.1  88/01/14  23:50:34  keith
# Modify for RCS maintenance
# 

*/

#include "THIS_CLASS.h"
#include "oopsIO.h"
// #include .h files for other classes used

#define	THIS	THIS_CLASS
#define	BASE	BASE_CLASS
DEFINE_CLASS(THIS_CLASS,BASE_CLASS,1,"$Header: Template_c,v 1.1 88/01/14 23:50:34 keith Exp $",NULL,NULL);

extern const int // error codes

bool THIS_CLASS::operator==(const THIS_CLASS& a)
// Test two instances of THIS_CLASS for equality
{
}

const Class* THIS_CLASS::species()
// Return a pointer to the descriptor of the species of this class
{
	return &class_THIS_CLASS;
}

bool THIS_CLASS::isEqual(const Object& p)
// Test two objects for equality
{
	return p.isSpecies(class_THIS_CLASS) && *this==*(THIS_CLASS*)&p;
}

unsigned THIS_CLASS::hash()
// If two objects are equal (i.e., isEqual) they must have the same hash
{
}

int THIS_CLASS::compare(const Object& p)
// Compare two objects.  If *this > p return >0, *this == p return 0, and
// if *this < p return <0.
{
	assertArgSpecies(p,class_THIS_CLASS,"compare");
}

// If this class contains members that are instances of OOPS objects
// or pointers, then do not define THIS_CLASS::copy().  It will default
// to Object::deepCopy().
Object* THIS_CLASS::copy()		{ return shallowCopy(); }

void THIS_CLASS::deepenShallowCopy()
// Called by deepCopy() to convert a shallow copy to a deep copy.
{
//	BASE::deepenShallowCopy();	// do this if BASE class is not Object
// nothing need be done for member variables that are fundamental types.
// copy a member variable o that is an OOPS object:
//	o.deepenShallowCopy();
// copy a member variable p that is a pointer to an OOPS object of class CLASS:
//	p = (CLASS*)p->deepCopy();
}

void THIS_CLASS::printOn(ostream& strm)
// Print this object on an ostream
{
}

THIS_CLASS::THIS_CLASS(istream& strm, THIS_CLASS& where)
	: (strm,where)	// if base class not Object
// Construct an object from istream "strm" at address "where".
{
	this = &where;
// read a member variable f that is a fundamental type using ">>":
//	strm >> f;
// read a member variable o that is an OOPS object of class CLASS:
//	readFrom(strm,"CLASS",o);
// read a member variable p that is a pointer to an OOPS object of class CLASS:
//	p = (CLASS*)readFrom(strm,"CLASS");
// read member variables in the same order that they are stored.
}

void THIS_CLASS::storer(ostream& strm)
// Store the member variables of this object on ostream "strm".
{
	BASE::storer(strm);
// store a member variable f that is a fundamental type using ">>":
//	strm << f;
// separate variables on output with spaces, and output a space after
// the last member variable stored if stored using "<<".
// store a member variable o that is an OOPS object of class CLASS:
//	o.storeOn(strm);
// store a member variable p that is a pointer to an OOPS object:
//	p->storeOn(strm);
// store member variables in the same order that they are read.
}

THIS_CLASS::THIS_CLASS(fileDescTy& fd, THIS_CLASS& where)
	: (fd,where)	// if base class not Object
// Construct an object from file descriptor "fd" at address "where".
{
	this = &where;
// read a member variable f that is a fundamental type:
//	readBin(fd,f);
// read a member variable a that is a pointer to an array of length l:
//	readBin(fd,a,l);
// read a member variable o that is an OOPS object of class CLASS:
//	readFrom(fd,"CLASS",o);
// read a member variable p that is a pointer to an OOPS object of class CLASS:
//	p = (CLASS*)readFrom(fd,"CLASS");
// read member variables in the same order that they are stored.
// if all member variables are fundamental types, read them all at once:
//	READ_OBJECT_AS_BINARY(fd);
}

void THIS_CLASS::storer(fileDescTy& fd) 
// Store an object on file descriptor "fd".
{
	BASE::storer(fd);
// store a member variable f that is a fundamental type:
//	storeBin(fd,f);
// store a member variable a that is a pointer to an array of length l:
//	storeBin(fd,a,l);
// store a member variable o that is an OOPS object:
//	o.storeOn(fd);
// store a member variable p that is a pointer to an OOPS object:
//	p->storeOn(fd);
// store member variables in the same order that they are read.
// if all member variables are fundamental types, store them all at once:
//	STORE_OBJECT_AS_BINARY(fd);
}
