469,936 Members | 2,343 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

design pattern/ class relationship

I am wondering what is a good design pattern in terms of C++ class
relationship for the problem I am trying to solve.

template<class DbKey, class DbVal, class DbTag> class srvBerkDB :
public Db
//class for reading and writing to Berkeley DB
VecB KeyPosn;
DbTag tag;
//Only a snippet of the class is shown here.

srvBerkDB (std::string& oDBFil, std::string& oDBTabl, ...)
parse (std::string& oDBFil, ????srvBerkDB&) //friend
class or function ?????
//DB access functions like put() , get() etc

srvBerkDB class uses parse () which in turn uses Xerces-C XML parser to
parse a metadata file and fill in the private variables of srvBerkDB.
I want to reuse much of the parser code in other contexts.
I want to define a parser class for dealing with all the parsing.
What is the best way to define this relationship from C++ point of
view. Should the parser be defined as a friend class of srvBerkDB, or
just define a member function and pass all the private variables by
reference to the parse function.
Also I am thinking of making the parse member function static as I
don't see any need for instantiating the parser class

Jul 23 '05 #1
0 1038

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Omer van Kloeten | last post: by
3 posts views Thread by Merlin | last post: by
9 posts views Thread by Hasan O. Zavalsiz | last post: by
12 posts views Thread by FluffyCat | last post: by
19 posts views Thread by Chocawok | last post: by
3 posts views Thread by Froefel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.