C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

lib

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Chris
Guest





PostPosted: Sun Mar 07, 2004 10:34 pm    Post subject: lib Reply with quote



I wrote a lib for a p2p network that implements the protocol and queue
handling, etc. works fine.

The main class in the library is called Client and contains (among many
others) a run() method, which
does queue processing and runs for ever. When an inbound message is
received a switch is used to call an approriate processXYZMsg
function.

I now want to create a gui and console front ends for it and am trying
to figure out the code design.

I had originally planned (badly) that each gui would be derived from
Client, and therefore
be able to override eg processLoginReplyMsg() with their own methods.

As the run() method of Client blocks this idea sucks and is embarassing :)

I now think i should really have 2 threads, one for the Client and one
for the ui.

My question is this. As i can't override the processXYZ functions how
should i handle interaction between the Client lib and the gui?

One though i had was to pass function pointers as arguments to the Client

eg client.setProcessLoginReplyMsgFunction(some_callback_function);

Although in reality i would probably pass in some sort of map containing
all the function pointers in to the constructor of Client.

Any advice welcome on the best approach to this.
Thanks

Chris
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.