Пример #1
0
DatatypeType DatatypeType::instantiate(const std::vector<Type>& params) const {
  NodeManagerScope nms(d_nodeManager);
  TypeNode cons = d_nodeManager->mkTypeConst( getDatatype() );
  vector<TypeNode> paramsNodes;
  paramsNodes.push_back( cons );
  for(vector<Type>::const_iterator i = params.begin(),
        iend = params.end();
      i != iend;
      ++i) {
    paramsNodes.push_back(*getTypeNode(*i));
  }
  return DatatypeType(makeType(d_nodeManager->mkTypeNode(kind::PARAMETRIC_DATATYPE, paramsNodes)));
}
Пример #2
0
	void GLFramebuffer::attach(const string &attachment, GLenum txrFormat)
	{
		GLenum colorFormat, datatype;
		if((colorFormat = getColorFormat(txrFormat)) == GL_NONE || (datatype = getDatatype(txrFormat)) == GL_NONE)
		{
			cerr << "Invalid texture format specified." << endl;
			cerr << "Should be one of: GL_RGB32(F/UI), GL_RGBA32(F/UI), GL_DEPTH_COMPONENT32F." << endl;
			return;
		}

		// Get FBO attachment slot for the new texture
		GLenum slot = findAttachmentSlot(txrFormat);

		GLTexture *pTexture = new GLTexture();
		GLTexture::bind(0, *pTexture);
        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameterf(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);
	    glTexImage2D(GL_TEXTURE_2D, 0, txrFormat, m_width, m_height, 0, colorFormat, datatype, nullptr);
		glFramebufferTexture2D(GL_FRAMEBUFFER, slot, GL_TEXTURE_2D, pTexture->getID(), 0);
		GLTexture::unbind(0);

		// Construct new FBO attachment
		GLFramebufferAttachment fboAttachment;
		fboAttachment.name = attachment;
		fboAttachment.pTexture = pTexture;
		fboAttachment.textureFormat = txrFormat;
		fboAttachment.colorFormat = colorFormat;
		fboAttachment.datatype = datatype;
		fboAttachment.attachmentSlot = slot;

		m_attachments.insert({attachment, fboAttachment});

		// Increment color attachment count if neccessary
		if(txrFormat != GL_DEPTH_COMPONENT32F) m_colorAttachmentCount++;
	}
