[bind10-dev] cc message format description and routing daemon added to svn
Michael Graff
mgraff at isc.org
Wed Sep 23 16:49:45 UTC 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Shane Kerr wrote:
> The OO way to do this is to hide the specific logic in your classes. So,
> using Jinmei's example:
>
>
> class MessageComponent {
> public:
> virtual void do_something() = 0;
> };
>
> class MessageComponentString : public MessageComponent {
> private:
> string str;
> public:
> virtual void do_something() { /* manipulate str here */ };
> };
>
>
> In OO, if you're checking types you're probably not doing the right
> thing.
This is a wrapper though, more or less. It would require an
intermediate class to dereference along the way to get to the object I
really want, and that intermediate object has no other use.
That is, if I had a a 3-level hash, I would have to do something like
this to make it work in C++:
x = message.find("foo")
y = x.hash.find("bar")
z = y.hash.find("baz")
cout << z.str << eol;
In Ruby, I'd write:
puts message[foo][bar][baz]
There would be no need to have intermediate objects with the sole
purpose of containing the hash/string, that is.
The problem really comes in that I want the hashes and arrays to appear
to be "native" to the language, and while C++ has some of that, it is
still rather clumsy.
In any case, I'm writing code now, and will see how this works out.
It's not going to be perhaps as bad as I fear. :)
- --Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkq6UakACgkQ+NNi0s9NRJ2z3wCfWU0PZWGjd69EGFCb1ybDDI60
bdkAn29E9b576LhKfHFDVrSXWGyP+/Xp
=5Zb+
-----END PGP SIGNATURE-----
More information about the bind10-dev
mailing list