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

Operations on DOB types. More...

Functions

Type information operations
DOTS_CPP_API Dob::Typesystem::Int32 GetNumberOfTypeIds ()
 Get the number of type id's defined in the system.
 
DOTS_CPP_API Dob::Typesystem::Int32 GetNumberOfClasses ()
 Get the number of classes defined in the system.
 
DOTS_CPP_API Dob::Typesystem::Int32 GetNumberOfProperties ()
 Get the number of properties defined in the system.
 
DOTS_CPP_API Dob::Typesystem::Int32 GetNumberOfEnumerations ()
 Get the number of enum types defined in the system.
 
DOTS_CPP_API TypeIdVector GetAllTypeIds ()
 Get all type id's that exists in the system.
 
DOTS_CPP_API bool Exists (const Dob::Typesystem::TypeId typeId)
 Check if class with specified type id exist.
 
DOTS_CPP_API bool IsClass (const Dob::Typesystem::TypeId typeId)
 Check if a type represented by a type id is a class.
 
DOTS_CPP_API bool IsProperty (const Dob::Typesystem::TypeId typeId)
 Check if a type represented by a type id is a property.
 
DOTS_CPP_API bool IsEnumeration (const Dob::Typesystem::TypeId typeId)
 Check if a type represented by a type id is an enumeration.
 
DOTS_CPP_API bool IsException (const Dob::Typesystem::TypeId typeId)
 Check if a type represented by a type id is an exception.
 
DOTS_CPP_API Dob::Typesystem::TypeId GetTypeId (const std::wstring &typeName)
 Calculates the type id for the given name.
 
DOTS_CPP_API std::wstring GetName (const Dob::Typesystem::TypeId typeId)
 Gets the name associated with the specified type id.
 
DOTS_CPP_API Dob::Typesystem::Int32 GetNumberOfEnumerationValues (const Dob::Typesystem::TypeId enumId)
 Get the number of enumeration values the specified enumeration type has.
 
DOTS_CPP_API std::wstring GetEnumerationValueName (const Dob::Typesystem::TypeId enumId, const Dob::Typesystem::EnumerationValue enumVal)
 Get the string representation of the specified value for a enumeration type.
 
DOTS_CPP_API EnumerationValue GetEnumerationValue (const Dob::Typesystem::TypeId enumId, const std::wstring &enumValueName)
 Get integer value associated with the enumeration value for the specified enumeration type.
 
DOTS_CPP_API Dob::Typesystem::TypeId GetEnumerationChecksum (const Dob::Typesystem::TypeId enumId)
 Get the Checksum over all enumeration members for an enumeration type.
 
Type compatibility
DOTS_CPP_API bool IsOfType (const Dob::Typesystem::TypeId type, const Dob::Typesystem::TypeId ofType)
 Checks if type is ofType or a subclass of ofType.
 
DOTS_CPP_API TypeIdVector GetClassTree (const Dob::Typesystem::TypeId rootClass)
 Returns a list of all type id's that is of the given type by inheritance.
 
DOTS_CPP_API Dob::Typesystem::TypeId GetParentType (const Dob::Typesystem::TypeId type)
 Returns the typeId of the base class to the argument type.
 
DOTS_CPP_API bool HasProperty (const Dob::Typesystem::TypeId classType, const Dob::Typesystem::TypeId propertyType)
 Checks if the a class has a property.
 
DOTS_CPP_API void HasProperty (const Dob::Typesystem::TypeId classType, const Dob::Typesystem::TypeId propertyType, bool &hasProperty, bool &isInherited)
 Checks if the a class has a property and if it is inherited.
 

Detailed Description

Operations on DOB types.

Function Documentation

◆ Exists()

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::Exists ( const Dob::Typesystem::TypeId typeId)

Check if class with specified type id exist.

Parameters
typeId[in] - Type id of class.
Returns
True if the type exists.

◆ GetAllTypeIds()

DOTS_CPP_API TypeIdVector Safir::Dob::Typesystem::Operations::GetAllTypeIds ( )

