76 lines
2.6 KiB
C++
76 lines
2.6 KiB
C++
/**
|
|
* @file include/ActivMiddleware/ActivBase/GenericMessages/Formats/Common/FieldMetaFunctions.h
|
|
*
|
|
* @brief Header for field metafunction classes used by the public pluggable format interface.
|
|
*/
|
|
|
|
#if (!defined ACTIV_BASE_GENERIC_MESSAGES_FORMATS_COMMON_FIELD_META_FUNCTIONS_H)
|
|
#define ACTIV_BASE_GENERIC_MESSAGES_FORMATS_COMMON_FIELD_META_FUNCTIONS_H
|
|
|
|
#include "ActivMiddleware/CxxYZ/type_traits.h"
|
|
#include "ActivMiddleware/Misc/ContainerTraits.h"
|
|
|
|
#include ACTIV_BOOST_INCLUDE(mpl/count_if.hpp)
|
|
|
|
//! Activ namespace.
|
|
namespace Activ
|
|
{
|
|
|
|
//! GenericMessages namespace.
|
|
namespace GenericMessages
|
|
{
|
|
|
|
// TODO doc this
|
|
class DefinitionToStorageTag;
|
|
class DefinitionToClassTag;
|
|
class DefinitionToFieldReferenceListTag;
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
template<typename TAG, typename T>
|
|
class TagToTypeMetaFunction;
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
template<typename T>
|
|
class TagToTypeMetaFunction<DefinitionToStorageTag, T>
|
|
{
|
|
public:
|
|
typedef typename Detail::FieldTypeToStorageType<T>::type type;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
template<typename T>
|
|
class TagToTypeMetaFunction<DefinitionToClassTag, T>
|
|
{
|
|
public:
|
|
typedef typename Detail::FieldTypeToReferenceType<T>::type type;
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//! Does a field list contain a particular field?
|
|
template<typename FIELD_LIST, typename FIELD>
|
|
class IsFieldInFieldList : public MakeBoolConstant<
|
|
(1 == Boost::mpl::count_if<FIELD_LIST, Detail::IsFieldEqual<FIELD, Boost::mpl::_1> >::type::value)>
|
|
{
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//! Metafunction to determine if a type is a ClassField, rather than a Field.
|
|
template<typename T>
|
|
class IsClassField : public MakeBoolConstant<
|
|
!CxxYZ::is_same<T, Field<T::id, typename T::ProvidedType, typename T::Traits, typename T::Name> >::value>
|
|
{
|
|
};
|
|
|
|
} // namespace GenericMessages
|
|
|
|
} // namespace Activ
|
|
|
|
#endif // (!defined ACTIV_BASE_GENERIC_MESSAGES_FORMATS_COMMON_FIELD_META_FUNCTIONS_H)
|