Пример #1
0
/**
 * toString
 *
 *  Convert the event to a string.
 *
 * @return std::string - stringified versino of the event.
 */
std::string
CPhysicsEventItem::toString() const
{
  std::ostringstream out;
  uint32_t  bytes = getBodySize();
  uint32_t  words = bytes/sizeof(uint16_t);
  const uint16_t* body  = reinterpret_cast<const uint16_t*>((const_cast<CPhysicsEventItem*>(this))->getBodyPointer());

  out << "Event " << bytes << " bytes long\n";

  int  w = out.width();
  char f = out.fill();

  
  for (int i =1; i <= words; i++) {
    char number[32];
    sprintf(number, "%04x ", *body++);
    out << number;
    if ( (i%8) == 0) {
      out << std::endl;
    }
  }
  out << std::endl;
  
  
  return out.str();

}
Пример #2
0
DAQ::Buffer::ByteBuffer CPhysicsEventItem::getBodyData() const
{
  auto pBegin = reinterpret_cast<const char*>(getBodyPointer());
  auto pEnd   = pBegin + getBodySize();

  return DAQ::Buffer::ByteBuffer(pBegin, pEnd);
}
Пример #3
0
void AstClause::print(std::ostream& os) const {
    if (head != nullptr) {
        head->print(os);
    }
    if (getBodySize() > 0) {
        os << " :- \n   ";
        os << join(getBodyLiterals(), ",\n   ", print_deref<AstLiteral*>());
    }
    os << ".";
    if (getExecutionPlan()) {
        getExecutionPlan()->print(os);
    }
}
Пример #4
0
bool AstClause::isFact() const {
    // there must be a head
    if (head == nullptr) {
        return false;
    }
    // there must not be any body clauses
    if (getBodySize() != 0) {
        return false;
    }
    // and there are no aggregates
    bool hasAggregates = false;
    visitDepthFirst(*head, [&](const AstAggregator& cur) { hasAggregates = true; });
    return !hasAggregates;
}
Пример #5
0
static bool loadProduction(const char *pData)
{
	PRODUCTION_FUNCTION	*psFunction;
	char					functionName[MAX_STR_LENGTH], bodySize[MAX_STR_LENGTH];
	UDWORD					productionOutput;

	psFunction = (PRODUCTION_FUNCTION *)malloc(sizeof(PRODUCTION_FUNCTION));
	memset(psFunction, 0, sizeof(PRODUCTION_FUNCTION));

	//store the pointer in the Function Array
	*asFunctions = (FUNCTION *)psFunction;
	psFunction->ref = REF_FUNCTION_START + numFunctions;
	numFunctions++;
	asFunctions++;

	//set the type of function
	psFunction->type = PRODUCTION_TYPE;

	//read the data in
	functionName[0] = '\0';
	bodySize[0] = '\0';
	sscanf(pData, "%255[^,'\r\n],%255[^,'\r\n],%d", functionName, bodySize,
	       &productionOutput);

	//allocate storage for the name
	storeName((FUNCTION *)psFunction, functionName);

	if (!getBodySize(bodySize, &psFunction->capacity))
	{
		ASSERT(false, "loadProduction: unknown body size for %s", psFunction->pName);
		return false;
	}

	//check prod output < UWORD_MAX
	if (productionOutput < UWORD_MAX)
	{
		psFunction->productionOutput = (UWORD)productionOutput;
	}
	else
	{
		ASSERT(false, "loadProduction: production Output too big for %s", psFunction->pName);

		psFunction->productionOutput = 0;
	}

	return true;
}
StringBuffer MailSyncSourceConfig::print() {

    StringBuffer ret;
    ret = "** SOURCE: "; ret += getName(); ret += "**\r\n";
    
    ret += "URI:\t\t"; ret += getURI(); ret += "\r\n";
    ret += "SyncModes:\t"; ret += getSyncModes(); ret += "\r\n";
    ret += "Type:\t\t"; ret += getType(); ret += "\r\n";
    ret += "Sync:\t\t"; ret += getSync(); ret += "\r\n";
    ret += "Encoding:\t"; ret += getEncoding(); ret += "\r\n";
    ret += "Version:\t"; ret += getVersion(); ret += "\r\n";
    ret += "SupportedType:\t"; ret += getSupportedTypes(); ret += "\r\n";
    ret += "Last:\t\t"; ret.append(getLast()); ret += "\r\n";
    ret += "Encryption:\t"; ret += getEncryption(); ret += "\r\n";    
    ret += "Enabled:\t"; ret += (isEnabled() == true ? "1" : "0"); ret += "\r\n";    


    ret += "DownloadAge:\t"; ret.append(getDownloadAge()); ret += "\r\n";    
    ret += "BodySize:\t"; ret.append(getBodySize()); ret += "\r\n";
    ret += "AttachSize:\t"; ret.append(getAttachSize()); ret += "\r\n";

    return ret;
}
Пример #7
0
sf::Vector2f Mouse::getBodyPosition()
{
	return sf::Vector2f(mouseBody.getPosition().x+getBodySize(), mouseBody.getPosition().y+getBodySize());
}