Get all type id's that exists in the system.

Returns
A vector containing all the type ids in the system.

◆ GetClassTree()

DOTS_CPP_API TypeIdVector Safir::Dob::Typesystem::Operations::GetClassTree ( const Dob::Typesystem::TypeId rootClass)

Returns a list of all type id's that is of the given type by inheritance.

The type 'rootClass' will also be inserted in the list. If for example type A is the base class for type B and type C, GetClassTree(A::ClassTypeId) will return a list with A, B and C.

Parameters
rootClass[in] - The base type.
Returns
A vector of type ids.

◆ GetEnumerationChecksum()

DOTS_CPP_API Dob::Typesystem::TypeId Safir::Dob::Typesystem::Operations::GetEnumerationChecksum ( const Dob::Typesystem::TypeId enumId)

Get the Checksum over all enumeration members for an enumeration type.

Parameters
enumId[in] - Type id of enum type.
Returns
Checksum of the enumeration type.
Exceptions
IllegalValueExceptionThere is no such type defined or it is not an enumeration.

◆ GetEnumerationValue()

DOTS_CPP_API EnumerationValue Safir::Dob::Typesystem::Operations::GetEnumerationValue ( const Dob::Typesystem::TypeId enumId,
const std::wstring & enumValueName )

Get integer value associated with the enumeration value for the specified enumeration type.

Parameters
enumId[in] - Type id of enum type.
enumValueName[in] - String representation of the desired value.
Returns
Integer value for the enumeration value name.
Exceptions
IllegalValueExceptionThere is no such type defined or it is not an enumeration.

◆ GetEnumerationValueName()

DOTS_CPP_API std::wstring Safir::Dob::Typesystem::Operations::GetEnumerationValueName ( const Dob::Typesystem::TypeId enumId,
const Dob::Typesystem::EnumerationValue enumVal )

Get the string representation of the specified value for a enumeration type.

Parameters
enumId[in] - Type id of enum type.
enumVal[in] - The enumeration value.
Returns
String representation of the enumeration value.
Exceptions
IllegalValueExceptionThere is no such type defined or it is not an enumeration.

◆ GetName()

DOTS_CPP_API std::wstring Safir::Dob::Typesystem::Operations::GetName ( const Dob::Typesystem::TypeId typeId)

Gets the name associated with the specified type id.

Parameters
typeId[in] - The type id to get the real name of.
Returns
Name of the type.
Exceptions
IllegalValueExceptionThere is no such type defined.

◆ GetNumberOfClasses()

DOTS_CPP_API Dob::Typesystem::Int32 Safir::Dob::Typesystem::Operations::GetNumberOfClasses ( )

Get the number of classes defined in the system.

Returns
Number of existing classes.

◆ GetNumberOfEnumerations()

DOTS_CPP_API Dob::Typesystem::Int32 Safir::Dob::Typesystem::Operations::GetNumberOfEnumerations ( )

Get the number of enum types defined in the system.

Returns
Number of existing enumeration types.

◆ GetNumberOfEnumerationValues()

DOTS_CPP_API Dob::Typesystem::Int32 Safir::Dob::Typesystem::Operations::GetNumberOfEnumerationValues ( const Dob::Typesystem::TypeId enumId)

Get the number of enumeration values the specified enumeration type has.

Parameters
enumId[in] - Type id of enum type.
Returns
Number of enumeration values.
Exceptions
IllegalValueExceptionThere is no such type defined or it is not an enumeration.

◆ GetNumberOfProperties()

DOTS_CPP_API Dob::Typesystem::Int32 Safir::Dob::Typesystem::Operations::GetNumberOfProperties ( )

Get the number of properties defined in the system.

Returns
Number of existing properties

◆ GetNumberOfTypeIds()

DOTS_CPP_API Dob::Typesystem::Int32 Safir::Dob::Typesystem::Operations::GetNumberOfTypeIds ( )

Get the number of type id's defined in the system.

