84 lines
2.6 KiB
C++
84 lines
2.6 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivBase/GenericMessages/Detail/MetaFunctions.h
|
|
*
|
|
* @brief Header for miscellaneous metafunction classes.
|
|
*/
|
|
|
|
#if (!defined ACTIV_BASE_GENERIC_MESSAGES_DETAIL_META_FUNCTIONS_H)
|
|
#define ACTIV_BASE_GENERIC_MESSAGES_DETAIL_META_FUNCTIONS_H
|
|
|
|
#include "ActivMiddleware/ActivBase/External.h"
|
|
|
|
#include "ActivMiddleware/CxxYZ/type_traits.h"
|
|
#include "ActivMiddleware/Misc/MetaFunctions.h"
|
|
|
|
#include ACTIV_BOOST_INCLUDE(mpl/for_each.hpp)
|
|
#include ACTIV_BOOST_INCLUDE(tti/has_static_member_function.hpp)
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! GenericMessages namespace.
|
|
namespace GenericMessages
|
|
{
|
|
|
|
namespace Detail
|
|
{
|
|
|
|
//! Is a type a Definition?
|
|
template<typename T>
|
|
class IsDefinition : public CxxYZ::false_type
|
|
{
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
template<typename FIELD_LIST, typename NAME>
|
|
class IsDefinition<Definition<FIELD_LIST, NAME> > : public CxxYZ::true_type
|
|
{
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
ACTIV_BOOST_TTI_HAS_MEMBER_FUNCTION(GetSerializedLength)
|
|
ACTIV_BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION(GetSerializedLength)
|
|
|
|
//! Metafunction to inspect if a class has a GetSerializedLength() function of some form we can use.
|
|
template<typename T>
|
|
class HasGetSerializedLength : public Boost::mpl::or_<
|
|
has_member_function_GetSerializedLength<const T, size_t>,
|
|
has_member_function_GetSerializedLength<const T, const size_t>,
|
|
has_static_member_function_GetSerializedLength<T, size_t>,
|
|
has_static_member_function_GetSerializedLength<T, const size_t> >
|
|
{
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Get the front element of a sequence.
|
|
template<typename T>
|
|
class SequenceFront : public Boost::mpl::front<T>
|
|
{
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Specialization to support an empty sequence; returns Empty as the type.
|
|
template<>
|
|
class SequenceFront<Boost::mpl::l_end>
|
|
{
|
|
public:
|
|
typedef Empty type;
|
|
};
|
|
|
|
} // namespace Detail
|
|
|
|
} // namespace GenericMessages
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_BASE_GENERIC_MESSAGES_DETAIL_META_FUNCTIONS_H)
|