common/accesscasted.hpp File Reference


Detailed Description

Helper for accessing a value employing either conversion or downcast depending on the relation of the source type (type of the original value) and the target type (type we need within the usage context).

When instantiating AcessCasted<TAR>, we get a template static function AcessCasted<TAR>::access<SRC>(SRC& elm), but the actual implementation is choosed using boost::type_traits. If no viable implementatino can be selected, EmptyVal<TAR>::create() is invoked instead, which by default creates a NULL value or similar by using the no-argument ctor of the type TAR. Alternatively, you may define an specialisation fo EmptyVal, e.g. throwing an exception instead of creating a NULL value.

See also:
lumiera::WrapperPtr usage example to access a variant record

Definition in file accesscasted.hpp.

#include <boost/utility/enable_if.hpp>
#include <boost/type_traits/remove_pointer.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/type_traits/is_base_of.hpp>

Include dependency graph for accesscasted.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  util

Classes

struct  util::AccessCasted< TAR >
struct  util::can_cast< SRC, TAR >
struct  util::can_cast< SRC &, TAR & >
struct  util::can_cast< SRC *&, TAR * >
struct  util::can_cast< SRC *, TAR * >
struct  util::EmptyVal< X >
struct  util::EmptyVal< X *& >
struct  util::has_RTTI< T >
struct  util::NullAccessor< RET >
struct  util::use_conversion< SRC, TAR >
struct  util::use_dynamic_downcast< SRC, TAR >
struct  util::use_static_downcast< SRC, TAR >


Generated on Fri Nov 7 22:15:10 2008 for Lumiera by  doxygen 1.5.6