Пример #3
0
Expr DatatypeType::getConstructor(std::string name) const {
  return getDatatype().getConstructor(name);
}
Пример #4
0
void Attributes::displayContents(Space * space, Int32 operandNum,
				 char * constsArea, Attributes * spAttr)
{
#ifndef __EID
  char buf[250];
  char r[15];

  if (operandNum == 0)
    str_cpy(r, " (result)",str_len(" (result)")+1,'\0');
  else
    r[0] = 0;
  
  str_sprintf(buf, "    Operand #%d%s:", operandNum, r);
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  str_sprintf(buf, "      Datatype = %s(%d), Length = %d, Null Flag = %d",
	  getDatatypeAsString(getDatatype()), getDatatype(), getLength(), getNullFlag());
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if ((getDatatype() == REC_BLOB) ||
      (getDatatype() == REC_CLOB))
    {
      Int16 precision = getPrecision();
      UInt16 scale = getScaleAsUI();
      
      Lng32 lobLen = (precision << 16);
      lobLen += scale;
      
      Int64 ll = (Int64)lobLen;
      //      Int64 ll = (Int64)getPrecision() * 1000 + (Int64)getScale();
      str_sprintf(buf, "      LobLength = %Ld Mb", ll);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }

  str_sprintf(buf, "      Precision = %d, Scale = %d, Collation = %d, flags_ = %b",
              getPrecision(), getScale(), getCollation(), flags_);

  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  str_cpy(buf, "      Tuple Data Format = ", 
          str_len("      Tuple Data Format = ")+1,'\0');

  switch (getTupleFormat())
    {
    case ExpTupleDesc::UNINITIALIZED_FORMAT: 
      str_cat(buf, "UNINITIALIZED_FORMAT", buf);
      break;

    case ExpTupleDesc::PACKED_FORMAT: 
      str_cat(buf, "PACKED_FORMAT", buf);
      break;

    case ExpTupleDesc::SQLMX_KEY_FORMAT: 
      str_cat(buf, "SQLMX_KEY_FORMAT", buf);
      break;

    case ExpTupleDesc::SQLARK_EXPLODED_FORMAT: 
      str_cat(buf, "SQLARK_EXPLODED_FORMAT", buf);
      break;

    case ExpTupleDesc::SQLMX_FORMAT: 
      str_cat(buf, "SQLMX_FORMAT", buf);
      break;

    case ExpTupleDesc::SQLMX_ALIGNED_FORMAT: 
      str_cat(buf, "SQLMX_ALIGNED_FORMAT", buf);
      break;

    default:
      str_cat(buf, "Unrecognized format", buf);
      break;

    } // switch tuple format

  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if (isSpecialField())
    {
      str_sprintf(buf, "      DefaultFieldNum = %d",getDefaultFieldNum());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
    
  char constOrTemp[150];
  if ((getAtp()) == 0 && (getAtpIndex() == 0))
    {
      str_cpy(constOrTemp, " (Constant)",
              str_len(" (Constant)")+1,'\0');
    }
  else if ((getAtp() == 0) && (getAtpIndex() == 1))
    str_cpy(constOrTemp, " (Temporary)",
            str_len(" (Temporary)")+1,'\0');
  else if ((getAtp() == 1) && (getAtpIndex() == 1))
    str_cpy(constOrTemp, " (Persistent)",
            str_len(" (Persistent)")+1,'\0');
  else if (getAtpIndex() == 0)
    str_cpy(constOrTemp, " !!!ERROR!!! - Invalid (Atp,AtpIndex)",
            str_len(" !!!ERROR!!! - Invalid (Atp,AtpIndex)")+1,'\0');
  else
    str_cpy(constOrTemp, " ", str_len(" ")+1,'\0');

  str_sprintf(buf, "      Atp = %d, AtpIndex = %d%s",
	  getAtp(), getAtpIndex(), constOrTemp);
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  str_sprintf(buf, "      Offset = %d, NullIndOffset = %d, VClenIndOffset = %d",
	  (getOffset() == ExpOffsetMax ? -1 : (Lng32)getOffset()),
	  (getNullIndOffset() == ExpOffsetMax ?  -1 : getNullIndOffset()),
	  (getVCLenIndOffset() == ExpOffsetMax ? -1 : getVCLenIndOffset()));
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if ((getTupleFormat() == ExpTupleDesc::SQLMX_FORMAT) ||
      (getTupleFormat() == ExpTupleDesc::SQLMX_ALIGNED_FORMAT))
    {
      str_sprintf(buf, "      RelOffset = %d, VoaOffset = %d, NullBitIdx = %d",
                  getRelOffset(),
                  (getVoaOffset() == ExpOffsetMax ? -1 : getVoaOffset()),
                  getNullBitIndex());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }

  str_sprintf(buf, "      NullIndLength = %d, VClenIndLength = %d",
	      getNullIndicatorLength(), getVCIndicatorLength());
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if ((getRowsetSize() > 0) ||
      (getRowsetInfo()))
    {
      str_sprintf(buf, "      rowsetSize_ = %d, rowsetInfo_ = %b",
		  getRowsetSize(), getRowsetInfo());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
  
  if (spAttr)
    {
      str_sprintf(buf, "      ValueId = %d",
	      ((ShowplanAttributes *)spAttr)->valueId());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "      Text = %s",
	      (((ShowplanAttributes *)spAttr)->text() ? 
	       ((ShowplanAttributes *)spAttr)->text() : ""));
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
#endif   // __EID
}