head     1.8;
branch   ;
access   ;
symbols  ;
locks    ; strict;
comment  @// @;


1.8
date     92.06.21.16.59.32;  author thoth;  state Exp;
branches ;
next     1.7;

1.7
date     92.05.22.07.22.56;  author fischer;  state Exp;
branches ;
next     1.6;

1.6
date     92.05.22.07.05.40;  author fischer;  state Exp;
branches ;
next     1.5;

1.5
date     92.05.21.20.28.27;  author thoth;  state Exp;
branches ;
next     1.4;

1.4
date     92.05.21.08.08.58;  author fischer;  state Exp;
branches ;
next     1.3;

1.3
date     92.05.20.23.30.51;  author fischer;  state Exp;
branches ;
next     1.2;

1.2
date     92.05.19.14.26.47;  author thoth;  state Exp;
branches ;
next     1.1;

1.1
date     92.05.19.01.39.00;  author thoth;  state Exp;
branches ;
next     ;


desc
@Initial version.  Quite busted by compiler.
@


1.8
log
@fixed error in operator=
adjusted output method since overloading now works.
@
text
@static char rcsid[] = "$Id: Point-old.cc,v 1.7 92/05/22 07:22:56 fischer Exp Locker: thoth $";

//
// $Log:	Point-old.cc,v $
// Revision 1.7  92/05/22  07:22:56  fischer
// *** empty log message ***
// 
// Revision 1.6  92/05/22  07:05:40  fischer
// Fixed problems with partial // comments, 
// and partial old style comments.  Folded in
// the IA::result_type() changes.
// Checked compilation against gcc-2.0 (failed)
// and gcc-2.1 (succeeded).  Too bad gcc-2.1 doesn't
// work well otherwise!
// 
// Revision 1.5  92/05/21  20:28:27  thoth
// switched to // comments
// 
// Revision 1.4  92/05/21  08:08:58  fischer
// Reworking CoordType to use more genmeral IA::NumericType.
// Made a lot of names longer, since I got emacs completion.el
// over to CIS.
// 
// Revision 1.3  92/05/20  23:30:51  fischer
// repaired output method.
// fixed dereference in copyings.
// 
// Revision 1.2  92/05/19  14:26:47  thoth
// handled the case where c1.type()==None.
// added a copy constructor for Point.
// added an assignment operator for Point.
// handled the uninitialized Point case in
// ostream << Point.
// 
// Revision 1.1  92/05/19  01:39:00  thoth
// Initial revision
// 
    
#include <iostream.h>
#include <Point-old.h>
#include <CoordVecOf-old.h>
    

void Point::create_cv(int np, NumericType type)
{
    switch (type) {
    case Integer:
	cv = new CoordVecOf<int>(np);
	break;
    case Float:
	cv = new CoordVecOf<float>(np);
	break;
    case None:
	throw(IA::TypeUnspecified, __FILE__, __LINE__);
	break;
    }
}

Point::Point(const Point& p)
{
    cv = (p.cv) ? (p.cv->clone_self()) : (NULL);
}

Point::Point(Coord c1)
{
    create_cv(1, c1.type());
    cv->set(0, c1);
}

Point::Point(Coord c1, Coord c2)
{
    NumericType coerced_type = IA::result_type(c1.type(), c2.type());
    create_cv(2, coerced_type);
    cv->set(0, c1);
    cv->set(1, c2);
}

Point::Point(Coord c1, Coord c2, Coord c3)
{
    NumericType coerced_type;

    coerced_type = IA::result_type(c1.type(), c2.type());
    coerced_type = IA::result_type(coerced_type, c3.type());
    create_cv(3, coerced_type);
    cv->set(0, c1);
    cv->set(1, c2);
    cv->set(2, c3);
}

Point::Point(Coord c1, Coord c2, Coord c3, Coord c4)
{
    NumericType coerced_type;

    coerced_type = IA::result_type(c1.type(), c2.type());
    coerced_type = IA::result_type(coerced_type, c3.type());
    coerced_type = IA::result_type(coerced_type, c4.type());
    create_cv(4, coerced_type);
    cv->set(0, c1);
    cv->set(1, c2);
    cv->set(2, c3);
    cv->set(3, c4);
}

Point::Point(Coord c1, Coord c2, Coord c3, Coord c4, Coord c5)
{
    NumericType coerced_type;

    coerced_type = IA::result_type(c1.type(), c2.type());
    coerced_type = IA::result_type(coerced_type, c3.type());
    coerced_type = IA::result_type(coerced_type, c4.type());
    coerced_type = IA::result_type(coerced_type, c5.type());
    create_cv(5, coerced_type);
    cv->set(0, c1);
    cv->set(1, c2);
    cv->set(2, c3);
    cv->set(3, c4);
    cv->set(4, c5);
}


Point & Point::operator=(const Point &p)
{
    if (cv)
	delete cv;
    
    cv = (p.cv) ? (p.cv->clone_self()) : (NULL);
    return *this;
}



void
Point::output(ostream& o)
{
    int i;

    for (i=0; i < this->cv->arity(); i++) {
	o << (*this->cv)[i] << " ";
    }

}

// ostream &operator<<(ostream &o, const Point &p)
// {
//     Coord	c;
//     CoordVec	*cv;
//     cv = p.cv;
//     if (cv==NULL)
// 	throw(IA::TypeUnspecified, __FILE__, __LINE__);
// 
//     for (int i=0; i<p.cv->arity(); i++) {
// 	c = (*cv)[i];
// 	c.output(o);
// 	if (i+1<p.cv->arity())
// 	    o << ", ";
//     }
//     return o;
// }
@


