Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > design question

Reply
Thread Tools

design question

 
 
Matt Kowalczyk
Guest
Posts: n/a
 
      03-28-2006
I have defined as structure to expose some functionality:

typedef struct {
/* methos */
irc_session_t* (*get_session) (const char* irc_server);
void (*add_session) (irc_session_t* session);
int (*contains_session) (const char* irc_server);

} IRCConnectionManager;

After proprely initializing an IRCConnectioManager, the above functionality
should be implemented.

My question is, how can I maintain the underlining data structure for an
IRCConnectionManager? I was thinking that I could use a GHashTable which would
map a irc_server string to a irc_session_t structure. Could someone assist me
in defining a .h and .c file for this to work? I would like the implementation
of an IRCConnectionManager to be hidden from anyone using it. e.g. I do not want
to expose the GHashTable. I basically want to add some hidden members to the
IRCConnectionManager class. One of these would be the GHashTable.

Here is what I am trying to accomplish:

IRCConnectionManager* conn_manager = init_conn_manager();

client->create_connection(conn_manager, "irc.server.com");

The create_connection function would call get_session on the conn_manager and
essentially add the string "irc.server.com" to the hashtable.

Thanks,
Matt
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
class design/ design pattern question Bartholomew Simpson C++ 2 06-12-2007 08:51 PM
Class design/design pattern resources TomTom MCSD 2 10-09-2004 07:38 AM
OO design in servlet design question dave Java 5 07-17-2004 12:58 PM
Xilinx Schematic design vs VHDL code design ZackS VHDL 5 07-09-2004 07:51 AM
Looking for help/resources on Writing a nice detailed design / tech design for vb.net code SpamProof Java 3 12-01-2003 06:06 AM



Advertisments