Workspace 6.21.5
Public Types | List of all members
SortDataType< T > Struct Template Reference

Traits class defining whether a class T can be sorted. This is important for some comparison operations. More...

#include <Workspace/DataExecution/DataObjects/datafactorytraits.h>

Inheritance diagram for SortDataType< T >:
[legend]

Public Types

enum  { Supported = Application::IsSortable<T>::value }
 

Additional Inherited Members

- Public Member Functions inherited from SortDataTypeImpl< T, Application::IsSortable< T >::value >
int compare (const T &lhs, const T &rhs)
 

Detailed Description

template<typename T>
struct CSIRO::DataExecution::SortDataType< T >

By default, Supported will be specified as true or false based on whether the operator< is defined. To force no measurement supported, then in the same header that defines T, specialize this class template as follows:

namespace CSIRO
{
namespace DataExecution
{
template<> struct SortDataType<MyClass>
{
enum { Supported = 0 };
};
}}
Top level namespace for all Workspace code.
Definition: applicationsupportplugin.cpp:32
Traits class defining whether a class T can be sorted. This is important for some comparison operatio...
Definition: datafactorytraits.h:646

If T supports measurement but it does not use the default comparison operator, then specialize this class template in the header containing the DECLARE_WORKSPACE_DATA_FACTORY for T to explicitly perform a comparison.

namespace CSIRO
{
namespace DataExecution
{
template<> struct SortDataType<MyClass>
{
enum { Supported = 1 };
bool lessThan(const T& a, const T& b)
{
return customComparisonFunction(a, b);
}
};
}}

By doing this, the compareDataObjects() function in TypedDataFactory will also automatically be given an appropriate function body without any further changes.

See also
AssignDataType, SerializeDataType, CloneDataType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Supported