MCPcopy Create free account
hub / github.com/OSGeo/gdal / Register

Method Register

gcore/gdalalgorithmregistry.cpp:42–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40/************************************************************************/
41
42bool GDALAlgorithmRegistry::Register(const GDALAlgorithmRegistry::AlgInfo &info)
43{
44 if (cpl::contains(m_mapNameToInfo, info.m_name))
45 {
46 CPLError(CE_Failure, CPLE_AppDefined,
47 "GDAL algorithm '%s' already registered!",
48 info.m_name.c_str());
49 return false;
50 }
51 for (const std::string &alias : info.m_aliases)
52 {
53 if (cpl::contains(m_mapAliasToInfo, alias) ||
54 cpl::contains(m_mapHiddenAliasToInfo, alias))
55 {
56 CPLError(CE_Failure, CPLE_AppDefined,
57 "An algorithm with alias '%s' is already registered!",
58 alias.c_str());
59 return false;
60 }
61 }
62 m_mapNameToInfo[info.m_name] = info;
63 bool hidden = false;
64 for (const std::string &alias : info.m_aliases)
65 {
66 if (alias == HIDDEN_ALIAS_SEPARATOR)
67 hidden = true;
68 else if (hidden)
69 m_mapAliasToInfo[alias] = info;
70 else
71 m_mapHiddenAliasToInfo[alias] = info;
72 }
73 return true;
74}
75
76/************************************************************************/
77/* GDALAlgorithmRegistry::InstantiateTopLevel() */

Callers 1

RegisterSubAlgorithmFunction · 0.45

Calls 3

containsFunction · 0.85
CPLErrorFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected