Esempio n. 1
0
 void UNIFAQParameterLibrary::populate(std::string &group_data, std::string &interaction_data, std::string &decomp_data)
 {
     rapidjson::Document group_JSON = jsonize(group_data);
     rapidjson::Document interaction_JSON = jsonize(interaction_data);
     rapidjson::Document decomp_JSON = jsonize(decomp_data);
     populate(group_JSON, interaction_JSON, decomp_JSON);
 }
Esempio n. 2
0
void jsonize(struct cog *cog, FILE *file) {
  if (cog == NULL) fprintf(file, "null");

  if (cog->type == COG_BTREE) {
    fprintf(file, "{\"name\":\"%li ", cog->data.btree.sep);
    fprintf(file, "Total: %li ", cog->data.btree.rds);
    fprintf(file, "Reads: %li\",", getReadsAtNode(cog));
    fprintf(file, "\"children\":[");
    jsonize(cog->data.btree.lhs, file);
    fprintf(file, ",");
    jsonize(cog->data.btree.rhs, file);
    fprintf(file, "]}");
  } else {
    fprintf(file, "{\"name\":\"Elements\"}");
  }
}
std::string messageToJSON(const Poco::Message& message)
{
	std::ostringstream json;
	
	json 
		<< "{"
		<< quote("source") << ":"
		<< jsonize(message.getSource())
		<< ","
		<< quote("text") << ":"
		<< jsonize(message.getText())
		<< ","
		<< quote("priority") << ":"
		<< static_cast<int>(message.getPriority())
		<< ","
		<< quote("timestamp") << ":"
		<< quote(Poco::DateTimeFormatter::format(message.getTime(), Poco::DateTimeFormat::ISO8601_FRAC_FORMAT))
		<< "}";
	
	return json.str();
}
Esempio n. 4
0
/**
 * Converts the JITD to JSON and places it in the file './test.txt'.
 *
 * @param cog - the root cog
 * @param name - output file name
 */
void jsonJITD(struct cog *cog, char *name) {
  FILE *file = fopen(name, "w");
  jsonize(cog, file);
  fclose(file);
}