MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / moduleDependencySort

Method moduleDependencySort

Engine/source/module/moduleManager.cpp:77–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77S32 ModuleManager::moduleDependencySort(ModuleDefinition* const* a, ModuleDefinition* const* b)
78{
79 // if A depends on B move A down the list
80 ModuleDefinition::typeModuleDependencyVector moduleDependencies = (*a)->getDependencies();
81 for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr = moduleDependencies.begin(); dependencyItr != moduleDependencies.end(); ++dependencyItr)
82 {
83 if ((String::compare(dependencyItr->mModuleId, (*b)->getModuleId()) == 0)
84 && (dependencyItr->mVersionId == (*b)->getVersionId()))
85 return 1;
86 }
87
88 //If B depends on A, move A up the list
89 ModuleDefinition::typeModuleDependencyVector moduleDependencies2 = (*b)->getDependencies();
90 for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr2 = moduleDependencies2.begin(); dependencyItr2 != moduleDependencies2.end(); ++dependencyItr2)
91 {
92 if ((String::compare(dependencyItr2->mModuleId, (*a)->getModuleId()) == 0)
93 && (dependencyItr2->mVersionId == (*a)->getVersionId()))
94 return -1;
95 }
96 //didn't find any explicit dependencies between the two, so sort by which has more
97 if (moduleDependencies.size() > moduleDependencies2.size()) return 1;
98 if (moduleDependencies.size() < moduleDependencies2.size()) return -1;
99 return 0;
100}
101
102//-----------------------------------------------------------------------------
103

Callers

nothing calls this directly

Calls 7

compareFunction · 0.85
getDependenciesMethod · 0.80
getModuleIdMethod · 0.80
getVersionIdMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected