bool ProgramControl_Impl::setNumberofThreadsAllowed(boost::optional<int> numberofThreadsAllowed) { bool result(false); if (numberofThreadsAllowed) { result = setInt(OS_ProgramControlFields::NumberofThreadsAllowed, numberofThreadsAllowed.get()); } else { resetNumberofThreadsAllowed(); result = true; } return result; }
bool Gas_Impl::setViscosityCoefficientA(boost::optional<double> viscosityCoefficientA) { bool result(false); if (viscosityCoefficientA) { result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientA, viscosityCoefficientA.get()); } else { resetViscosityCoefficientA(); result = true; } return result; }
bool PipeIndoor_Impl::setConstruction(const boost::optional<Construction>& construction) { bool result(false); if (construction) { result = setPointer(OS_Pipe_IndoorFields::Construction, construction.get().handle()); } else { resetConstruction(); result = true; } return result; }
bool FluidCoolerSingleSpeed_Impl::setOutdoorAirInletNode(const boost::optional<Node>& node) { bool result(false); if (node) { result = setPointer(OS_FluidCooler_SingleSpeedFields::OutdoorAirInletNode, node.get().handle()); } else { resetOutdoorAirInletNode(); result = true; } return result; }
void Gas_Impl::setConductivityCoefficientB(boost::optional<double> conductivityCoefficientB) { bool result(false); if (conductivityCoefficientB) { result = setDouble(OS_WindowMaterial_GasFields::ConductivityCoefficientB, conductivityCoefficientB.get()); } else { resetConductivityCoefficientB(); result = true; } OS_ASSERT(result); }
bool PipeIndoor_Impl::setAmbientTemperatureZone(const boost::optional<ThermalZone>& thermalZone) { bool result(false); if (thermalZone) { result = setPointer(OS_Pipe_IndoorFields::AmbientTemperatureZone, thermalZone.get().handle()); } else { resetAmbientTemperatureZone(); result = true; } return result; }
bool CoilHeatingDesuperheater_Impl::setHeatingSource(const boost::optional<ModelObject>& modelObject) { bool result(false); if (modelObject) { result = setPointer(OS_Coil_Heating_DesuperheaterFields::HeatingSourceName, modelObject.get().handle()); } else { resetHeatingSource(); result = true; } return result; }
bool FanConstantVolume_Impl::setMaximumFlowRate(boost::optional<double> maximumFlowRate) { bool result(false); if (maximumFlowRate) { result = setDouble(OS_Fan_ConstantVolumeFields::MaximumFlowRate, maximumFlowRate.get()); } else { resetMaximumFlowRate(); result = true; } return result; }
bool HumidifierSteamElectric_Impl::setRatedFanPower(boost::optional<double> ratedFanPower) { bool result(false); if (ratedFanPower) { result = setDouble(OS_Humidifier_Steam_ElectricFields::RatedFanPower, ratedFanPower.get()); } else { resetRatedFanPower(); result = true; } return result; }
bool HumidifierSteamElectric_Impl::setStandbyPower(boost::optional<double> standbyPower) { bool result(false); if (standbyPower) { result = setDouble(OS_Humidifier_Steam_ElectricFields::StandbyPower, standbyPower.get()); } else { resetStandbyPower(); result = true; } return result; }
bool RefrigerationSystem_Impl::setMechanicalSubcooler(const boost::optional<RefrigerationSubcoolerMechanical>& refrigerationSubcoolerMechanical) { bool result(false); if (refrigerationSubcoolerMechanical) { result = setPointer(OS_Refrigeration_SystemFields::MechanicalSubcoolerName, refrigerationSubcoolerMechanical.get().handle()); } else { resetMechanicalSubcooler(); result = true; } return result; }
bool RefrigerationSystem_Impl::setSuctionPipingZone(const boost::optional<ThermalZone>& thermalZone) { bool result(false); if (thermalZone) { result = setPointer(OS_Refrigeration_SystemFields::SuctionPipingZoneName, thermalZone.get().handle()); } else { resetSuctionPipingZone(); result = true; } return result; }
value_type preconditions_hold_take_() { if(LASERCAKE_NO_THREADS) { caller_error_if(!contents_, "'take' from an empty m_var in single-threaded mode blocks."); } value_type result = contents_.get(); contents_.reset(); #if !LASERCAKE_NO_THREADS writers_wait_on_.notify_one(); #endif return result; }
bool AirGap_Impl::setThermalResistance(boost::optional<double> thermalResistance) { bool result(false); if (thermalResistance) { result = setDouble(OS_Material_AirGapFields::ThermalResistance, thermalResistance.get()); } else { resetThermalResistance(); result = true; } return result; }
void Gas_Impl::setViscosityCoefficientC(boost::optional<double> viscosityCoefficientC) { bool result(false); if (viscosityCoefficientC) { result = setDouble(OS_WindowMaterial_GasFields::ViscosityCoefficientC, viscosityCoefficientC.get()); } else { resetViscosityCoefficientC(); result = true; } OS_ASSERT(result); }
core::Error createConsoleProc(const ShellArgs& args, const FilePath& outputFile, const boost::optional<FilePath>& workingDir, const std::string& caption, bool requiresSsh, bool dialog, bool enqueueRefreshOnExit, boost::shared_ptr<ConsoleProcess>* ppCP) { core::system::ProcessOptions options = procOptions(requiresSsh); if (!workingDir) options.workingDir = s_workingDir; else if (!workingDir.get().empty()) options.workingDir = workingDir.get(); // NOTE: we use runCommand style process creation on both windows and posix // so that we can redirect standard output to a file -- this works on // windows because we are not specifying options.detachProcess (not // necessary because ConsoleProcess specifies options.createNewConsole // which overrides options.detachProcess) // build command std::string command = svn() << args.args(); // redirect stdout to a file if (!outputFile.empty()) options.stdOutFile = outputFile; // create the process *ppCP = ConsoleProcess::create(command, options, caption, dialog, console_process::InteractionPossible, console_process::kDefaultMaxOutputLines); if (enqueueRefreshOnExit) (*ppCP)->onExit().connect(boost::bind(&enqueueRefreshEvent)); return Success(); }
std::vector<HVACComponent> WaterToAirComponent_Impl::edges(const boost::optional<HVACComponent> & prev) { std::vector<HVACComponent> edges; auto pushWaterOutletModelObject = [&]() { if( auto edgeModelObject = waterOutletModelObject() ) { auto edgeHVACComponent = edgeModelObject->optionalCast<HVACComponent>(); OS_ASSERT(edgeHVACComponent); edges.push_back(edgeHVACComponent.get()); } }; auto pushAirOutletModelObject = [&]() { if( auto edgeModelObject = airOutletModelObject() ) { auto edgeHVACComponent = edgeModelObject->optionalCast<HVACComponent>(); OS_ASSERT(edgeHVACComponent); edges.push_back(edgeHVACComponent.get()); } }; if( prev) { if( auto inletModelObject = waterInletModelObject() ) { if( prev.get() == inletModelObject.get() ) { pushWaterOutletModelObject(); return edges; } } if( auto inletModelObject = airInletModelObject() ) { if( prev.get() == inletModelObject.get() ) { pushAirOutletModelObject(); return edges; } } } else { pushWaterOutletModelObject(); pushAirOutletModelObject(); return edges; } return edges; }
static bool dbase_add_or_replace_record(int dbase_identifier, const Variant& record, boost::optional<int64_t> recnum) { if (!record.isArray()) { raise_warning("Argument two must be of type 'Array'"); return false; } open_db_map::iterator it = dbase_find_connection(dbase_identifier); if (it != open_dbases->end()) { dbhead_t* dbh = it->second->dbh; assert(dbh != nullptr); Array arr_record = record.toArray(); ssize_t num_fields = arr_record.size(); if (num_fields != dbh->db_nfields) { raise_warning("Wrong number of fields specified"); return false; } char* cp = (char*)malloc(dbh->db_rlen + 1); char* t_cp = cp; *t_cp++ = VALID_RECORD; dbfield_t* dbf = dbh->db_fields; dbfield_t* cur_f = dbf; for (ArrayIter arr_it(arr_record); arr_it; ++arr_it, cur_f++) { assert(cur_f < &dbf[num_fields]); //snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, Z_STRVAL(tmp)); snprintf(t_cp, cur_f->db_flen+1, cur_f->db_format, arr_it.second().toString().c_str()); t_cp += cur_f->db_flen; } int put_recnum; if (recnum) { put_recnum = recnum.get(); } else { put_recnum = dbh->db_records++; } if (put_dbf_record(dbh, put_recnum, cp) < 0) { raise_warning("unable to put record at %d", put_recnum); free(cp); return false; } put_dbf_info(dbh); free(cp); return true; } else { return false; } }
void RefrigerationCompressor_Impl::setRatedSubcooling(boost::optional<double> ratedSubcooling) { bool result(false); if (ratedSubcooling) { result = setDouble(OS_Refrigeration_CompressorFields::RatedSubcooling, ratedSubcooling.get()); resetRatedLiquidTemperature(); } else { resetRatedSubcooling(); result = true; } OS_ASSERT(result); }
/** * Write oplog entry(ies) for the delete operation. */ OpTimeBundle replLogDelete(OperationContext* opCtx, const NamespaceString& nss, OptionalCollectionUUID uuid, StmtId stmtId, bool fromMigrate, const boost::optional<BSONObj>& deletedDoc) { OperationSessionInfo sessionInfo; repl::OplogLink oplogLink; const auto txnParticipant = TransactionParticipant::get(opCtx); if (txnParticipant) { sessionInfo.setSessionId(*opCtx->getLogicalSessionId()); sessionInfo.setTxnNumber(*opCtx->getTxnNumber()); oplogLink.prevOpTime = txnParticipant->getLastWriteOpTime(*opCtx->getTxnNumber()); } OpTimeBundle opTimes; opTimes.wallClockTime = getWallClockTimeForOpLog(opCtx); if (deletedDoc && opCtx->getTxnNumber()) { auto noteOplog = logOperation(opCtx, "n", nss, uuid, deletedDoc.get(), nullptr, false, opTimes.wallClockTime, sessionInfo, stmtId, {}, false /* prepare */, OplogSlot()); opTimes.prePostImageOpTime = noteOplog; oplogLink.preImageOpTime = noteOplog; } auto& documentKey = documentKeyDecoration(opCtx); opTimes.writeOpTime = logOperation(opCtx, "d", nss, uuid, documentKey, nullptr, fromMigrate, opTimes.wallClockTime, sessionInfo, stmtId, oplogLink, false /* prepare */, OplogSlot()); return opTimes; }
void RefrigerationCompressor_Impl::setRatedSuperheat(boost::optional<double> ratedSuperheat) { bool result(false); if (ratedSuperheat) { result = setDouble(OS_Refrigeration_CompressorFields::RatedSuperheat, ratedSuperheat.get()); resetRatedReturnGasTemperature(); } else { resetRatedSuperheat(); result = true; } OS_ASSERT(result); }
void ExtractorCallbacks::ProcessRestriction( const boost::optional<InputRestrictionContainer> &restriction) { if (restriction) { external_memory.restrictions_list.push_back(restriction.get()); // util::SimpleLogger().Write() << "from: " << restriction.get().restriction.from.node << // ",via: " << restriction.get().restriction.via.node << // ", to: " << restriction.get().restriction.to.node << // ", only: " << (restriction.get().restriction.flags.is_only ? // "y" : "n"); } }
bool OtherEquipmentDefinition_Impl::setWattsperPerson(boost::optional<double> wattsperPerson) { bool result = false; if (wattsperPerson) { result = setString(OS_OtherEquipment_DefinitionFields::DesignLevelCalculationMethod,"Watts/Person"); OS_ASSERT(result); setDesignLevel(boost::none); result = setWattsperSpaceFloorArea(boost::none); OS_ASSERT(result); result = setDouble(OS_OtherEquipment_DefinitionFields::WattsperPerson, wattsperPerson.get()); } else { result = setString(OS_OtherEquipment_DefinitionFields::WattsperPerson, ""); } return result; }
void Viewport3D::refocus(const boost::optional<Coordinate> position) { const auto pos = position ? position.get() : state->viewerState->currentPosition; const auto scaledPos = Dataset::current().scales[0].componentMul(pos); translateX = scaledPos.x; translateY = scaledPos.y; glMatrixMode(GL_MODELVIEW); glLoadMatrixf(QMatrix4x4().data()); glTranslatef(scaledPos.x, scaledPos.y, scaledPos.z); std::array<float, 16> rotationState; rotation.copyDataTo(rotationState.data()); // transforms to row-major matrix glMultMatrixf(rotationState.data()); glTranslatef(-scaledPos.x, -scaledPos.y, -scaledPos.z); glGetFloatv(GL_MODELVIEW_MATRIX, state->skeletonState->skeletonVpModelView); }
bool Image::write(const io::path & path, boost::optional<std::pair<int, int>> compression) const { io::path p; if (path.empty()) { p = _filename; } else { p = path; } std::vector<int> compress_vec; if (compression) { compress_vec.push_back(std::get<0>(compression.get())); compress_vec.push_back(std::get<1>(compression.get())); } return cv::imwrite(p.string(), _mat, compress_vec); }
//! Saving for boost::optional template <class Archive, class Optioned> inline void save(Archive & ar, ::boost::optional<Optioned> const & optional) { bool initFlag = (bool)optional; if (initFlag) { ar(make_nvp("initialized", true)); ar(make_nvp("value", optional.get())); } else { ar(make_nvp("initialized", false)); } }
void update() { hier_part.update(); if (!query) { query = boost::iterator_range<FwdIter>(boost::end(hier_part.path.get()), boost::end(hier_part.path.get())); } if (!fragment) { fragment = boost::iterator_range<FwdIter>(boost::end(query.get()), boost::end(query.get())); } }
bool FanOnOff_Impl::setMotorInAirstreamFraction(boost::optional<double> motorInAirstreamFraction) { bool result(false); if (motorInAirstreamFraction) { result = setDouble(OS_Fan_OnOffFields::MotorInAirstreamFraction, motorInAirstreamFraction.get()); } else { resetMotorInAirstreamFraction(); result = true; } return result; }
/** * Write oplog entry(ies) for the delete operation. */ OpTimeBundle replLogDelete(OperationContext* opCtx, const NamespaceString& nss, OptionalCollectionUUID uuid, Session* session, StmtId stmtId, bool fromMigrate, const boost::optional<BSONObj>& deletedDoc) { OperationSessionInfo sessionInfo; repl::OplogLink oplogLink; if (session) { sessionInfo.setSessionId(*opCtx->getLogicalSessionId()); sessionInfo.setTxnNumber(*opCtx->getTxnNumber()); oplogLink.prevOpTime = session->getLastWriteOpTime(*opCtx->getTxnNumber()); } OpTimeBundle opTimes; opTimes.wallClockTime = getWallClockTimeForOpLog(opCtx); if (deletedDoc && opCtx->getTxnNumber()) { auto noteOplog = logOperation(opCtx, "n", nss, uuid, deletedDoc.get(), nullptr, false, opTimes.wallClockTime, sessionInfo, stmtId, {}); opTimes.prePostImageOpTime = noteOplog; oplogLink.preImageOpTime = noteOplog; } auto& deleteState = getDeleteState(opCtx); opTimes.writeOpTime = logOperation(opCtx, "d", nss, uuid, deleteState.documentKey, nullptr, fromMigrate, opTimes.wallClockTime, sessionInfo, stmtId, oplogLink); return opTimes; }
bool ZoneHVACUnitHeater_Impl::setMaximumHotWaterFlowRate(boost::optional<double> maximumHotWaterFlowRate) { bool result(false); if (maximumHotWaterFlowRate) { result = setDouble(OS_ZoneHVAC_UnitHeaterFields::MaximumHotWaterFlowRate, maximumHotWaterFlowRate.get()); } else { resetMaximumHotWaterFlowRate(); result = true; } return result; }