This is equal to GetNumberOfClasses() + GetNumberOfProperties() + GetNumberOfEnumerations().

Returns
Number of existing types.

◆ GetParentType()

DOTS_CPP_API Dob::Typesystem::TypeId Safir::Dob::Typesystem::Operations::GetParentType ( const Dob::Typesystem::TypeId type)

Returns the typeId of the base class to the argument type.

If type represents Object, then the typeId for Object is returned again.

Parameters
type[in] - The type for which the parent type is requested.
Returns
A typeId.

◆ GetTypeId()

DOTS_CPP_API Dob::Typesystem::TypeId Safir::Dob::Typesystem::Operations::GetTypeId ( const std::wstring & typeName)

Calculates the type id for the given name.

Note that this is a pure mathematical function and will always return the correct typeId for a class with the specified name. This function does not give any information about whether a class with the specified name actually exist in the system. Use Exists to check if a class with the typeId returned from this function exists. TypeIds for classes and properties are based on namespaces and class name like this: typeName="MyNamespace1.MyNamespace2.MyClass" However for enumeration types the type id also contains the enum values, like this: typeName="MyNamespace1.MyNamespace2.MyEnumType.EnumValue1.EnumValue2.EnumValue3"

Parameters
typeName[in] - The name shall contain namespaces and class name with '.' as separator, example "MyNamespace1.MyNamespace2.MyClass"
Returns
Generated type id.

◆ HasProperty() [1/2]

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::HasProperty ( const Dob::Typesystem::TypeId classType,
const Dob::Typesystem::TypeId propertyType )

Checks if the a class has a property.

Parameters
classType[in] - The type id of the class to check if it has a specific property.
propertyType[in] - The type id of the property.
Returns
True if the class has the property.

◆ HasProperty() [2/2]

DOTS_CPP_API void Safir::Dob::Typesystem::Operations::HasProperty ( const Dob::Typesystem::TypeId classType,
const Dob::Typesystem::TypeId propertyType,
bool & hasProperty,
bool & isInherited )

Checks if the a class has a property and if it is inherited.

Parameters
classType[in] - The type id of the class to check if it has a specific property.
propertyType[in] - The type id of the property.
hasProperty[out] - True if the class has the property.
isInherited[out] - Indicates whether the property is set on the class itself or whether it was inherited from a parent class.

◆ IsClass()

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::IsClass ( const Dob::Typesystem::TypeId typeId)

Check if a type represented by a type id is a class.

Using this function on a typeid that does not exist at all in the system will give false as return value.

Parameters
typeId[in] - Type id to check.
Returns
True if the type exists as a class.

◆ IsEnumeration()

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::IsEnumeration ( const Dob::Typesystem::TypeId typeId)

Check if a type represented by a type id is an enumeration.

Using this function on a typeid that does not exist at all in the system will give false as return value.

Parameters
typeId[in] - Type id to check.
Returns
True if the type exists as an enumeration.

◆ IsException()

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::IsException ( const Dob::Typesystem::TypeId typeId)

Check if a type represented by a type id is an exception.

Using this function on a typeid that does not exist at all in the system will give false as return value.

Parameters
typeId[in] - Type id to check.
Returns
True if the type exists as an exception.

◆ IsOfType()

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::IsOfType ( const Dob::Typesystem::TypeId type,
const Dob::Typesystem::TypeId ofType )

Checks if type is ofType or a subclass of ofType.

Parameters
type[in] - The type to check if it is of another type.
ofType[in] - The type to compare to.
Returns
True of type is equal to ofType or if type inherits from ofType false if one of the types are not a class type id. (i.e. a random number or a property or enumeration id).

◆ IsProperty()

DOTS_CPP_API bool Safir::Dob::Typesystem::Operations::IsProperty ( const Dob::Typesystem::TypeId typeId)

Check if a type represented by a type id is a property.

Using this function on a typeid that does not exist at all in the system will give false as return value.

Parameters
typeId[in] - Type id to check.
Returns
True if the type exists as a property.