Category : C Source Code
Archive   : NIH.ZIP
Filename : RANGE.CXX

 
Output of file : RANGE.CXX contained in archive : NIH.ZIP
/* Range.c -- implementation of OOPS class Range

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:
C. J. Eppich
Computer Systems Laboratory
Division of Computer Research and Technology
National Institutes of Health
Bethesda, Maryland 20892
Phone: (301) 496-5361
uucp: uunet!ncifcrf.gov!nih-csl!keith
Internet: keith%[email protected]
September, 1987

Function:

Class Range implements an ordered pair of ints that can be used to indicate
a segment of some array (possibly a character string or vector).

$Log: Range.c,v $
* Revision 1.2 88/01/16 23:31:58 keith
* Remove pre-RCS modification history
* Replace operator()(int,int) with int length(int), int firstIndex(int),
* and int lastIndex(int).
*
*/

#include "Range.hxx"
#ifdef OBJECTIO
#include "oopsIO.hxx"
#endif //OBJECTIO

#define THIS Range
#define BASE Object
DEFINE_CLASS(Range,Object,1,"$Header: Range.c,v 1.2 88/01/16 23:31:58 keith Exp $",NULL,NULL);

//======= Protected member functions:

#ifdef OBJECTIO
Range::Range(istream& strm, Range& where)
{
this = &where;
strm >> first >> len;
}

void Range::storer(ostream& strm)
{
Object::storer(strm);
strm << first << " " << len << " ";
}

Range::Range(fileDescTy& fd, Range& where)
{
this = &where;
READ_OBJECT_AS_BINARY(fd);
}

void Range::storer(fileDescTy& fd)
{
Object::storer(fd);
STORE_OBJECT_AS_BINARY(fd);
}
#endif //OBJECTIO


//======= Public member functions:

Object* Range::copy()
{
return shallowCopy();
}

void Range::deepenShallowCopy() {}

unsigned Range::hash()
{
return (first^len);
}

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

#ifdef OBJECTIO
void Range::printOn(ostream& strm)
{
strm << first << ":" << len;
}
#endif //OBJECTIO

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


  3 Responses to “Category : C Source Code
Archive   : NIH.ZIP
Filename : RANGE.CXX

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/