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

Method addDisplaySharedView

src/OpenColorIO/Config.cpp:3646–3695  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3644}
3645
3646void Config::addDisplaySharedView(const char * display, const char * sharedView)
3647{
3648 if (!display || !*display)
3649 {
3650 throw Exception("Shared view could not be added to display: non-empty display name "
3651 "is needed.");
3652 }
3653 if (!sharedView || !*sharedView)
3654 {
3655 throw Exception("Shared view could not be added to display: non-empty view name "
3656 "is needed.");
3657 }
3658
3659 bool invalidateCache = false;
3660 DisplayMap::iterator iter = FindDisplay(getImpl()->m_displays, display);
3661 if (iter == getImpl()->m_displays.end())
3662 {
3663 const auto curSize = getImpl()->m_displays.size();
3664 getImpl()->m_displays.resize(curSize + 1);
3665 getImpl()->m_displays[curSize].first = display;
3666 iter = std::prev(getImpl()->m_displays.end());
3667 invalidateCache = true;
3668 }
3669
3670 const ViewVec & existingViews = iter->second.m_views;
3671 auto viewIt = FindView(existingViews, sharedView);
3672 if (viewIt != existingViews.end())
3673 {
3674 std::ostringstream os;
3675 os << "There is already a view named '" << sharedView;
3676 os << "' in the display '" << display << "'.";
3677 throw Exception(os.str().c_str());
3678 }
3679
3680 StringUtils::StringVec & views = iter->second.m_sharedViews;
3681 if (StringUtils::Contain(views, sharedView))
3682 {
3683 std::ostringstream os;
3684 os << "There is already a shared view named '" << sharedView;
3685 os << "' in the display '" << display << "'.";
3686 throw Exception(os.str().c_str());
3687 }
3688 views.push_back(sharedView);
3689 if (invalidateCache)
3690 {
3691 getImpl()->m_displayCache.clear();
3692 }
3693 AutoMutex lock(getImpl()->m_cacheidMutex);
3694 getImpl()->resetCacheIDs();
3695}
3696
3697void Config::addDisplayView(const char * display, const char * view,
3698 const char * colorSpace, const char * looks)

Callers 11

_add_itemMethod · 0.80
_add_itemMethod · 0.80
_add_itemMethod · 0.80
loadFunction · 0.80
addUniqueDisplaysMethod · 0.80
processDisplaysMethod · 0.80
handleRemoveMethod · 0.80
test_ruled_viewsMethod · 0.80
test_virtual_displayMethod · 0.80
OCIO_ADD_TESTFunction · 0.80
OCIO_ADD_TESTFunction · 0.80

Calls 10

FindDisplayFunction · 0.85
FindViewFunction · 0.85
ContainFunction · 0.85
resetCacheIDsMethod · 0.80
getImplFunction · 0.50
endMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
push_backMethod · 0.45
clearMethod · 0.45

Tested by 4

test_ruled_viewsMethod · 0.64
test_virtual_displayMethod · 0.64
OCIO_ADD_TESTFunction · 0.64
OCIO_ADD_TESTFunction · 0.64