QFourierTransformer::Initialization QFourierTransformer::setSize(int size)
{
	if(isValidSize(size))
	{
		mSize = size;
		if(mWindowFunction != 0)
		{
			mWindowFunction->create(mSize);
		}
		int key = sizeToKey(mSize);
		if(mFixedCalculators.contains(key))
		{
			mCalculator = mFixedCalculators[key];
			return QFourierTransformer::FixedSize;
		}
		else
		{
			mCalculator = mVariableCalculator;
			mCalculator->setSize(mSize);
			return QFourierTransformer::VariableSize;
		}
	}
	mSize = 0;
	return QFourierTransformer::InvalidSize;
}
Exemple #2
0
			RawBlock(Word blockSize): refcnt_(1), size_(blockSize),
					block_(new Word[size_]) {
#ifdef R_UM_OPT_ENFORCE_LOWLEV_VALIDITY
				assert(isValidSize());
				assert(isValidBlock());
#endif
		
				std::memset(block_, 0, size_ * sizeof(Word));
			}
Exemple #3
0
			RawBlock(const RawBlock &sourceBlock): refcnt_(1),
					size_(sourceBlock.size_), block_(new Word[size_]) {
#ifdef R_UM_OPT_ENFORCE_LOWLEV_VALIDITY
				assert(isValidSize());
				assert(isValidBlock());
				assert(sourceBlock.isValidBlock());
				assert(size_ == sourceBlock.size_);
#endif
		
				std::memcpy(block_, sourceBlock.block_,
						size_ * sizeof(Word));
			}
void VolumeGroupDialog::updateOkButtonStatus()
{
    bool enable = isValidSize();

    if (dialogWidget().vgName().text().isEmpty() || !isValidName()) {
        enable = false;
    }
    if (dialogWidget().spinPESize().value() <= 0) {
        enable = false;
    }

    okButton->setEnabled(enable);
}
Exemple #5
0
static BraillePacketVerifierResult
verifyPacket (
  BrailleDisplay *brl,
  const unsigned char *bytes, size_t size,
  size_t *length, void *data
) {
  unsigned char byte = bytes[size-1];

  switch (size) {
    case 1:
      switch (byte) {
        case MM_HEADER_ACK:
        case MM_HEADER_NAK:
          *length = 1;
          break;

        case MM_HEADER_ID1:
          *length = sizeof(MM_CommandHeader);
          break;

        default:
          if (isValidSize(byte)) {
            *length = 1;
            break;
          }

          return BRL_PVR_INVALID;
      }
      break;

    case 2:
      if (byte != MM_HEADER_ID2) return BRL_PVR_INVALID;
      break;

    case 5:
      *length += byte;
      break;

    case 6:
      *length += byte << 8;
      break;

    default:
      break;
  }

  return BRL_PVR_INCLUDE;
}
Exemple #6
0
const Pizza::Pizza*		Waiter::getPizza(const std::string& command)
{
  std::string			type;
  std::string			size;
  std::stringstream		ss;
  Pizza::TypePizza		enumType;
  Pizza::TaillePizza		enumSize;

  ss << command;
  ss >> type >> size;
  enumType = isValidType(type);
  enumSize = isValidSize(size);
  if (enumSize && enumType)
      return (new Pizza::Pizza(enumType, enumSize));
  return (NULL);
}
Exemple #7
0
// ----------------------------------------------------------------------------
void Editor::readTexSt(FILE* fp, ITexture** tex)
{
    u8 size;
    fread(&size, sizeof(u8), 1, fp);

    if (!isValidSize(size))
    {
        *tex = 0;
        return;
    }
    c8* cc = new c8[size];
    fread(cc, sizeof(c8), size, fp);
    path p = cc;
    *tex = Editor::loadImg(p);
    delete[] cc;
} // readTexSt
bool QFourierTransformer::setWindowFunction(QString functionName)
{
	for(int i = 0; i < mWindowFunctions.size(); ++i)
	{
		if(functionName.trimmed().toLower().replace("function", "") == mWindowFunctions[i].trimmed().toLower().replace("function", ""))
		{
			if(mWindowFunction != 0)
			{
				delete mWindowFunction;
			}
			mWindowFunction = QWindowFunctionManager<float>::createFunction(functionName);
			if(mWindowFunction != 0 && isValidSize(mSize))
			{
				mWindowFunction->create(mSize);
			}
			return true;
		}
	}
	return false;
}
Exemple #9
0
void OpenGLTexture::create (const int w, const int h, const void* pixels, GLenum type)
{
    // Texture objects can only be created when the current thread has an active OpenGL
    // context. You'll need to create this object in one of the OpenGLContext's callbacks.
    jassert (OpenGLHelpers::isContextActive());

    jassert (isValidSize (w, h)); // Perhaps these dimensions must be a power-of-two?

    width  = w;
    height = h;

    if (textureID == 0)
    {
        JUCE_CHECK_OPENGL_ERROR
        glGenTextures (1, &textureID);
        glBindTexture (GL_TEXTURE_2D, textureID);
        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
        glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
        JUCE_CHECK_OPENGL_ERROR
    }