562: Add convenience shortcuts for stc_{direct_, }check_type_of{_, }.

https://svn.lrde.epita.fr/svn/oln/trunk/olena Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr> Add convenience shortcuts for stc_{direct_,}check_type_of{_,}. * oln/core/macros.hh (oln_check_type_of, oln_check_type_of_) (oln_check_direct_type_of, oln_check_direct_type_of_): New macros. * oln/morpher/internal/image_extension.hh, oln/morpher/identity.hh * oln/morpher/add_neighborhood.hh: Remove FIXMEs. core/macros.hh | 54 ++++++++++++++++++++++++++++++++++++ morpher/add_neighborhood.hh | 5 --- morpher/identity.hh | 1 morpher/internal/image_extension.hh | 1 4 files changed, 55 insertions(+), 6 deletions(-) Index: oln/core/macros.hh --- oln/core/macros.hh (revision 561) +++ oln/core/macros.hh (working copy) @@ -28,6 +28,10 @@ #ifndef OLENA_CORE_MACROS_HH # define OLENA_CORE_MACROS_HH +// --------------------- // +// Virtual type access. // +// --------------------- // + /// \def oln_type_of(OlnType, Alias) /// /// Macro to retrieve an associated type \a Alias from the exact type of @@ -62,4 +66,54 @@ stc_direct_type_of_(oln, void, OlnType, Alias) +// ------------------------------- // +// Virtual type check and access. // +// ------------------------------- // + +/* These macros are the same as the previous ones, but they use + stc_check_type_of{_,} (resp. stc_check_direct_type_of{_,}) instead of + stc_type_of{_,} (resp. stc_direct_type_of{_,}). */ + +/// \def oln_check_type_of(OlnType, Alias) +/// +/// Macro to retrieve an associated type \a Alias from the exact type of +/// an oln type \a OlnType whose category is not specified (version to be +/// used inside a template). +/// +/// If the virtual type is not found, raise a static error. +# define oln_check_type_of(OlnType, Alias) \ + stc_check_type_of(oln, void, OlnType, Alias) + +/// \def oln_check_type_of(OlnType, Alias) +/// +/// Macro to retrieve an associated type \a Alias from the exact type of +/// an oln type \a OlnType whose category is not specified (version to be +/// used outside a template). +/// +/// If the virtual type is not found, raise a static error. +# define oln_check_type_of_(OlnType, Alias) \ + stc_check_type_of_(oln, void, OlnType, Alias) + + +/// \def oln_check_direct_type_of(OlnType, Alias) +/// +/// Macro to retrieve an associated type \a Alias from an oln type \a +/// OlnType directly, and whose category is not specified (version to +/// be used inside a template). +/// +/// If the virtual type is not found, raise a static error. +# define oln_check_direct_type_of(OlnType, Alias) \ + stc_check_direct_type_of(oln, void, OlnType, Alias) + +/// \def oln_check_direct_type_of_(OlnType, Alias) +/// +/// Macro to retrieve an associated type \a Alias from an oln type \a +/// OlnType directly, and whose category is not specified (version to +/// be used inside a template). +/// +/// If the virtual type is not found, raise a static error. +# define oln_check_direct_type_of_(OlnType, Alias) \ + stc_check_direct_type_of_(oln, void, OlnType, Alias) + + #endif // ! OLENA_CORE_MACROS_HH Index: oln/morpher/identity.hh --- oln/morpher/identity.hh (revision 561) +++ oln/morpher/identity.hh (working copy) @@ -66,7 +66,6 @@ { /// Identity morpher. template <typename Image> - // FIXME: class identity : public stc_get_supers(identity<Image>) { private: Index: oln/morpher/internal/image_extension.hh --- oln/morpher/internal/image_extension.hh (revision 561) +++ oln/morpher/internal/image_extension.hh (working copy) @@ -47,7 +47,6 @@ } // end of namespace oln::morpher - // FIXME: Use set_super_type instead? /// Create an ``uplink'' from /// oln::morpher::internal::image_extension to the morphed \a Image, /// so as to get all its virtual types. Index: oln/morpher/add_neighborhood.hh --- oln/morpher/add_neighborhood.hh (revision 561) +++ oln/morpher/add_neighborhood.hh (working copy) @@ -74,10 +74,7 @@ private: typedef add_neighborhood<Image> self_t; typedef stc_get_nth_super(self_t, 1) super_t; - // FIXME: This should be replaced by a call to a new version of - // `oln_type_of', (named, for instance, `oln_check_type_of' or - // `oln_type_of_defined_'). Do the necessary changes in Static. - typedef oln_type_of(self_t, neighborhood) neighborhood_t; + typedef oln_check_type_of(self_t, neighborhood) neighborhood_t; public: // FIXME: Handle the constness.
participants (1)
-
Roland Levillain