uint128_t VersionedMasterCM::sync( const uint128_t& inVersion ) { LBASSERTINFO( inVersion.high() != 0 || inVersion == VERSION_NEXT || inVersion == VERSION_HEAD, inVersion ); #if 0 LBLOG( LOG_OBJECTS ) << "sync to v" << inVersion << ", id " << _object->getID() << "." << _object->getInstanceID() << std::endl; #endif if( inVersion == VERSION_NEXT ) return _apply( _slaveCommits.pop( )); if( inVersion == VERSION_HEAD ) { uint128_t version = VERSION_NONE; for( ObjectDataIStream* is = _slaveCommits.tryPop(); is; is = _slaveCommits.tryPop( )) { version = _apply( is ); } return version; } // else apply only concrete slave commit return _apply( _slaveCommits.pull( inVersion )); }
void bset::_apply(bsetnode* rt, app_func_ptr_t f) { if ( rt ) { f(rt -> v_element); _apply( rt -> v_left, f ); _apply( rt -> v_right, f ); } }
void WindowController::adjustSize(const SizeState state) { const auto policy = _getResizePolicyForAjustingSize(_window.getContent()); switch (state) { case SIZE_1TO1: resize(_getPreferredDimensions(), CENTER, policy); break; case SIZE_1TO1_FITTING: { const auto oneToOneSize = _getPreferredDimensions(); const auto maxSize = _group.size() * FITTING_SIZE_SCALE; const auto size = geometry::constrain(oneToOneSize, QSizeF(), maxSize); resize(size, CENTER, policy); } break; case SIZE_FULLSCREEN: { _window.getContent().resetZoom(); auto size = geometry::getAdjustedSize(_getPreferredDimensions(), _group); constrainSize(size, policy); size = geometry::constrain(size, QSizeF(), _group.size()); _apply(_getCenteredCoordinates(size)); } break; case SIZE_FULLSCREEN_MAX: { _window.getContent().resetZoom(); auto size = geometry::getExpandedSize(_window.getContent(), _group); constrainSize(size, policy); _apply(_getCenteredCoordinates(size)); } break; case SIZE_FULLSCREEN_1TO1: { _window.getContent().resetZoom(); auto size = _getPreferredDimensions(); constrainSize(size, policy); _apply(_getCenteredCoordinates(size)); } break; } }
void apply(Setting& setting, LockList* lockList) { Config* config = Environment::getConfig(); assert(config != nullptr); _apply(config->getRoot(), setting, lockList); }
void MasterApplication::_init() { _displayGroup.reset( new DisplayGroup( _config->getTotalSize( ))); connect( _displayGroup.get(), &DisplayGroup::contentWindowRemoved, this, &MasterApplication::_deleteTempContentFile ); _pixelStreamWindowManager.reset( new PixelStreamWindowManager( *_displayGroup )); _pixelStreamWindowManager->setAutoFocusNewWindows( _options->getAutoFocusPixelStreams( )); connect( _options.get(), &Options::autoFocusPixelStreamsChanged, _pixelStreamWindowManager.get(), &PixelStreamWindowManager::setAutoFocusNewWindows ); _pixelStreamerLauncher.reset( new PixelStreamerLauncher( *_pixelStreamWindowManager, *_config )); _screenshotAssembler.reset( new ScreenshotAssembler( *_config )); if( _config->getHeadless( )) _initOffscreenView(); else _initMasterWindow(); connect( _masterGroupRenderer.get(), &MasterDisplayGroupRenderer::openLauncher, _pixelStreamerLauncher.get(), &PixelStreamerLauncher::openLauncher ); connect( &_loadSessionOp, &QFutureWatcher<DisplayGroupConstPtr>::finished, [this]() { auto group = _loadSessionOp.result(); if( group ) _apply( group ); if( _loadSessionPromise ) { _loadSessionPromise->set_value( group != nullptr ); _loadSessionPromise.reset(); } }); connect( &_saveSessionOp, &QFutureWatcher<DisplayGroupConstPtr>::finished, [this]() { if( _saveSessionPromise ) { _saveSessionPromise->set_value( _saveSessionOp.result( )); _saveSessionPromise.reset(); } }); #if TIDE_ENABLE_REST_INTERFACE _initRestInterface(); #endif _startDeflectServer(); _setupMPIConnections(); }
uint128_t MasterCM::sync( const uint128_t& version ) { EQASSERTINFO( version.high() != 0 || version == VERSION_NEXT || version == VERSION_HEAD, version ); #if 0 EQLOG( LOG_OBJECTS ) << "sync to v" << version << ", id " << _object->getID() << "." << _object->getInstanceID() << std::endl; #endif if( version == VERSION_NEXT ) { ObjectDataIStream* is = _queuedDeltas.pop(); _apply( is ); return _version; } // else if( version == VERSION_HEAD ) { ObjectDataIStream* is = 0; while( _queuedDeltas.tryPop( is )) _apply( is ); return _version; } // else apply only concrete slave commit ObjectDataIStream* is = 0; ObjectDataIStreams unusedStreams; while( !is ) { ObjectDataIStream* candidate = _queuedDeltas.pop(); if( candidate->getVersion() == version ) is = candidate; else unusedStreams.push_back( candidate ); } _apply( is ); _queuedDeltas.pushFront( unusedStreams ); return version; }
void YARPBlobFinder::Apply(const YARPImageOf<YarpPixelRGB>& is, YARPImageOf<YarpPixelRGB>& id) { // no padding enforced. assert (id.GetPadding() == 0); assert (is.GetPadding() == 0); assert (id.GetHeight() == is.GetHeight() && id.GetWidth() == is.GetWidth()); // extract the saliency image. m_saliency.Apply (is, m_hsv_enhanced); _apply (is, id); }
void WindowController::resize(const QPointF& center, QSizeF newSize, const Window::ResizePolicy policy) { constrainSize(newSize, policy); auto coordinates = _getCoordinates(); coordinates = geometry::resizeAroundPosition(coordinates, center, newSize); _constrainPosition(coordinates); _apply(coordinates); if (_contentZoomCanBeAdjusted()) _adjustZoom(); }
void WindowController::moveTo(const QPointF& position, const WindowPoint handle) { auto coordinates = _getCoordinates(); switch (handle) { case TOP_LEFT: coordinates.moveTopLeft(position); break; case CENTER: coordinates.moveCenter(position); break; } _constrainPosition(coordinates); _apply(coordinates); }
static constexpr decltype(auto) apply(Args&&... args) { static_assert(sizeof...(Args) == binary_expression::arity, "Wrong number of operands!"); return _apply(std::make_index_sequence<Lhs::arity>{}, std::make_index_sequence<Rhs::arity>{}, std::tuple<Args&&...>(std::forward<Args>(args)...)); }
virtual void upward(bool is_test, const AzPmat *m_inp, AzPmat *m_out) { if (is_test) _apply(m_inp, m_out); else _upward(m_inp, m_out); }
static constexpr decltype(auto) apply(Args&&... args) { return _apply(std::make_index_sequence<T1::arity> {}, std::make_index_sequence<T2::arity> {}, std::forward<Args>(args)...); }
void _apply(Setting& root, Setting& source, LockList* lockList) { Setting* s = nullptr; if (!source.isRoot()) { const char* name = source.getName(); if (name != nullptr) { if (root.exists(name)) { s = &root[name]; if (_isLocked(*s, true, lockList)) { LogWarn("Ignored updating configuration '%s' to value " "'%s'. Setting locked to value '%s'.", s->getPath().c_str(), settingToString(source).c_str(), settingToString(*s).c_str()); return; } if (!s->isGroup()) { root.remove(s->getIndex()); s = &root.add(name, source.getType()); } } else { s = &root.add(name, source.getType()); if (_isLocked(*s, false, lockList)) { LogWarn("Ignored creating configuration '%s' with " "value '%s'. Setting locked.", s->getPath().c_str(), settingToString(*s).c_str()); root.remove(s->getIndex()); return; } } } else { // List or array elements s = &root.add(source.getType()); } } else { s = &root; } switch (source.getType()) { case Setting::Type::TypeInt: { *s = (int)source; break; } case Setting::Type::TypeInt64: { *s = (long long)source; break; } case Setting::Type::TypeString: { *s = (const char*)source; break; } case Setting::Type::TypeBoolean: { *s = (bool)source; break; } case Setting::Type::TypeArray: case Setting::Type::TypeList: case Setting::Type::TypeGroup: { for (int i = 0; i < source.getLength(); ++i) { _apply(*s, source[i], lockList); } break; } default: { assert(false); break; } } }
void KnotPropertiesDialog::_handleButtonEvent(GdkEventButton* event) { if ( (event->type == GDK_2BUTTON_PRESS) && (event->button == 1) ) { _apply(); } }
static Value apply(Value value) { using tag = std::integral_constant<bool, std::is_same<From, To>::value>; return _apply(value, tag{}); }
void bset::apply(app_func_ptr_t f) { _apply(v_setroot, f); }