Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::ToolSupport::TypeUtilities Namespace Reference

Classes

struct  GetParameterByFullName
 Helper class to get ParameterDescription from a fully qualified name without having the ClassDescription. More...
 

Functions

DotsC_TypeId CalculateTypeId (const std::string &name)
 Calculates a typeId from a string.
 
const char * GetTypeName (DotsC_MemberType memberType)
 Finds corresponding type name to a memberType.
 
template<class RepositoryT >
const char * GetTypeName (const RepositoryT *repository, DotsC_TypeId typeId)
 Finds corresponding type name to a typeId.
 
template<class RepositoryT , class DescriptionT >
const char * GetTypeName (const RepositoryT *repository, const DescriptionT *member)
 Finds corresponding type name to a member or parameter description.
 
template<class RepositoryT >
bool IsOfType (const RepositoryT *repository, DotsC_TypeId tid, DotsC_TypeId ofTid)
 Check if a type is the same or a subtype of another type.
 
template<class EnumDescriptionT >
int GetIndexOfEnumValue (const EnumDescriptionT *description, const std::string &valueName)
 Get the index (ordinal) of an enumeration value.
 
template<class PropertyDescriptionT , class MemberDescriptionT >
DotsC_MemberIndex GetPropertyMemberIndex (const PropertyDescriptionT *pd, const std::string &memberName)
 Get index of a property member.
 
template<class ClassDescriptionT , class ParameterDescriptionT >
const ParameterDescriptionT * GetParameterByName (const ClassDescriptionT *cd, const std::string &paramName)
 Get parameter by name when the classDescription is already retrieved.
 
DotsC_Int64 ToUnifiedDictionaryKey (DotsC_Int64 key)
 ToUnifiedDictionaryKey - Convert all keys to an int64 that is the internal key format.
 
DotsC_Int64 ToUnifiedDictionaryKey (DotsC_Int32 key)
 
DotsC_Int64 ToUnifiedDictionaryKey (const std::string &key)
 
DotsC_Int64 ToUnifiedDictionaryKey (const DotsC_EntityId &key)
 
template<class ParameterDescriptionT , class KeyT >
int GetDictionaryIndexFromKey (const ParameterDescriptionT *pd, const KeyT &key)
 

Function Documentation

◆ CalculateTypeId()

DotsC_TypeId Safir::Dob::Typesystem::ToolSupport::TypeUtilities::CalculateTypeId ( const std::string & name)

Calculates a typeId from a string.

Does not check that the type exists.

Parameters
name[in] - Name of the type
Returns
The typeId

Referenced by Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetParameterByFullName< RepT, Traits >::operator()().

Here is the caller graph for this function:

◆ GetDictionaryIndexFromKey()

template<class ParameterDescriptionT , class KeyT >
int Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetDictionaryIndexFromKey ( const ParameterDescriptionT * pd,
const KeyT & key )

References ToUnifiedDictionaryKey().

Here is the call graph for this function:

◆ GetIndexOfEnumValue()

template<class EnumDescriptionT >
int Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetIndexOfEnumValue ( const EnumDescriptionT * description,
const std::string & valueName )

Get the index (ordinal) of an enumeration value.

Parameters
description[in] - EnumerationDescription
valueName[in] - Enumeration value name, can be short form or fully qualified. Ex: 'Monday' and 'MyNamespace.MyEnumType.Monday'
Returns
Index of the value or -1 if not found.

◆ GetParameterByName()

template<class ClassDescriptionT , class ParameterDescriptionT >
const ParameterDescriptionT * Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetParameterByName ( const ClassDescriptionT * cd,
const std::string & paramName )

Get parameter by name when the classDescription is already retrieved.

To get parameter from a fully qualified name, use GetParameterByFullName below.

Parameters
cd[in] - The class description that contains the parameter.
paramName[in] - Parameter name, can be short form or fully qualified name.
Returns
ParameterDescription or NULL if not found.

◆ GetPropertyMemberIndex()

template<class PropertyDescriptionT , class MemberDescriptionT >
DotsC_MemberIndex Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetPropertyMemberIndex ( const PropertyDescriptionT * pd,
const std::string & memberName )

Get index of a property member.

Parameters
pd[in] - Property description.
memberName[in] - member name
Returns
Index of member or -1 if not found.

◆ GetTypeName() [1/3]

template<class RepositoryT , class DescriptionT >
const char * Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetTypeName ( const RepositoryT * repository,
const DescriptionT * member )

Finds corresponding type name to a member or parameter description.

Parameters
repository[in] - Type repository containing all type information
member[in] - Member description or Parameter description.
Returns
The type name of the type.

References GetTypeName().

Here is the call graph for this function:

◆ GetTypeName() [2/3]

template<class RepositoryT >
const char * Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetTypeName ( const RepositoryT * repository,
DotsC_TypeId typeId )

Finds corresponding type name to a typeId.

If no type exists with given typeId NULL is returned.

Parameters
repository[in] - Type repository containing all type information
typeId[in] - TypeId to lookup and find name for.
Returns
The type name or NULL if type doesn't exist in the repository.

◆ GetTypeName() [3/3]

const char * Safir::Dob::Typesystem::ToolSupport::TypeUtilities::GetTypeName ( DotsC_MemberType memberType)

Finds corresponding type name to a memberType.

Parameters
memberType[in] - MemberType to convert to string
Returns
The type name or NULL if type doesn't exist

Referenced by GetTypeName().

Here is the caller graph for this function:

◆ IsOfType()

template<class RepositoryT >
bool Safir::Dob::Typesystem::ToolSupport::TypeUtilities::IsOfType ( const RepositoryT * repository,
DotsC_TypeId tid,
DotsC_TypeId ofTid )

Check if a type is the same or a subtype of another type.

Only usable for Enumerations and ObjectTypes.

Parameters
repository[in] - Type repository containing all type information
tid[in] - TypeId to check if it is the same or a subtype of the ofTid
ofTid[in] - The typeId to check tid against.
Returns
True if tid is the same or a subtype of ofTid, else false.

◆ ToUnifiedDictionaryKey() [1/4]

DotsC_Int64 Safir::Dob::Typesystem::ToolSupport::TypeUtilities::ToUnifiedDictionaryKey ( const DotsC_EntityId & key)

◆ ToUnifiedDictionaryKey() [2/4]

DotsC_Int64 Safir::Dob::Typesystem::ToolSupport::TypeUtilities::ToUnifiedDictionaryKey ( const std::string & key)

◆ ToUnifiedDictionaryKey() [3/4]

DotsC_Int64 Safir::Dob::Typesystem::ToolSupport::TypeUtilities::ToUnifiedDictionaryKey ( DotsC_Int32 key)

◆ ToUnifiedDictionaryKey() [4/4]

DotsC_Int64 Safir::Dob::Typesystem::ToolSupport::TypeUtilities::ToUnifiedDictionaryKey ( DotsC_Int64 key)

ToUnifiedDictionaryKey - Convert all keys to an int64 that is the internal key format.

Parameters
key
Returns
Int64 representation of a dictionary key

Referenced by GetDictionaryIndexFromKey().

Here is the caller graph for this function: