Extending gcjx visitor pattern
Ranjit Mathew
rmathew@gmail.com
Tue Dec 6 10:41:00 GMT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Mike Emmel wrote:
> I was wondering what people would think about extending the gcjx
> visitor to also forward
> user data.
>
> I.e visit_method (model_method * method,
> const list<ref_variable_decl> & params,
> const ref_block &block)
>
> would becomes
>
> visit_method (model_method * method,
> const list<ref_variable_decl> & params,
> const ref_block &block, void * visitorData );
If I understand you correctly, you want the Visitor to
say:
someObject->visit (this, opaqueBlob);
and then the visited object (Visitee?) to call back
the appropriate visit_snafu() method like:
visitorObject->visit_snafu (this, foo, bar, opaqueBlob);
Right?
> On a similar note it would also be nice to annotate the gcjx tree with
> some of my data. There is the aot class but it so far does not seem to
> be the right answer.
Note that you would then need to worry about different
Visitors clashing over what to put/expect in these
per-node annotations.
Wouldn't it be simpler to maintain a map of node->nodeData
as you walk the model tree and then use this in
your visit_snafu() methods?
Thanks,
Ranjit.
- --
Ranjit Mathew Email: rmathew AT gmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.hostingzero.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFDlWqmYb1hx2wRS48RAjniAKCAKq5QGW/IcnHXsI4zMG58D1w3qACfS7L5
O+vU/0qXdDiTS+EKS0PzOyU=
=MFqN
-----END PGP SIGNATURE-----
More information about the Java
mailing list