MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / getNumColorSpaces

Method getNumColorSpaces

src/OpenColorIO/Config.cpp:2332–2392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2330}
2331
2332int Config::getNumColorSpaces(SearchReferenceSpaceType searchReferenceType,
2333 ColorSpaceVisibility visibility) const
2334{
2335 int res = 0;
2336 switch (visibility)
2337 {
2338 case COLORSPACE_ALL:
2339 {
2340 const int nbCS = getImpl()->m_allColorSpaces->getNumColorSpaces();
2341 if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL)
2342 {
2343 return nbCS;
2344 }
2345 for (int i = 0; i < nbCS; ++i)
2346 {
2347 auto cs = getImpl()->m_allColorSpaces->getColorSpaceByIndex(i);
2348 if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType()))
2349 {
2350 ++res;
2351 }
2352 }
2353 break;
2354 }
2355 case COLORSPACE_ACTIVE:
2356 {
2357 const size_t nbCS = getImpl()->m_activeColorSpaceNames.size();
2358 if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL)
2359 {
2360 return (int)nbCS;
2361 }
2362 for (auto csname : getImpl()->m_activeColorSpaceNames)
2363 {
2364 auto cs = getColorSpace(csname.c_str());
2365 if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType()))
2366 {
2367 ++res;
2368 }
2369 }
2370 break;
2371 }
2372 case COLORSPACE_INACTIVE:
2373 {
2374 const auto ics = getImpl()->m_inactiveColorSpaceNames.size();
2375 if (searchReferenceType == SEARCH_REFERENCE_SPACE_ALL)
2376 {
2377 return (int)ics;
2378 }
2379 for (auto csname : getImpl()->m_inactiveColorSpaceNames)
2380 {
2381 auto cs = getColorSpace(csname.c_str());
2382 if (MatchReferenceType(searchReferenceType, cs->getReferenceSpaceType()))
2383 {
2384 ++res;
2385 }
2386 }
2387 break;
2388 }
2389 }

Callers 15

test_interfaceMethod · 0.95
test_interfaceMethod · 0.95
mainFunction · 0.45
PopulateOCIOMenusFunction · 0.45
update_color_spacesMethod · 0.45
saveFunction · 0.45
loadFunction · 0.45
getRefSpaceNameFunction · 0.45
getDataSpaceNameFunction · 0.45
IdentifyInterchangeSpaceFunction · 0.45
getRefSpaceConverterFunction · 0.45

Calls 5

MatchReferenceTypeFunction · 0.85
getColorSpaceByIndexMethod · 0.80
getImplFunction · 0.50
getReferenceSpaceTypeMethod · 0.45
sizeMethod · 0.45

Tested by 15

test_interfaceMethod · 0.76
test_interfaceMethod · 0.76
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36
OCIO_ADD_TESTFunction · 0.36