Пример #1
0
bool Sensor2DeviceImpl::setPositionCalibrationReport(const PositionCalibrationReport& data)
{
	UByte version = GetDeviceInterfaceVersion();
	if (version < 5)
	{
		PositionCalibrationImpl_Pre5 pci(data);
		return GetInternalDevice()->SetFeatureReport(pci.Buffer, PositionCalibrationImpl_Pre5::PacketSize);
	}
	
	PositionCalibrationImpl pci(data);
    return GetInternalDevice()->SetFeatureReport(pci.Buffer, PositionCalibrationImpl::PacketSize);
}
//==============================================================================
bool RPURU::loadReflectedProperties(UndoRedoHelperList& outPropertyCache, ISerializer& undoSerializer,
                                    ISerializer& redoSerializer, IObjectManager& objectManager,
                                    IDefinitionManager& definitionManager)
{
	PropertyCacheCreator pcc(outPropertyCache);
	const bool undoSuccess =
	loadReflectedProperties(pcc, undoSerializer, &undoPropertySetter, objectManager, definitionManager);

	PropertyCacheIterator pci(outPropertyCache);
	const bool redoSuccess =
	loadReflectedProperties(pci, redoSerializer, &redoPropertySetter, objectManager, definitionManager);

	return (undoSuccess && redoSuccess);
}
Пример #3
0
  void ctkPluginFrameworkContext::checkRequirePlugin(ctkPluginPrivate *plugin)
  {
    if (!plugin->require.isEmpty())
    {
      qDebug() << "checkRequirePlugin: check requiring plugin" << plugin->id;

      QListIterator<ctkRequirePlugin*> i(plugin->require);
      while (i.hasNext())
      {
        ctkRequirePlugin* pr = i.next();
        QList<ctkPlugin*> pl = plugins->getPlugins(pr->name, pr->pluginRange);
        ctkPluginPrivate* ok = 0;
        for (QListIterator<ctkPlugin*> pci(pl); pci.hasNext() && ok == 0; )
        {
          ctkPluginPrivate* p2 = pci.next()->d_func();
          if (tempResolved.contains(p2))
          {
            ok = p2;
          }
          else if (ctkPluginPrivate::RESOLVED_FLAGS & p2->state)
          {
            ok = p2;
          }
          else if (p2->state == ctkPlugin::INSTALLED) {
            QSet<ctkPluginPrivate*> oldTempResolved = tempResolved;
            tempResolved.insert(p2);
            checkRequirePlugin(p2);
            tempResolved = oldTempResolved;
            ok = p2;
          }
        }

        if (!ok && pr->resolution == ctkPluginConstants::RESOLUTION_MANDATORY)
        {
          tempResolved.clear();
          qDebug() << "checkRequirePlugin: failed to satisfy:" << pr->name;
          throw ctkPluginException(QString("Failed to resolve required plugin: %1").arg(pr->name));
        }
      }
    }


}
// ExpBitMuxFunction::pCodeGenerate
//
// Generate PCI's for the BitMux operation. For now, only handle certain
// cases which give signifigant speedup. Otherwise, use CLAUSE_EVAL.
//
// IN     : space - memory allocator
// RETURN : ex_expr::EXPR_OK is no errors
// EFFECTS: stores pointer to PCodeObject in clause
//
ex_expr::exp_return_type ExpBitMuxFunction::pCodeGenerate(Space *space, UInt32 f) {
  // What is the arity?
  //
  Int32 numOperands = getNumOperands();

  // Get a handle on the operands.
  //
  AttributesPtr *attrs = getOperand();

  // Only support operations to/from ATPs with INT's or CHAR datatype.
  //
  // Dst must be ATP
  //
  if(attrs[0]->getAtpIndex() < 2)
    return ex_clause::pCodeGenerate(space, f);

  Int32 i=1;
  for(; i<numOperands; i++) 
    {
      // Src must be ATP
      //
      if(attrs[i]->getAtpIndex() < 2)
	return ex_clause::pCodeGenerate(space, f);

      // No varchars
      //
      if(attrs[i]->getVCIndicatorLength() > 0) 
	return ex_clause::pCodeGenerate(space, f);

      // No nulls. Fix for genesis case 10-980114-7618 : AS 01/22/98
      //
      if(attrs[i]->getNullIndicatorLength() > 0) 
	return ex_clause::pCodeGenerate(space, f);

      // Only ints or chars.
      //
      switch(attrs[i]->getDatatype())
	{
	case REC_BPINT_UNSIGNED:
	case REC_BIN16_SIGNED: case REC_BIN16_UNSIGNED:
	case REC_BIN32_SIGNED: case REC_BIN32_UNSIGNED:
	case REC_BIN64_SIGNED:
	case REC_BYTE_F_ASCII:
	  break;

      default:
	return ex_clause::pCodeGenerate(space, f);
	break;
	}
    }

  // Allocate the code list.
  //
  PCIList code(space);

  // Generate pre clause PCI's.
  // 
  PCode::preClausePCI(this, code);

  // Load and store each input value.
  //
  Int32 offset = attrs[0]->getOffset();
  AML aml(PCIT::MBIN8, PCIT::MBIN8, PCIT::IBIN32S);
  for(i=1; i<numOperands; i++) {
    if(attrs[i]->getNullFlag())
      {
	OL ol(attrs[0]->getAtp(), attrs[0]->getAtpIndex(), offset,
	      attrs[i]->getAtp(), attrs[i]->getAtpIndex(), 
	      attrs[i]->getNullIndOffset(), 2);

        PCI pci(PCIT::Op_MOVE, aml, ol); 
	code.append(pci);
	offset += 2;
      }

    OL ol(attrs[0]->getAtp(), attrs[0]->getAtpIndex(), offset,
	  attrs[i]->getAtp(), attrs[i]->getAtpIndex(), attrs[i]->getOffset(),
	  attrs[i]->getLength());
    PCI pci(PCIT::Op_MOVE, aml, ol);
    code.append(pci);
    offset += attrs[i]->getLength();
  }

  // Generate post clause PCI's
  //
  PCode::postClausePCI(this, code);

  setPCIList(code.getList());
  return ex_expr::EXPR_OK;
};
Пример #5
0
void KisBrush::mask(KisFixedPaintDeviceSP dst, const KoColor& color, double scaleX, double scaleY, double angle, const KisPaintInformation& info, double subPixelX, double subPixelY, qreal softnessFactor) const
{
    PlainColoringInformation pci(color.data());
    generateMaskAndApplyMaskOrCreateDab(dst, &pci, scaleX, scaleY, angle, info, subPixelX, subPixelY, softnessFactor);
}
Пример #6
0
void fill_matrix_single(mwSize d, mwSize nz, mwSize nij, mwSize na, const mxArray *z_in, mxArray *a_out, mxArray *b_out)
{
  float *zr, *zi;    
  double xr, xi; 
  double yr, yi;
  mwIndex *arow, *acol;
  double *ar, *ai;    
  double *br, *bi;    
  mwIndex ij = 0;
  mwIndex kl;
  mwIndex ia = 0;
  mwIndex i,j,k,l,nd;

  // Get a pointer to the z data
  zr = (float*)mxGetPr(z_in);
  zi = (float*)mxGetPi(z_in);

  // Get a pointer to the data space in allocated memory
  ar = mxGetPr(a_out);
  ai = mxGetPi(a_out);
  arow = mxGetIr(a_out);
  acol = mxGetJc(a_out);
  br = mxGetPr(b_out);
  bi = mxGetPi(b_out);

  for (i=0; i < d; i++) {
    for (j=0; j < d; j++) {
      if (i==j) continue;
      kl = 0;
      if (ij >= nij) mexErrMsgTxt("vector b too small! This should not happen!");
      for (nd=0; nd < nz*d; nd+=d) {
          // b(ij) -= 2.*z(1,i,n)*z(0,j,n);
          br[ij] -= 2.*pcr(zr,zi,j+nd,i+nd);
          bi[ij] -= 2.*pci(zr,zi,j+nd,i+nd);
      }
      acol[ij] = ia;
      ij++;
      for (k=0; k < d; k++) {
        for (l=0; l < d; l++) {
          if (k==l) continue;
          if ((i!=k) && (i!=l) && (j!=k) && (j!=l)) {
            kl++;
            continue;
          }
          if (ia >= na) mexErrMsgTxt("sparse matrix too small! This should not happen!");
          arow[ia] = kl;
          // if (i==k) for (n=0; n < nz; n++) adata(ia) -= .5*z(1,i,n)*z(1,k,n)*z(0,l,n)*z(0,j,n);
          if (i==k) for (nd=0; nd < nz*d; nd+=d) {
              xr = pr(zr,zi,i+nd,k+nd);
              xi = -pi(zr,zi,i+nd,k+nd);
              yr = pr(zr,zi,l+nd,j+nd);
              yi = pi(zr,zi,l+nd,j+nd);
              ar[ia] -= .5*mr(xr,xi,yr,yi);
              ai[ia] -= .5*mi(xr,xi,yr,yi);
            }

          // if (i==l) for (n=0; n < nz; n++) adata(ia) += .5*z(0,j,n)*z(1,k,n);
          if (i==l) for (nd=0; nd < nz*d; nd+=d) {
              ar[ia] += .5*pcr(zr,zi,j+nd,k+nd);
              ai[ia] += .5*pci(zr,zi,j+nd,k+nd);
            }

          // if (j==k) for (n=0; n < nz; n++) adata(ia) += .5*z(1,i,n)*z(0,l,n);
          if (j==k) for (nd=0; nd < nz*d; nd+=d) {
              ar[ia] += .5*pcr(zr,zi,l+nd,i+nd);
              ai[ia] += .5*pci(zr,zi,l+nd,i+nd);
            }

          // if (j==l) for (n=0; n < nz; n++) adata(ia) -= .5*z(1,i,n)*z(1,k,n)*z(0,l,n)*z(0,j,n);
          if (j==l) for (nd=0; nd < nz*d; nd+=d) {
              xr = pr(zr,zi,i+nd,k+nd);
              xi = -pi(zr,zi,i+nd,k+nd);
              yr = pr(zr,zi,l+nd,j+nd);
              yi = pi(zr,zi,l+nd,j+nd);
              ar[ia] -= .5*mr(xr,xi,yr,yi);
              ai[ia] -= .5*mi(xr,xi,yr,yi);           
            }
          kl++;
          ia++;
        }
      }
    }
  }
  acol[nij] = ia;
  return;
}