mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 22:53:33 +08:00
Minor API cleanup in GDTR: regist() --> registerDataType()
This commit is contained in:
@@ -70,12 +70,12 @@ public:
|
||||
/**
|
||||
* Result of data type registration
|
||||
*/
|
||||
enum RegistResult
|
||||
enum RegistrationResult
|
||||
{
|
||||
RegistResultOk, ///< Success, data type is now registered and can be used.
|
||||
RegistResultCollision, ///< Data type name or ID is not unique.
|
||||
RegistResultInvalidParams, ///< Invalid input parameters.
|
||||
RegistResultFrozen ///< Data Type Registery has been frozen and can't be modified anymore.
|
||||
RegistrationResultOk, ///< Success, data type is now registered and can be used.
|
||||
RegistrationResultCollision, ///< Data type name or ID is not unique.
|
||||
RegistrationResultInvalidParams, ///< Invalid input parameters.
|
||||
RegistrationResultFrozen ///< Data Type Registery has been frozen and can't be modified anymore.
|
||||
};
|
||||
|
||||
private:
|
||||
@@ -88,8 +88,8 @@ private:
|
||||
|
||||
List* selectList(DataTypeKind kind) const;
|
||||
|
||||
RegistResult remove(Entry* dtd);
|
||||
RegistResult registImpl(Entry* dtd);
|
||||
RegistrationResult remove(Entry* dtd);
|
||||
RegistrationResult registImpl(Entry* dtd);
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
* @param id Data Type ID for this data type.
|
||||
*/
|
||||
template <typename Type>
|
||||
RegistResult regist(DataTypeID id);
|
||||
RegistrationResult registerDataType(DataTypeID id);
|
||||
|
||||
/**
|
||||
* Data Type registry needs to be frozen before a node instance can use it in
|
||||
@@ -205,10 +205,10 @@ struct UAVCAN_EXPORT DefaultDataTypeRegistrator
|
||||
{
|
||||
DefaultDataTypeRegistrator()
|
||||
{
|
||||
const GlobalDataTypeRegistry::RegistResult res =
|
||||
GlobalDataTypeRegistry::instance().regist<Type>(Type::DefaultDataTypeID);
|
||||
const GlobalDataTypeRegistry::RegistrationResult res =
|
||||
GlobalDataTypeRegistry::instance().registerDataType<Type>(Type::DefaultDataTypeID);
|
||||
|
||||
if (res != GlobalDataTypeRegistry::RegistResultOk)
|
||||
if (res != GlobalDataTypeRegistry::RegistrationResultOk)
|
||||
{
|
||||
handleFatalError("Type reg failed");
|
||||
}
|
||||
@@ -221,24 +221,24 @@ struct UAVCAN_EXPORT DefaultDataTypeRegistrator
|
||||
* GlobalDataTypeRegistry
|
||||
*/
|
||||
template <typename Type>
|
||||
GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::regist(DataTypeID id)
|
||||
GlobalDataTypeRegistry::RegistrationResult GlobalDataTypeRegistry::registerDataType(DataTypeID id)
|
||||
{
|
||||
if (isFrozen())
|
||||
{
|
||||
return RegistResultFrozen;
|
||||
return RegistrationResultFrozen;
|
||||
}
|
||||
static Entry entry;
|
||||
{
|
||||
const RegistResult remove_res = remove(&entry);
|
||||
if (remove_res != RegistResultOk)
|
||||
const RegistrationResult remove_res = remove(&entry);
|
||||
if (remove_res != RegistrationResultOk)
|
||||
{
|
||||
return remove_res;
|
||||
}
|
||||
}
|
||||
entry = Entry(DataTypeKind(Type::DataTypeKind), id, Type::getDataTypeSignature(), Type::getDataTypeFullName());
|
||||
{
|
||||
const RegistResult remove_res = remove(&entry);
|
||||
if (remove_res != RegistResultOk)
|
||||
const RegistrationResult remove_res = remove(&entry);
|
||||
if (remove_res != RegistrationResultOk)
|
||||
{
|
||||
return remove_res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user