From: magrasjc@texas.net
Subject: template separation
Date: 1997/08/02 [thread overview]
Message-ID: <33E38F0F.436E@texas.net> (raw)
This is a multi-part message in MIME format.
--------------73A4116C69F3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Greetings everyone,
I am compiling on DEC UNIX 3.2 with libg++ 2.7.1 and g++ 2.7.2.2.
I have been trying to seperate the actual "code" out of template
definitions because the linker is complaining about mulitple
definitions of objects.
******************************interface below***************
template<class Trans ,class Protocol >
struct EndPoint {
Protocol NativeDev;
private:
unsigned int state;
public:
EndPoint<Trans , Protocol>::EndPoint(Trans attribs, Protocol p);
Read ( unsigned int *AmountToReadP , unsigned char *buffer);
Write( unsigned int *AmountToWriteP, unsigned char *buffer);
// EndPoint<Trans,Protocol>::~EndPoint() { unsigned int a;a=a;};
};
*************interface above********************************
******************implementation below**********************
#pragma implementation
EndPoint<Trans , Protocol>::EndPoint(Trans attribs, Protocol p){
jack<Protocol ,Protocol > Thisjack;
BindTransEnd * tcpbnd;
CircuitMaker<Trans,Protocol,Protocol> MakeRoute;
const bstring null_bstr("");
bstring * error_pbstr;
Thisjack(* p);
if (p->jProto_get_status()==FALSE) {
cerr << p->jProto_get_error() << endl;
}
tcpbnd=new BindTransEnd (attribs,* p) ;
// this must create the address structure or initialize
// the protocol's filename and mode....
//whether it is for this end or the other...
if (p->jProto_get_status()==FALSE) {
cerr << p->jProto_get_error() << endl;
}
this->state = 2;
this->NativeDev = MakeRoute(attribs,p);
if (this->NativeDev->jProto_get_status()==FALSE) {
cerr << p->jProto_get_error() << endl;
}
}
template<class Trans,class Protocol>
EndPoint<Trans, Protocol>::Read(
unsigned int *AmountToReadP,
unsigned char *buffer) {
unsigned int co_byts_read;
bstring *tmp_pbstr;
if ((co_byts_read=
recv(this->NativeDev->jProto_get_native(),(char*)buffer,*AmountToRea
dP,0))==-1) {
tmp_pbstr = new bstring(strerror(errno));
this->NativeDev->jProto_set_error_string(*tmp_pbstr);
}
//cryptDecrypt(context,buffer,*AmountToReadP);
}
template<class Trans,class Protocol>
EndPoint<Trans, Protocol>::Write(unsigned int *AmountToWriteP,
unsigned char *buffer) {
int co_byts_writn;
bstring *tmp_pbstr ;
if ((co_byts_writn=
send
(this->NativeDev->jProto_get_native(),(char*)buffer,*AmountToWr
iteP,0))==-1) {
tmp_pbstr = new bstring(strerror(errno));
this->NativeDev->jProto_set_error_string(*tmp_pbstr);
}
// cryptEncrypt(context,buffer,*AmountToWriteP);
}
//typedef EndPoint<jTrans &,pTCPIP& > TCPIPend;
typedef EndPoint<class jTrans &, class fileNODE *> FILEend;
FILEend::Write(unsigned int *AmountToWriteP,
unsigned char *buffer){
bstring *tmp_pbstr ;
if
(this->NativeDev->jProto_get_native().filemodeP->checkMode(jMode_write))
this->NativeDev->jProto_get_native().a_ostrmP->write((const
char*)buffer,*Am
ountToWriteP);
else return -1;
// tmp_pbstr = new bstring(strerror(errno));
// this->NativeDev->jProto_set_error_string(*tmp_pbstr);
// cryptEncrypt(context,buffer,*AmountToWriteP);
}
FILEend::Read(unsigned int *AmountToReadP,
unsigned char *buffer) {
bstring *tmp_pbstr;
if
(this->NativeDev->jProto_get_native().filemodeP->checkMode(jMode_read))
{
if
(this->NativeDev->jProto_get_native().filemodeP->checkMode(jMode_byline
)) {
this->NativeDev->jProto_get_native().a_istrmP->getline((char*)buffer,*
AmountToReadP);
} else {
this->NativeDev->jProto_get_native().a_istrmP->read((char*)buffer,*Amo
untToReadP);
}
} else return -1;
// tmp_pbstr = new bstring(strerror(errno));
// this->NativeDev->jProto_set_error_string(*tmp_pbstr);
//cryptDecrypt(context,buffer,*AmountToReadP);
}
**************implementation above**************************
Thanks in advance,
J.C. Magras
P.S. I am posting here because comp.lang.c++ is full of little
minded PC flamewares and very little information.
--
Unix Software Engineer looking for C++/UNIX/Motif/Perl/Tk/Flex
Software Engineering position **NOW**. Currently in Austin at
(512) 672-5778/magrasjc@texas.net. have Answering machine.
--------------73A4116C69F3
Content-Type: text/plain; charset=us-ascii; name="temp"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="temp"
/jWare/source/obj/alpha/jWare.o: filname_::filname_(void): multiply defined
/jWare/source/obj/alpha/jWare.o: filname_::operator=(filname_ &): multiply defined
/jWare/source/obj/alpha/jWare.o: filname_::operator==(filname_ &): multiply defined
/jWare/source/obj/alpha/jWare.o: filname_::operator!=(filname_ &): multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<int>::~NetProtocol(void): multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<filname_>::jProto_get_status(void): multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<filname_>::NetProtocol(void): multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<filname_>::jProto_set_error_string(basic_string<char, string_char_traits<char> > &): multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<filname_>::jProto_set_native(filname_) : multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<filname_>::~NetProtocol(void): multiply defined
/jWare/source/obj/alpha/jWare.o: NetProtocol<filname_>::jProto_iocntrl(unsigned int): multiply defined
/jWare/source/obj/alpha/jWare.o: gethost::operator()(basic_string<char, string_char_traits<char> > &, sockaddr_in &): multiply defined
/jWare/source/obj/alpha/jWare.o: getserv::operator()(basic_string<char, string_char_traits<char> > &): multiply defined
/jWare/source/obj/alpha/jWare.o: EndPoint<jTrans &, NetProtocol<filname_> *>::Write(unsigned int *, unsigned char *): multiply defined
/jWare/source/obj/alpha/jWare.o: EndPoint<jTrans &, NetProtocol<filname_> *>::Read(unsigned int *, unsigned char *): multiply defined
--------------73A4116C69F3--
next reply other threads:[~1997-08-02 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-08-02 4:00 magrasjc [this message]
1997-08-16 4:00 ` template separation Kevin Murphy
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox