void ShaderAtomicCounterOpsAdditionSubstractionTestCase::setOperations() { glw::GLuint input = 12; glw::GLuint param = 4; addOperation(new AtomicOperationAdd(input, param)); addOperation(new AtomicOperationSubtract(input, param)); }
void ShaderAtomicCounterOpsBitwiseTestCase::setOperations() { glw::GLuint input = 0x2ED; // 0b1011101101; glw::GLuint param = 0x3A9; // 0b1110101001; addOperation(new AtomicOperationAnd(input, param)); addOperation(new AtomicOperationOr(input, param)); addOperation(new AtomicOperationXor(input, param)); }
void ShaderAtomicCounterOpsExchangeTestCase::setOperations() { glw::GLuint input = 5; glw::GLuint param = 10; glw::GLuint compare[] = { 5, 20 }; addOperation(new AtomicOperationExchange(input, param)); addOperation(new AtomicOperationCompSwap(input, param, compare[0])); addOperation(new AtomicOperationCompSwap(input, param, compare[1])); }
void ShaderAtomicCounterOpsMinMaxTestCase::setOperations() { glw::GLuint input = 12; glw::GLuint params[] = { 4, 16 }; addOperation(new AtomicOperationMin(input, params[0])); addOperation(new AtomicOperationMin(input, params[1])); addOperation(new AtomicOperationMax(input, params[0])); addOperation(new AtomicOperationMax(input, params[1])); }
void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, NodeOperationOutput *output) { /* cache connected sockets, so we can safely remove links first before replacing them */ OpInputs targets = cache_output_links(output); if (targets.empty()) return; WriteBufferOperation *writeOperation = NULL; for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) { NodeOperationInput *target = *it; /* try to find existing write buffer operation */ if (target->getOperation().isWriteBufferOperation()) { BLI_assert(writeOperation == NULL); /* there should only be one write op connected */ writeOperation = (WriteBufferOperation *)(&target->getOperation()); } else { /* remove all links to other nodes */ removeInputLink(target); } } /* if no write buffer operation exists yet, create a new one */ if (!writeOperation) { writeOperation = new WriteBufferOperation(operation->getOutputSocket()->getDataType()); writeOperation->setbNodeTree(m_context->getbNodeTree()); addOperation(writeOperation); addLink(output, writeOperation->getInputSocket(0)); } writeOperation->readResolutionFromInputSocket(); /* add readbuffer op for every former connected input */ for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) { NodeOperationInput *target = *it; if (&target->getOperation() == writeOperation) continue; /* skip existing write op links */ ReadBufferOperation *readoperation = new ReadBufferOperation(operation->getOutputSocket()->getDataType()); readoperation->setMemoryProxy(writeOperation->getMemoryProxy()); addOperation(readoperation); addLink(readoperation->getOutputSocket(), target); readoperation->readResolutionFromWriteBuffer(); } }
GlobalService::GlobalService() : Service( "GlobalService" ) { addOperation("require", &GlobalService::require, this) .doc("Require that a certain service is loaded in the global service.") .arg("service_name","The name of the service to load globally."); }
ModelOperation *ModelClassifier::addOperation(const std::string &name, Visibility access, bool isConst, bool isVirtual) { ModelOperation *oper = new ModelOperation(name, access, isConst, isVirtual); addOperation(std::unique_ptr<ModelOperation>(oper)); return oper; }
void ChaseWidget::toggleOperation( int id, bool value ) { if( value && !m_operations.contains( id ) ) addOperation( id ); else if( !value && m_operations.contains( id ) ) removeOperation( id ); }
void NodeOperationBuilder::add_datatype_conversions() { Links convert_links; for (Links::const_iterator it = m_links.begin(); it != m_links.end(); ++it) { const Link &link = *it; /* proxy operations can skip data type conversion */ NodeOperation *from_op = &link.from()->getOperation(); NodeOperation *to_op = &link.to()->getOperation(); if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion())) continue; if (link.from()->getDataType() != link.to()->getDataType()) convert_links.push_back(link); } for (Links::const_iterator it = convert_links.begin(); it != convert_links.end(); ++it) { const Link &link = *it; NodeOperation *converter = Converter::convertDataType(link.from(), link.to()); if (converter) { addOperation(converter); removeInputLink(link.to()); addLink(link.from(), converter->getInputSocket(0)); addLink(converter->getOutputSocket(0), link.to()); } } }
void ZipManipulator::renameFile(const std::string& zipPath, const std::string& newZipPath) { const ZipLocalFileHeader& entry = getForChange(zipPath); // checked later in Compress too but the earlier one gets the error the better std::string fn = ZipUtil::validZipEntryFileName(newZipPath); addOperation(zipPath, new Rename(entry, fn)); }
void ContactListModel::Private::addContact(PsiContact *contact) { Q_ASSERT(!monitoredContacts.contains(contact)); if (monitoredContacts.contains(contact)) return; addOperation(contact, AddContact); }
Operation< typename internal::GetSignature<Func>::Signature >& addOperation( const std::string name, Func func, Class* obj, ExecutionThread et = ClientThread ) { typedef typename internal::GetSignature<Func>::Signature Signature; Operation<Signature>* op = new Operation<Signature>(name, func, obj, et, this->getOwnerExecutionEngine() ); ownedoperations.push_back(op); return addOperation( *op ); }
void NodeOperationBuilder::addNodeInputPreview(NodeInput *input) { PreviewOperation *operation = make_preview_operation(); if (operation) { addOperation(operation); mapInputSocket(input, operation->getInputSocket(0)); } }
RTTStatePublisher(std::string const& name): robot_name("lwr"), robot_namespace(""), link_prefix(""), RTT::TaskContext(name) { addProperty("robot_name",robot_name); addProperty("robot_namespace",robot_namespace); addProperty("link_prefix",link_prefix); addProperty("robot_description",robot_description); addPort("JointPosition", port_JointPosition).doc(""); addPort("JointVelocity", port_JointVelocity).doc(""); addPort("JointTorque", port_JointTorque).doc(""); addPort("JointStates", port_JointStates).doc(""); addPort("period", port_period).doc(""); addOperation("connectMQueue",&RTTStatePublisher::connectMQueue,this,RTT::OwnThread); addOperation("connectDefault",&RTTStatePublisher::connectDefault,this,RTT::OwnThread); }
void ContactListModel::Private::contactGroupsChanged() { PsiContact* contact = qobject_cast<PsiContact*>(sender()); Q_ASSERT(monitoredContacts.contains(contact)); if (!monitoredContacts.contains(contact)) return; addOperation(contact, ContactGroupsChanged); }
Operation< Func >& addOperation( const std::string name, Func* func, ExecutionThread et = ClientThread ) { typedef Func Signature; boost::function<Signature> bfunc = func; Operation<Signature>* op = new Operation<Signature>(name, bfunc, et, this->getOwnerExecutionEngine() ); ownedoperations.push_back(op); return addOperation( *op ); }
void NodeOperationBuilder::addPreview(NodeOperationOutput *output) { PreviewOperation *operation = make_preview_operation(); if (operation) { addOperation(operation); addLink(output, operation->getInputSocket(0)); } }
void ContactListModelUpdater::contactGroupsChanged() { PsiContact* contact = static_cast<PsiContact*>(sender()); Q_ASSERT(monitoredContacts_.contains(contact)); if (!monitoredContacts_.contains(contact)) return; // qWarning("updater(%x):contactGroupsChanged: %s", (int)this, qPrintable(contact->jid().full())); addOperation(contact, ContactGroupsChanged); }
void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, NodeInput *node_input) { switch (input->getDataType()) { case COM_DT_VALUE: { float value; if (node_input && node_input->getbNodeSocket()) value = node_input->getEditorValueFloat(); else value = 0.0f; SetValueOperation *op = new SetValueOperation(); op->setValue(value); addOperation(op); addLink(op->getOutputSocket(), input); break; } case COM_DT_COLOR: { float value[4]; if (node_input && node_input->getbNodeSocket()) node_input->getEditorValueColor(value); else zero_v4(value); SetColorOperation *op = new SetColorOperation(); op->setChannels(value); addOperation(op); addLink(op->getOutputSocket(), input); break; } case COM_DT_VECTOR: { float value[3]; if (node_input && node_input->getbNodeSocket()) node_input->getEditorValueVector(value); else zero_v3(value); SetVectorOperation *op = new SetVectorOperation(); op->setVector(value); addOperation(op); addLink(op->getOutputSocket(), input); break; } } }
void ContactListModelUpdater::addContact(PsiContact* contact) { // qWarning(">>> addContact: %s", qPrintable(contact->jid())); Q_ASSERT(!monitoredContacts_.contains(contact)); if (monitoredContacts_.contains(contact)) return; monitoredContacts_[contact] = true; // qWarning("updater(%x):addContact: %s", (int)this, qPrintable(contact->jid().full())); addOperation(contact, AddContact); connect(contact, SIGNAL(destroyed(PsiContact*)), SLOT(removeContact(PsiContact*))); connect(contact, SIGNAL(updated()), SLOT(contactUpdated())); connect(contact, SIGNAL(groupsChanged()), SLOT(contactGroupsChanged())); }
void View::Invoicing::OperationEditor::createConnections() { connect(_operationsTable -> selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(rowSelectionChanged())); connect(_operationsTable, SIGNAL(productNotFound()), this, SLOT(productNotFound())); connect(_operationModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SIGNAL(dataChanged())); connect(_addOperationButton, SIGNAL(clicked()), this, SLOT(addOperation())); connect(_modOperationButton, SIGNAL(clicked()), this, SLOT(modOperation())); connect(_delOperationButton, SIGNAL(clicked()), this, SLOT(delOperation())); }
void Scene::createOperations(const mat4& transform, const GL::PrimitiveRange& range, const Material& material, float depth) { Operation operation; operation.range = range; operation.transform = transform; const PassList& passes = material.getTechnique(phase).passes; uint8 layer = 0; for (auto p = passes.begin(); p != passes.end(); p++) { operation.state = &(*p); addOperation(operation, depth, layer++); } }
int loadLog(int logfd) { int alocatedmem = 0; uint8_t *buf = NULL; uint32_t msglen; FileOperation *fileop; while (read(logfd, &msglen, sizeof (uint32_t)) == sizeof (uint32_t)) { msglen = ntohl(msglen); if (alocatedmem < msglen) { free(buf); buf = malloc(msglen); if (buf == NULL) { errMsg(LOG_ERR, "Could not allocate memory for message."); return -1; } alocatedmem = msglen; } if (read(logfd, buf, msglen) != msglen) { errnoMsg(LOG_ERR, "Could not read message from log."); free(buf); return -1; } // memory leak, need to store allocated addresses and free them later //file_operation__free_unpacked(fileop, NULL); fileop = file_operation__unpack(NULL, msglen, buf); if (addOperation(fileop->relative_path, fileop->op) != 0) { errMsg(LOG_ERR, "Could add operation to file operations. " "Exiting sync."); free(buf); return -1; } } free(buf); // matchInodefiles matchInodefiles(); return 0; }
JobPrinter::JobPrinter(string input, string output) : head(NULL), lastSec(0) { ifstream inf(input.c_str()); ifstream outf(output.c_str()); if(inf.fail()) { cout << "Could not open " << input << endl; exit(1); } if(outf.fail()) { cout << "Could not open " << output << endl; exit(1); } inf >> numjobs; inf >> nummachs; int machine1; int machine2; int start; int duration; int job = 0; int ops = 0; while(inf.good() && outf.good() && job < numjobs) { inf >> machine1; outf >> machine2; if(machine1 != machine2) { cout << "Error: input and output files don't match.\n"; exit(1); } inf >> duration; outf >> start; if(!addOperation(job, start, duration, machine1)) { exit(1); } ++ops; if(ops % nummachs == 0) ++job; } inf.close(); outf.close(); }
void ContactListModel::Private::contactUpdated() { PsiContact *contact = qobject_cast<PsiContact*>(sender()); Q_ASSERT(monitoredContacts.contains(contact)); if (!monitoredContacts.contains(contact)) return; // Check for groups changing // Maybe very difficult and should be simplified? QList<ContactListItem*> groupItems; for (const QPersistentModelIndex &index: monitoredContacts.values(contact)) { ContactListItem *item = q->toItem(index); ContactListItem *parent = item->parent(); if (parent && parent->isGroup()) { groupItems << parent; } } Operation operation = Operation::UpdateContact; ContactListItem::SpecialGroupType specialGroupType = specialGroupFor(contact); if (specialGroupType == ContactListItem::SpecialGroupType::NoneSpecialGroupType) { QStringList groups1; for (ContactListItem *item: groupItems) { groups1 << item->name(); } groups1.sort(); QStringList groups2 = contact->groups(); groups2.sort(); if (groups1 != groups2) { operation = Operation::ContactGroupsChanged; } } else if (groupItems.size() > 1 || (!groupItems.isEmpty() && groupItems.first()->specialGroupType() != specialGroupType)) { operation = Operation::ContactGroupsChanged; } addOperation(contact, operation); }
Calibrator::Calibrator(std::string name) : TaskContext(name,PreOperational) { log(Debug) << "(Calibrator) constructor entered" << endlog(); // Add properties addProperty("boardWidth",boardWidth).doc("number of internal corners in width"); addProperty("boardHeight",boardHeight).doc("number of internal corners in heigth"); addProperty("squareSize",squareSize).doc("size of square of the chessboard pattern"); addProperty("detectorSearchRadius",detectorSearchRadius).doc("radius for checkboard detector"); addProperty("imageDirectory",imageDirectory).doc("directory containing images for calibration"); // Add ports addPort( "extrinsicCameraParameters",_extrinsicPort ); // Add operations addOperation("batchCalibrate", &Calibrator::batchCalibrate, this).doc("Calibrate with batch images"); log(Debug) << "(Calibrator) constructor finished" << endlog(); }
Mops_Rec::Mops_Rec(std::string const& name) : TaskContext(name, PreOperational), _verbose(false), _priority(defPriority), _cpu(defCpu) { // Add operations addOperation("addSub", &Mops_Rec::_addSub, this, RTT::OwnThread). doc("Add subscribtion topic"). arg("topic", "New topic to subscribe"); // Add attributes addAttribute("verbose", _verbose); addAttribute("priority", _priority); addAttribute("cpu", _cpu); // Add output ports ports()->addPort("outPort", _outPort).doc("Receiver output port"); if(_verbose) std::cout << "Mops_Rec constructed !" <<std::endl; }
void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, NodeOperationInput *input) { if (!input->isConnected()) return; NodeOperationOutput *output = input->getLink(); if (output->getOperation().isReadBufferOperation()) { /* input is already buffered, no need to add another */ return; } /* this link will be replaced below */ removeInputLink(input); /* check of other end already has write operation, otherwise add a new one */ WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output); if (!writeoperation) { writeoperation = new WriteBufferOperation(output->getDataType()); writeoperation->setbNodeTree(m_context->getbNodeTree()); addOperation(writeoperation); addLink(output, writeoperation->getInputSocket(0)); writeoperation->readResolutionFromInputSocket(); } /* add readbuffer op for the input */ ReadBufferOperation *readoperation = new ReadBufferOperation(output->getDataType()); readoperation->setMemoryProxy(writeoperation->getMemoryProxy()); this->addOperation(readoperation); addLink(readoperation->getOutputSocket(), input); readoperation->readResolutionFromWriteBuffer(); }
void ZipManipulator::addFile(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl) { addOperation(zipPath, new Add(zipPath, localPath, cm, cl)); }
void MapReduceProgress::addOperations(const QList<MapReduceOperation>& ops) { foreach (MapReduceOperation op, ops) addOperation(op); }