1.7
log
@*** empty log message ***
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: Point.cc,v 1.6 92/05/22 07:05:40 fischer Exp $";
d4 4
a7 1
// $Log:	Point.cc,v $
d40 2
a41 2
#include <Point.h>
#include <CoordVecOf.h>
d127 1
a127 1
    return p;
d138 2
a139 3
	(*this->cv)[i].output(o);
	o << " ";
	}
@


1.6
log
@Fixed problems with partial // comments, 
and partial old style comments.  Folded in
the IA::result_type() changes.
Checked compilation against gcc-2.0 (failed)
and gcc-2.1 (succeeded).  Too bad gcc-2.1 doesn't
work well otherwise!
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: Point.cc,v 1.5 92/05/21 20:28:27 thoth Exp Locker: fischer $";
d5 8
@


1.5
log
@switched to // comments
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: Point.cc,v 1.4 92/05/21 08:08:58 fischer Exp Locker: thoth $";
d5 3
d61 1
a61 1
    coerced_type = result_type(c1.type(), c2.type());
d71 2
a72 2
    coerced_type = result_type(c1.type(), c2.type());
    coerced_type = result_type(coerced_type, c3.type());
d83 3
a85 3
    coerced_type = result_type(c1.type(), c2.type());
    coerced_type = result_type(coerced_type, c3.type());
    coerced_type = result_type(coerced_type, c4.type());
d97 4
a100 4
    coerced_type = result_type(c1.type(), c2.type());
    coerced_type = result_type(coerced_type, c3.type());
    coerced_type = result_type(coerced_type, c4.type());
    coerced_type = result_type(coerced_type, c5.type());
@


1.4
log
@Reworking CoordType to use more genmeral IA::NumericType.
Made a lot of names longer, since I got emacs completion.el
over to CIS.
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: Point.cc,v 1.3 92/05/20 23:30:51 fischer Exp Locker: fischer $";
d3 21
a23 18
/*
 * $Log:	Point.cc,v $
 * Revision 1.3  92/05/20  23:30:51  fischer
 * repaired output method.
 * fixed dereference in copyings.
 * 
 * Revision 1.2  92/05/19  14:26:47  thoth
 * handled the case where c1.type()==None.
 * added a copy constructor for Point.
 * added an assignment operator for Point.
 * handled the uninitialized Point case in
 * ostream << Point.
 * 
 * Revision 1.1  92/05/19  01:39:00  thoth
 * Initial revision
 * 
 *
 */
@


1.3
log
@repaired output method.
fixed dereference in copyings.
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: Point.cc,v 1.2 92/05/19 14:26:47 thoth Exp Locker: thoth $";
d5 4
a25 4
CoordType CTpromote[(int)None][(int)None] = {
    { Integer, Float },
    { Float, Float}
};
d27 1
a27 1
CoordType promote(CoordType from, CoordType other)
a28 15
    CoordType	rval;
    if (other==None)
	throw(IA::TypeUnspecified, __FILE__, __LINE__);
    if (from==None)
	return other;
    
    rval = CTpromote[from][other];
    if (rval==None)
	throw(IA::TypeMismatch, __FILE__, __LINE__);
    
    return rval;
}

void Point::create_cv(int np, CoordType type)
{
d49 1
a49 1
    create_cv(1,promote(None, c1.type()));
d55 2
a56 4
    CoordType to=None;
    to = promote(to, c1.type());
    to = promote(to, c2.type());
    create_cv(2, to);
d63 5
a67 5
    CoordType to=None;
    to = promote(to, c1.type());
    to = promote(to, c2.type());
    to = promote(to, c3.type());
    create_cv(3, to);
d75 6
a80 6
    CoordType to=None;
    to = promote(to, c1.type());
    to = promote(to, c2.type());
    to = promote(to, c3.type());
    to = promote(to, c4.type());
    create_cv(4, to);
d89 7
a95 7
    CoordType to=None;
    to = promote(to, c1.type());
    to = promote(to, c2.type());
    to = promote(to, c3.type());
    to = promote(to, c4.type());
    to = promote(to, c5.type());
    create_cv(5, to);
@


1.2
log
@handled the case where c1.type()==None.
added a copy constructor for Point.
added an assignment operator for Point.
handled the uninitialized Point case in
ostream << Point.
@
text
@d1 1
a1 1
static char rcsid[] = "$Id: Point.cc,v 1.1 92/05/19 01:39:00 thoth Exp Locker: thoth $";
d5 7
d17 1
a17 1

d21 1
a21 1

d34 1
a34 1

d38 1
a38 1

d59 1
a59 1
    cv = (p.cv) ? (p.cv.clone_self()) : (NULL);
d120 1
d125 3
a127 2

    cv = (p.cv) ? (p.cv.clone_self()) : (NULL);
d131 3
a133 1
ostream &operator<<(ostream &o, const Point &p)
d135 1
a135 5
    Coord	c;
    CoordVec	*cv;
    cv = p.cv;
    if (cv==NULL)
	throw(IA::TypeUnspecified, __FILE__, __LINE__);
d137 5
a141 11
    for (int i=0; i<p.cv->arity(); i++) {
	c = (*cv)[i];
#if 1
	c.output(o);
#else
	o << c;
#endif
	if (i+1<p.cv->arity())
	    o << ", ";
    }
    return o;
d143 17
@


1.1
log
@Initial revision
@
text
@d1 1
a1 1
static char rcsid[] = "$Id$";
d4 4
a7 1
 * $Log$
d50 5
d57 1
a57 1
    create_cv(1,c1.type());
d63 2
a64 1
    CoordType	to = c1.type();
d73 2
a74 1
    CoordType	to = c1.type();
d85 2
a86 1
    CoordType	to = c1.type();
d99 2
a100 1
    CoordType	to = c1.type();
d113 9
d127 3
a141 4

// Local variables:
// eval: (joe-style)
// End:
@
