<commit_before>#include "codeGenVisitor.h"

void CodeGenVisitor::populateSwitchMap() {
	switchMap.insert(std::make_pair("+", BOP_PLUS));
	switchMap.insert(std::make_pair("-", BOP_MINUS));
	switchMap.insert(std::make_pair("*", BOP_MULT));
	switchMap.insert(std::make_pair("/", BOP_DIV));
	switchMap.insert(std::make_pair(">=", BOP_GTE));
	switchMap.insert(std::make_pair("<=", BOP_LTE));
	switchMap.insert(std::make_pair(">", BOP_GT));
	switchMap.insert(std::make_pair("<", BOP_LT));
	switchMap.insert(std::make_pair("!=", BOP_NEQ));
	switchMap.insert(std::make_pair("==", BOP_EQ));
	switchMap.insert(std::make_pair(".", BOP_DOT));
}

llvm::Value* CodeGenVisitor::ErrorV(const char* str) {
  fprintf(stderr, "Error: %s\n", str);
  return nullptr;
}

llvm::Function* CodeGenVisitor::generateFunction(FunctionDefinition* f) {
	std::string type = f->type->name;
	llvm::FunctionType* funcType = nullptr;
	llvm::Function* func = nullptr;
	std::vector<llvm::Type*> inputArgs; //set input args as float or int
	for(size_t i = 0, end = f->args->size(); i < end; ++i) {
		std::string type = f->args[i][0]->type->name;
		if(type == "float") {
			inputArgs.push_back(llvm::Type::getDoubleTy(*context));
		}
		else if(type == "int") {
			inputArgs.push_back(llvm::Type::getInt64Ty(*context));
		}
		else
			return nullptr;
	}
	if(type == "void") { //set function return type
		funcType = llvm::FunctionType::get(llvm::Type::getVoidTy(*context), inputArgs, false);
	}
	else if(type == "float") {
		funcType = llvm::FunctionType::get(llvm::Type::getDoubleTy(*context), inputArgs, false);
	}
	else if(type == "int") {
		funcType = llvm::FunctionType::get(llvm::Type::getInt64Ty(*context), inputArgs, false);
	}
	func = llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, f->ident->name, theModule.get()); //pass unique ptr to function
	{
	size_t i = 0;
	for (auto &arg : func->args())
	  arg.setName(f->args[i++][0]->ident->name);
	}
	return func;
}

CodeGenVisitor::CodeGenVisitor(std::string name) {
	populateSwitchMap();
	context = &llvm::getGlobalContext();
	theModule = llvm::make_unique<llvm::Module>(name, *context);
	builder = llvm::make_unique<llvm::IRBuilder<>>(*context);
}

/*===================================Node===================================*/
llvm::Value* CodeGenVisitor::visitNode(Node* n) {
	return ErrorV("Attempt to generate code for generic Node");
}

/*================================Expression================================*/
llvm::Value* CodeGenVisitor::visitExpression(Expression* e) {
	return ErrorV("Attempt to generate code for generic Expression");
}

/*================================Statement=================================*/
llvm::Value* CodeGenVisitor::visitStatement(Statement* s) {
	return ErrorV("Attempt to generate code for generic Statement");
}

/*=================================Integer==================================*/
llvm::Value* CodeGenVisitor::visitInteger(Integer* i) {
	return llvm::ConstantInt::get(*context, llvm::APInt(i->value, 64));
}

/*==================================Float===================================*/
llvm::Value* CodeGenVisitor::visitFloat(Float* f) {
	return llvm::ConstantFP::get(*context, llvm::APFloat(f->value));
}

/*================================Identifier================================*/
llvm::Value* CodeGenVisitor::visitIdentifier(Identifier* i) {
  llvm::Value* val = namedValues[i->name];
  if (!val)
    return ErrorV("Attempt to generate code for not previously defined variable");
  return val;
}

/*=============================NullaryOperator==============================*/
llvm::Value* CodeGenVisitor::visitNullaryOperator(NullaryOperator* n) {
	if(*n->op == ';') {
		//commit action
		return nullptr;
	}
	return ErrorV("Invalid nullary operator");
}

/*==============================UnaryOperator===============================*/
llvm::Value* CodeGenVisitor::visitUnaryOperator(UnaryOperator* u) {
	llvm::Value* expr = u->exp->acceptVisitor(this);
	switch(*u->op) {
		case '-':
		return builder->CreateFMul(llvm::ConstantInt::get(*context, llvm::APInt(-1, 64)), expr, "multmp");
		case '!':
		case '*':
		return ErrorV("Not yet specified unary operator");
		default:
		return ErrorV("Invalid unary operator");
	}
}

/*==============================BinaryOperator==============================*/
llvm::Value* CodeGenVisitor::visitBinaryOperator(BinaryOperator* b) {
	llvm::Value* left = b->left->acceptVisitor(this);
 	llvm::Value* right = b->right->acceptVisitor(this);
 	//grab left and right
	if (!left || !right)
		return ErrorV("Could not evaluate binary operator");
	//use map for binary operators
	switch (switchMap.find(b->op)->second) {
		case BOP_PLUS:
		return builder->CreateFAdd(left, right, "addtmp");
		case BOP_MINUS:
		return builder->CreateFSub(left, right, "subtmp");
		case BOP_MULT:
		return builder->CreateFMul(left, right, "multmp");
		case BOP_DIV:
		return builder->CreateFDiv(left, right, "divtmp");
		case BOP_NEQ:
		case BOP_EQ:
		case BOP_GTE:
		case BOP_LTE:
		case BOP_GT:
		case BOP_LT:
		case BOP_DOT:
		return ErrorV("Attempt to generate code for not yet implemented binary operator");
		//assignment op separate
		default:
		return ErrorV("Invalid binary operator");
	}
}

/*==================================Block===================================*/
llvm::Value* CodeGenVisitor::visitBlock(Block* b) {
	llvm::Value* lastVisited;
	std::vector<Statement*,gc_allocator<Statement*>>* statements = b->statements;
	for(size_t i = 0, end = statements->size(); i != end; ++i) {
		lastVisited = statements[i][0]->acceptVisitor(this);
		//if(!lastVisited) //TODO:nullary operator needs more explicit handling
		//	return nullptr;
	}
	return lastVisited;
}

/*===============================FunctionCall===============================*/
llvm::Value* CodeGenVisitor::visitFunctionCall(FunctionCall* f) {
	//grab function and evaluate with arguments
	llvm::Function* func = theModule->getFunction(f->ident->name);
	if(!func)
		return ErrorV("Unknown function reference");
	if(func->arg_size() != f->args->size())
		return ErrorV("Wrong number of arguments passed");

	std::vector<llvm::Value*> argVector;
	for(size_t i = 0, end = f->args->size(); i != end; ++i) {
		argVector.push_back(f->args[i][0]->acceptVisitor(this));
		if(!argVector.back())
			return nullptr;
	}
	return builder->CreateCall(func, argVector, "calltmp");
}

/*=================================Keyword==================================*/
llvm::Value* CodeGenVisitor::visitKeyword(Keyword* k) {
	return ErrorV("Attempt to generate code for dangling keyword");
}

/*============================VariableDefinition============================*/
llvm::Value* CodeGenVisitor::visitVariableDefinition(VariableDefinition* v) {
	std::string type = v->type->name; //int float or void
	llvm::Value* val = nullptr;
	if(type == "int") {
		int64_t i = 0; //TODO: Figure out why variable necessary, attempted casting already
		val = llvm::ConstantInt::get(*context, llvm::APInt(i, 64));
	}
	else if(type == "float")
		val = llvm::ConstantFP::get(*context, llvm::APFloat(0.0));
	if(!val) //add default value variable to map
		namedValues.insert(std::make_pair(v->ident->name, val));
	return val;
}

/*===========================StructureDefinition============================*/
llvm::Value* CodeGenVisitor::visitStructureDefinition(StructureDefinition* s) {
	return ErrorV("Attempt to evaluate not yet implemented structure definition");
}

/*============================FunctionDefinition============================*/
llvm::Value* CodeGenVisitor::visitFunctionDefinition(FunctionDefinition* f) {
	llvm::Function* func = theModule->getFunction(f->ident->name);
	if(!func)
		func = generateFunction(f); //create function object with type|ident|args
	if(!func) //generateFunction returned nullptr
		return nullptr;
	if(!func->empty())
		return ErrorV("Function is already defined");
	llvm::BasicBlock* block = llvm::BasicBlock::Create(*context, "function start", func);
	builder->SetInsertPoint(block);
	namedValues.clear();
	for (auto &arg : func->args())
		namedValues[arg.getName()] = &arg;
		func->dump();//Function IR dump
		llvm::Value* retVal = f->block->acceptVisitor(this);
	if(retVal->getType()->getTypeID() == func->getReturnType()->getTypeID()) {
		return retVal;
	}
	func->eraseFromParent();//erase if incorrect type returned
	return nullptr;
}

/*==========================StructureDeclaration============================*/
llvm::Value* CodeGenVisitor::visitStructureDeclaration(StructureDeclaration* s) {
	return ErrorV("Attempt to evaluate not yet implemented structure declaration");
}

/*===========================ExpressionStatement============================*/
llvm::Value* CodeGenVisitor::visitExpressionStatement(ExpressionStatement* e) {
	return e->exp->acceptVisitor(this);	//evaluated but value discarded
}

/*=============================ReturnStatement==============================*/
llvm::Value* CodeGenVisitor::visitReturnStatement(ReturnStatement* r) {
	llvm::Value* returnVal = r->exp->acceptVisitor(this);
	if(returnVal) {
		builder->CreateRet(returnVal); //builder returns value
	}
	return returnVal;
}

/*=============================AssignStatement==============================*/
llvm::Value* CodeGenVisitor::visitAssignStatement(AssignStatement* a) {
	//TODO: map a value to an exisiting identifier
	//look for identifier
	//map target to value
	return nullptr;
}

/*===============================IfStatement================================*/
llvm::Value* CodeGenVisitor::visitIfStatement(IfStatement* i) {
	return ErrorV("Attempt to evaluate not yet implemented if statement");
}
<commit_msg>Added error message for function return type | explicit type checking for void type<commit_after>#include "codeGenVisitor.h"

void CodeGenVisitor::populateSwitchMap() {
	switchMap.insert(std::make_pair("+", BOP_PLUS));
	switchMap.insert(std::make_pair("-", BOP_MINUS));
	switchMap.insert(std::make_pair("*", BOP_MULT));
	switchMap.insert(std::make_pair("/", BOP_DIV));
	switchMap.insert(std::make_pair(">=", BOP_GTE));
	switchMap.insert(std::make_pair("<=", BOP_LTE));
	switchMap.insert(std::make_pair(">", BOP_GT));
	switchMap.insert(std::make_pair("<", BOP_LT));
	switchMap.insert(std::make_pair("!=", BOP_NEQ));
	switchMap.insert(std::make_pair("==", BOP_EQ));
	switchMap.insert(std::make_pair(".", BOP_DOT));
}

llvm::Value* CodeGenVisitor::ErrorV(const char* str) {
  fprintf(stderr, "Error: %s\n", str);
  return nullptr;
}

llvm::Function* CodeGenVisitor::generateFunction(FunctionDefinition* f) {
	std::string type = f->type->name;
	llvm::FunctionType* funcType = nullptr;
	llvm::Function* func = nullptr;
	std::vector<llvm::Type*> inputArgs; //set input args as float or int
	for(size_t i = 0, end = f->args->size(); i < end; ++i) {
		std::string type = f->args[i][0]->type->name;
		if(type == "float") {
			inputArgs.push_back(llvm::Type::getDoubleTy(*context));
		}
		else if(type == "int") {
			inputArgs.push_back(llvm::Type::getInt64Ty(*context));
		}
		else
			return nullptr;
	}
	if(type == "void") { //set function return type
		funcType = llvm::FunctionType::get(llvm::Type::getVoidTy(*context), inputArgs, false);
	}
	else if(type == "float") {
		funcType = llvm::FunctionType::get(llvm::Type::getDoubleTy(*context), inputArgs, false);
	}
	else if(type == "int") {
		funcType = llvm::FunctionType::get(llvm::Type::getInt64Ty(*context), inputArgs, false);
	}
	func = llvm::Function::Create(funcType, llvm::Function::ExternalLinkage, f->ident->name, theModule.get()); //pass unique ptr to function
	{
	size_t i = 0;
	for (auto &arg : func->args())
	  arg.setName(f->args[i++][0]->ident->name);
	}
	return func;
}

CodeGenVisitor::CodeGenVisitor(std::string name) {
	populateSwitchMap();
	context = &llvm::getGlobalContext();
	theModule = llvm::make_unique<llvm::Module>(name, *context);
	builder = llvm::make_unique<llvm::IRBuilder<>>(*context);
}

/*===================================Node===================================*/
llvm::Value* CodeGenVisitor::visitNode(Node* n) {
	return ErrorV("Attempt to generate code for generic Node");
}

/*================================Expression================================*/
llvm::Value* CodeGenVisitor::visitExpression(Expression* e) {
	return ErrorV("Attempt to generate code for generic Expression");
}

/*================================Statement=================================*/
llvm::Value* CodeGenVisitor::visitStatement(Statement* s) {
	return ErrorV("Attempt to generate code for generic Statement");
}

/*=================================Integer==================================*/
llvm::Value* CodeGenVisitor::visitInteger(Integer* i) {
	return llvm::ConstantInt::get(*context, llvm::APInt(i->value, 64));
}

/*==================================Float===================================*/
llvm::Value* CodeGenVisitor::visitFloat(Float* f) {
	return llvm::ConstantFP::get(*context, llvm::APFloat(f->value));
}

/*================================Identifier================================*/
llvm::Value* CodeGenVisitor::visitIdentifier(Identifier* i) {
  llvm::Value* val = namedValues[i->name];
  if (!val)
    return ErrorV("Attempt to generate code for not previously defined variable");
  return val;
}

/*=============================NullaryOperator==============================*/
llvm::Value* CodeGenVisitor::visitNullaryOperator(NullaryOperator* n) {
	if(*n->op == ';') {
		//commit action
		return nullptr;
	}
	return ErrorV("Invalid nullary operator");
}

/*==============================UnaryOperator===============================*/
llvm::Value* CodeGenVisitor::visitUnaryOperator(UnaryOperator* u) {
	llvm::Value* expr = u->exp->acceptVisitor(this);
	switch(*u->op) {
		case '-':
		return builder->CreateFMul(llvm::ConstantInt::get(*context, llvm::APInt(-1, 64)), expr, "multmp");
		case '!':
		case '*':
		return ErrorV("Not yet specified unary operator");
		default:
		return ErrorV("Invalid unary operator");
	}
}

/*==============================BinaryOperator==============================*/
llvm::Value* CodeGenVisitor::visitBinaryOperator(BinaryOperator* b) {
	llvm::Value* left = b->left->acceptVisitor(this);
 	llvm::Value* right = b->right->acceptVisitor(this);
 	//grab left and right
	if (!left || !right)
		return ErrorV("Could not evaluate binary operator");
	//use map for binary operators
	switch (switchMap.find(b->op)->second) {
		case BOP_PLUS:
		return builder->CreateFAdd(left, right, "addtmp");
		case BOP_MINUS:
		return builder->CreateFSub(left, right, "subtmp");
		case BOP_MULT:
		return builder->CreateFMul(left, right, "multmp");
		case BOP_DIV:
		return builder->CreateFDiv(left, right, "divtmp");
		case BOP_NEQ:
		case BOP_EQ:
		case BOP_GTE:
		case BOP_LTE:
		case BOP_GT:
		case BOP_LT:
		case BOP_DOT:
		return ErrorV("Attempt to generate code for not yet implemented binary operator");
		//assignment op separate
		default:
		return ErrorV("Invalid binary operator");
	}
}

/*==================================Block===================================*/
llvm::Value* CodeGenVisitor::visitBlock(Block* b) {
	llvm::Value* lastVisited;
	std::vector<Statement*,gc_allocator<Statement*>>* statements = b->statements;
	for(size_t i = 0, end = statements->size(); i != end; ++i) {
		lastVisited = statements[i][0]->acceptVisitor(this);
		//if(!lastVisited) //TODO:nullary operator needs more explicit handling
		//	return nullptr;
	}
	return lastVisited;
}

/*===============================FunctionCall===============================*/
llvm::Value* CodeGenVisitor::visitFunctionCall(FunctionCall* f) {
	//grab function and evaluate with arguments
	llvm::Function* func = theModule->getFunction(f->ident->name);
	if(!func)
		return ErrorV("Unknown function reference");
	if(func->arg_size() != f->args->size())
		return ErrorV("Wrong number of arguments passed");

	std::vector<llvm::Value*> argVector;
	for(size_t i = 0, end = f->args->size(); i != end; ++i) {
		argVector.push_back(f->args[i][0]->acceptVisitor(this));
		if(!argVector.back())
			return nullptr;
	}
	return builder->CreateCall(func, argVector, "calltmp");
}

/*=================================Keyword==================================*/
llvm::Value* CodeGenVisitor::visitKeyword(Keyword* k) {
	return ErrorV("Attempt to generate code for dangling keyword");
}

/*============================VariableDefinition============================*/
llvm::Value* CodeGenVisitor::visitVariableDefinition(VariableDefinition* v) {
	std::string type = v->type->name; //int float or void
	llvm::Value* val = nullptr;
	if(type == "int") {
		int64_t i = 0; //TODO: Figure out why variable necessary, attempted casting already
		val = llvm::ConstantInt::get(*context, llvm::APInt(i, 64));
	}
	else if(type == "float")
		val = llvm::ConstantFP::get(*context, llvm::APFloat(0.0));
	if(!val) //add default value variable to map
		namedValues.insert(std::make_pair(v->ident->name, val));
	return val;
}

/*===========================StructureDefinition============================*/
llvm::Value* CodeGenVisitor::visitStructureDefinition(StructureDefinition* s) {
	return ErrorV("Attempt to evaluate not yet implemented structure definition");
}

/*============================FunctionDefinition============================*/
llvm::Value* CodeGenVisitor::visitFunctionDefinition(FunctionDefinition* f) {
	llvm::Function* func = theModule->getFunction(f->ident->name);
	if(!func)
		func = generateFunction(f); //create function object with type|ident|args
	if(!func) //generateFunction returned nullptr
		return nullptr;
	if(!func->empty())
		return ErrorV("Function is already defined");
	llvm::BasicBlock* block = llvm::BasicBlock::Create(*context, "function start", func);
	builder->SetInsertPoint(block);
	namedValues.clear();
	for (auto &arg : func->args())
		namedValues[arg.getName()] = &arg;
		llvm::Value* retVal = f->block->acceptVisitor(this);
	if(!retVal && (func->getReturnType()->getTypeID() == llvm::Type::VoidTyID)) //void return nullptr
		func->dump();//Function IR dump
		return nullptr;
	if(retVal->getType()->getTypeID() == func->getReturnType()->getTypeID()) //check typing for int/float
		func->dump();
		return retVal;
	func->eraseFromParent();//erase if incorrect type returned
	return ErrorV("Function deleted for erroneous return type or function body complications");
}

/*==========================StructureDeclaration============================*/
llvm::Value* CodeGenVisitor::visitStructureDeclaration(StructureDeclaration* s) {
	return ErrorV("Attempt to evaluate not yet implemented structure declaration");
}

/*===========================ExpressionStatement============================*/
llvm::Value* CodeGenVisitor::visitExpressionStatement(ExpressionStatement* e) {
	return e->exp->acceptVisitor(this);	//evaluated but value discarded
}

/*=============================ReturnStatement==============================*/
llvm::Value* CodeGenVisitor::visitReturnStatement(ReturnStatement* r) {
	llvm::Value* returnVal = r->exp->acceptVisitor(this);
	if(returnVal) {
		builder->CreateRet(returnVal); //builder returns value
	}
	return returnVal;
}

/*=============================AssignStatement==============================*/
llvm::Value* CodeGenVisitor::visitAssignStatement(AssignStatement* a) {
	//TODO: map a value to an exisiting identifier
	//look for identifier
	//map target to value
	return nullptr;
}

/*===============================IfStatement================================*/
llvm::Value* CodeGenVisitor::visitIfStatement(IfStatement* i) {
	return ErrorV("Attempt to evaluate not yet implemented if statement");
}
<|endoftext|>


<commit_before>/**
 * File        : Fringe.cc
 * Description : Implementation of the fringe algorithm using a specified "world"
 *               from the worlds folder.
 */

#include <iostream>
#include <fstream>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <vector>
#include <cmath>
#include <chrono>
#include <thread>
#include <mutex>

#include <boost/lexical_cast.hpp>

#include "algorithms/tools/PathTile.h"
#include "common/Results.h"

using namespace pathFind;

const std::string WORLD_DIR = "../worlds";
const std::string WORLD_EXT = ".world";
const std::string PATH_EXT = ".path";

const std::string ALG_NAME = "fringe";

void searchNeighbor (const Point& adjPoint, const World& world, const PathTile& current,
    uint threshold, uint& min, std::vector<PathTile>& now, std::vector<PathTile>& later,
    std::unordered_map<uint, PathTile>& seen, const std::function<uint (uint, uint)>& h);

int main (int args, char* argv[])
{
    // Program should be started with 5 command line parameters (or 1)
    // that specifies the name of the world file to read from and then optionallys
    // the start x, start y, end x, and end y
    if (args != 6  && args != 2)
    {
        std::cout << "Incorrect inputs. Usage: <filename> (start x) (start y) (end x) (end y)" << std::endl;
        return EXIT_FAILURE;
    }

    // Parse the world file
    std::stringstream filename;
    filename << WORLD_DIR << "/" << argv[1] << WORLD_EXT;

    std::ifstream worldFile (filename.str (),
            std::ifstream::in | std::ifstream::binary);

    if (!worldFile)
    {
        std::cout << "World file doesn't exist." << std::endl;
        return EXIT_FAILURE;
    }
    pathFind::World world;

    worldFile >> world;
    worldFile.close ();

    uint startX, startY, endX, endY;

    if (args == 6)
    {
        // Parse the start and end points
        try
        {
            startX = boost::lexical_cast<uint> (argv[2]);
            startY = boost::lexical_cast<uint> (argv[3]);
            endX = boost::lexical_cast<uint> (argv[4]);
            endY = boost::lexical_cast<uint> (argv[5]);
        } catch (boost::bad_lexical_cast &e)
        {
            std::cout << "Start and end points failed to convert to numeric types" << std::endl;
            return EXIT_FAILURE;
        }
    }
    else
    {
        std::stringstream pathFilename;
        pathFilename << WORLD_DIR << "/" << argv[1] << PATH_EXT;
        std::ifstream pathIn (pathFilename.str ());
        if (!pathIn)
        {
            std::string pathCommand = "./pathGen " + std::string (argv[1]);
            system (pathCommand.c_str());
            pathIn.close ();
            pathIn.open (pathFilename.str ());
            if (!pathIn)
            {
                std::cout << "Could not construct path." << std::endl;
                return EXIT_FAILURE;
            }
        }
        pathIn >> startX >> startY >> endX >> endY;

    }

    #ifdef GEN_STATS
        std::vector<std::unordered_map<uint, StatPoint>> stats (1);
    #endif

    auto t1 = std::chrono::high_resolution_clock::now();

    std::function<uint (uint, uint)> h = [endX, endY] (uint x, uint y)
    {
        return  (x < endX ? endX - x : x - endX) +
                (y < endY ? endY - y : y - endY);
    };

    std::vector<PathTile> now, later;
    now.emplace_back (world (startX, startY), Point{startX, startY},
    		Point {startX, startY}, 0, h (startX, startY));

    uint threshold = now.back().getCombinedHeuristic();
    std::unordered_map <uint, PathTile> seen;
    seen[now.back().getTile().id] = now.back ();

    bool found = false;

    while (!found)
    {
        uint min = PathTile::INF;

        while (!now.empty ())
        {
            PathTile current = now.back();
            now.pop_back();
            #ifdef GEN_STATS
                auto statIter = stats[0].find (current.getTile ().id);
                if (statIter == stats[0].end ())
                {
                    stats[0][current.getTile ().id] = StatPoint {current.xy ().x, current.xy ().y};
                }
                else
                {
                    statIter->second.processCount++;
                }
            #endif

            if (seen.find(current.getTile().id) != seen.end())
            {
                continue;
            }

            if (current.getCombinedHeuristic () > threshold)
            {
                min = std::min(current.getCombinedHeuristic (), min);
                later.push_back(current);
                continue;
            }

            if (current.xy().x == endX && current.xy().y == endY)
            {
                found = true;
                break;
            }

            // East
            searchNeighbor({current.xy ().x + 1, current.xy ().y}, world, current, threshold,
                min, now, later, seen, h);
            // South
            searchNeighbor({current.xy ().x, current.xy ().y + 1}, world, current, threshold,
                min, now, later, seen, h);
            // West
            searchNeighbor({current.xy ().x - 1, current.xy ().y}, world, current, threshold,
                min, now, later, seen, h);
            // North
            searchNeighbor({current.xy ().x, current.xy ().y - 1}, world, current, threshold,
                min, now, later, seen, h);

        }
        threshold = min;
        now = std::move(later);
        later.clear ();
    }

    auto t2 = std::chrono::high_resolution_clock::now();

    // Parse reverse results
    PathTile endTile = seen.at((endY * world.getWidth())+ endX);
    uint totalCost = endTile.getBestCost() - endTile.getTile().cost;
    std::vector<Point> finalPath;
    while (endTile.xy ().x != startX || endTile.xy ().y != startY)
    {
        finalPath.emplace_back(endTile.xy ());
        endTile = seen.at((endTile.bestTile ().y * world.getWidth()) + endTile.bestTile ().x);
    }
    finalPath.emplace_back(endTile.xy ());

    #ifdef GEN_STATS
        writeResults (finalPath, stats, argv[1], ALG_NAME,
                std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count(), totalCost);
    #else
        writeResults (finalPath, argv[1], ALG_NAME,
                std::chrono::duration_cast<std::chrono::milliseconds>(t2-t1).count(), totalCost);
    #endif

    return EXIT_SUCCESS;
}

void searchNeighbor (const Point& adjPoint, const World& world, const PathTile& current,
    uint threshold, uint& min, std::vector<PathTile>& now, std::vector<PathTile>& later,
    std::unordered_map<uint, PathTile>& seen, const std::function<uint (uint, uint)>& h)
{
    if (adjPoint.x < world.getWidth () && adjPoint.y < world.getHeight ())
    {
        World::tile_t worldTile = world (adjPoint.x, adjPoint.y);
        if (worldTile.cost != 0)
        {

            auto seenTileIter = seen.find(worldTile.id);
            if (seenTileIter == seen.end ())
            {
                // TODO: Check if will exceed threshold here to emplace into later instead?
                now.emplace_back (worldTile, adjPoint, current.xy(),
                                  current.getBestCost () + worldTile.cost, h (adjPoint.x, adjPoint.y));
                seen[worldTile.id] = now.back();
            }
            else
            {
                PathTile& seenTile = seenTileIter->second;
                uint costToTile = current.getBestCost () + seenTile.getTile ().cost;
                if (seenTile.getBestCost () > costToTile)
                {
                    seenTile.setBestCost (costToTile);
                    seenTile.setBestTile (current.xy());
                    if (seenTile.getCombinedHeuristic () > threshold)
                    {
                        min = std::min(seenTile.getCombinedHeuristic (), min);
                        later.push_back(seenTile);
                    }
                    else
                    {
                        now.push_back(seenTile);
                    }
                }
            }
        }
    }
}

/*
void search (uint startX, uint startY, uint endX, uint endY, std::unordered_set<uint>& tileIdsFound,
             std::unordered_map<uint, PathTile>& expandedTiles,
             pathFind::PathTile& tile, const pathFind::World& world,
             std::mutex& m, bool& finished, bool& iFound)
{
    PriorityQueue openTiles (world.getWidth (), world.getHeight (), [endX, endY] (uint x, uint y)
    {
        return  (x < endX ? endX - x : x - endX) +
                (y < endY ? endY - y : y - endY);
    });

    openTiles.push (world (startX, startY), {startX, startY}, 0);

    tile = openTiles.top ();
    while (tile.xy ().x != endX || tile.xy ().y != endY)
    {
        tile = openTiles.top ();

        m.lock ();
        if (finished)
        {
            m.unlock ();
            break;
        }
        if (tileIdsFound.count(tile.getTile().id))
        {
            // Best path found
            iFound = true;
            finished = true;
            m.unlock ();
            break;
        }
        tileIdsFound.insert(tile.getTile().id);
        m.unlock ();

        expandedTiles[tile.getTile ().id] = tile;
        openTiles.pop ();

        // Check each neighbor
        Point adjPoint {tile.xy ().x + 1, tile.xy ().y}; // east
        if (adjPoint.x < world.getWidth() && adjPoint.y < world.getHeight ())
        {
            World::tile_t worldTile = world (adjPoint.x, adjPoint.y);
            if (worldTile.cost != 0 &&
                expandedTiles.find (worldTile.id) == expandedTiles.end ())
            {
                openTiles.tryUpdateBestCost (worldTile, adjPoint, tile);
            }
        }

        adjPoint = {tile.xy ().x, tile.xy ().y + 1}; // south
        if (adjPoint.x < world.getWidth() && adjPoint.y < world.getHeight ())
        {
            World::tile_t worldTile = world (adjPoint.x, adjPoint.y);
            if (worldTile.cost != 0 &&
                expandedTiles.find (worldTile.id) == expandedTiles.end ())
            {
                openTiles.tryUpdateBestCost (worldTile, adjPoint, tile);
            }
        }

        adjPoint = {tile.xy ().x - 1, tile.xy ().y}; // west
        if (adjPoint.x < world.getWidth() && adjPoint.y < world.getHeight ())
        {
            World::tile_t worldTile = world (adjPoint.x, adjPoint.y);
            if (worldTile.cost != 0 &&
                expandedTiles.find (worldTile.id) == expandedTiles.end ())
            {
                openTiles.tryUpdateBestCost (worldTile, adjPoint, tile);
            }
        }

        adjPoint = {tile.xy ().x, tile.xy ().y - 1}; // north
        if (adjPoint.x < world.getWidth() && adjPoint.y < world.getHeight ())
        {
            World::tile_t worldTile = world (adjPoint.x, adjPoint.y);
            if (worldTile.cost != 0 &&
                expandedTiles.find (worldTile.id) == expandedTiles.end ())
            {
                openTiles.tryUpdateBestCost (worldTile, adjPoint, tile);
            }
        }
    }
}
*/
<commit_msg>Removed alternate Fringe. It was slower.<commit_after><|endoftext|>


<commit_before>// This file is part of the AliceVision project.
// Copyright (c) 2017 AliceVision contributors.
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

#include "SfMData.hpp"

#include <memory>

#define BOOST_TEST_MODULE sfmRig
#include <boost/test/included/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>

using namespace aliceVision;
using namespace aliceVision::sfm;

BOOST_AUTO_TEST_CASE(rig_initialization)
{
  static constexpr IndexT rigId = 0;
  static constexpr std::size_t nbSubPoses = 5;

  SfMData sfmData;

  sfmData.intrinsics.emplace(0, std::make_shared<camera::Pinhole>(1000, 1000, 36.0, std::rand()%10000, std::rand()%10000));
  sfmData.getRigs().emplace(rigId, Rig(nbSubPoses));

  std::vector<View> rigViews;

  for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
  {
    rigViews.emplace_back("", subPoseId, 0, 0, 10, 10, rigId, subPoseId);
  }

  for(const View& view : rigViews)
  {
    sfmData.views.emplace(view.getViewId(), std::make_shared<View>(view));
  }

  const Mat3 r = Mat3::Random();
  const Vec3 c = Vec3::Random();
  const geometry::Pose3 firstPose(r, c);
  const IndexT firstPoseId = std::rand() % nbSubPoses;

  const Rig& rig = sfmData.getRig(rigViews.front());

  // rig uninitialized
  BOOST_CHECK(!rig.isInitialized());

  sfmData.setPose(rigViews.at(firstPoseId), CameraPose(firstPose));

  // setPose done, rig initialized
  BOOST_CHECK(rig.isInitialized());

  // Check rig sub-poses
  for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
  {
    const RigSubPose& subPose = rig.getSubPose(subPoseId);

    if(subPoseId == firstPoseId)
    {
      // first sub-pose should be initialized
      BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);
    }
    else
    {
      // other sub-poses are uninitialized
      BOOST_CHECK(subPose.status == ERigSubPoseStatus::UNINITIALIZED);
    }

    // all sub-poses should be at identity
    BOOST_CHECK(subPose.pose == geometry::Pose3());
  }

  // Check rig pose
  for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
  {
    const View& view = rigViews.at(subPoseId);
    BOOST_CHECK(sfmData.getPose(view).getTransform() == firstPose);
  }
}

BOOST_AUTO_TEST_CASE(rig_setPose)
{
  static constexpr IndexT rigId = 0;
  static constexpr std::size_t nbSubPoses = 5;
  static constexpr std::size_t nbPoses = 2;

  SfMData sfmData;

  sfmData.intrinsics.emplace(0, std::make_shared<camera::Pinhole>(1000, 1000, 36.0, std::rand()%10000, std::rand()%10000));
  sfmData.getRigs().emplace(rigId, Rig(nbSubPoses));

  std::vector<View> rigViews;

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      rigViews.emplace_back("", viewId, 0, poseId, 10, 10, rigId, subPoseId);
    }
  }

  for(const View& view : rigViews)
  {
    sfmData.views.emplace(view.getViewId(), std::make_shared<View>(view));
  }

  const Rig& rig = sfmData.getRig(rigViews.front());

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      const View& view = *(sfmData.views.at(viewId));
      const RigSubPose& subPose = rig.getSubPose(subPoseId);

      if(subPoseId == 0)
      {
        // first sub-pose, rig pose is unknown
        BOOST_CHECK(!sfmData.existsPose(view));

        if(poseId == 0)
        {
          // first rig pose, first sub-pose, sub-pose uninitialized
          BOOST_CHECK(subPose.status == ERigSubPoseStatus::UNINITIALIZED);
        }
        else
        {
          // not first rig pose, first sub-pose, sub-pose initialized
          BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);
        }

        const Mat3 r = Mat3::Random();
        const Vec3 c = Vec3::Random();
        const geometry::Pose3 firstPose = geometry::Pose3(r, c);

        sfmData.setPose(view, CameraPose(firstPose));

        // setPose done, sub-pose must be initialized
        BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);

        // setPose done, rig initialized
        BOOST_CHECK(sfmData.existsPose(view));
        BOOST_CHECK(sfmData.getPose(view).getTransform() == firstPose);
      }
      else
      {

        // rig pose should be initialized
        BOOST_CHECK(sfmData.existsPose(view));

        if(poseId == 0) //other poses are redundant
        {
          const Mat3 r = Mat3::Random();
          const Vec3 c = Vec3::Random();
          const geometry::Pose3 pose = geometry::Pose3(r, c);

          // first rig pose, sub-pose must be uninitialized
          BOOST_CHECK(subPose.status == ERigSubPoseStatus::UNINITIALIZED);

          sfmData.setPose(view, CameraPose(pose));

          // setPose done, sub-pose must be initialized
          BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);
        }
      }
    }
  }
}

BOOST_AUTO_TEST_CASE(rig_getPose)
{
  static constexpr IndexT rigId = 0;
  static constexpr std::size_t nbSubPoses = 5;
  static constexpr std::size_t nbPoses = 2;

  SfMData sfmData;

  sfmData.intrinsics.emplace(0, std::make_shared<camera::Pinhole>(1000, 1000, 36.0, std::rand()%10000, std::rand()%10000));
  sfmData.getRigs().emplace(rigId, Rig(nbSubPoses));

  std::vector<View> rigViews;

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      rigViews.emplace_back("", viewId, 0, poseId, 10, 10, rigId, subPoseId);
    }
  }

  for(const View& view : rigViews)
  {
    sfmData.views.emplace(view.getViewId(), std::make_shared<View>(view));
  }

  const Rig& rig = sfmData.getRig(rigViews.front());

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      const View& view = *(sfmData.views.at(viewId));
      const RigSubPose& subPose = rig.getSubPose(subPoseId);

      if(subPoseId == 0)
      {
        const Mat3 r = Mat3::Random();
        const Vec3 c = Vec3::Random();
        const geometry::Pose3 firstPose = geometry::Pose3(r, c);

        sfmData.setPose(view, CameraPose(firstPose));

        // setPose done, rig initialized
        if(poseId == 0)
        {
          // the rig pose is the first pose
          BOOST_CHECK(sfmData.getPose(view).getTransform() == firstPose);
        }
        else
        {
          // the rig pose is the sub-pose inverse multiply by the rig pose
          BOOST_CHECK(sfmData.getPose(view).getTransform() == (subPose.pose.inverse() * firstPose));
        }

      }
      else
      {
        const geometry::Pose3& rigPose = sfmData.getPose(view).getTransform();

        if(poseId == 0) //other poses are redundant
        {
          const Mat3 r = Mat3::Random();
          const Vec3 c = Vec3::Random();
          const geometry::Pose3 absolutePose = geometry::Pose3(r, c);

          sfmData.setPose(view, CameraPose(absolutePose));

          // the view sub-pose is the absolute pose multiply by the rig pose inverse
          BOOST_CHECK(subPose.pose == (absolutePose * rigPose.inverse()));
        }

        // the view absolute pose is the sub-pose multiply by the rig pose
        BOOST_CHECK(sfmData.getPose(view).getTransform() == (subPose.pose * sfmData.getAbsolutePose(view.getPoseId()).getTransform()));
      }
    }
  }
}
<commit_msg>[sfm] Fix `getPose` reference issue in `rig_test`<commit_after>// This file is part of the AliceVision project.
// Copyright (c) 2017 AliceVision contributors.
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file,
// You can obtain one at https://mozilla.org/MPL/2.0/.

#include "SfMData.hpp"

#include <memory>

#define BOOST_TEST_MODULE sfmRig
#include <boost/test/included/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>

using namespace aliceVision;
using namespace aliceVision::sfm;

BOOST_AUTO_TEST_CASE(rig_initialization)
{
  static constexpr IndexT rigId = 0;
  static constexpr std::size_t nbSubPoses = 5;

  SfMData sfmData;

  sfmData.intrinsics.emplace(0, std::make_shared<camera::Pinhole>(1000, 1000, 36.0, std::rand()%10000, std::rand()%10000));
  sfmData.getRigs().emplace(rigId, Rig(nbSubPoses));

  std::vector<View> rigViews;

  for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
  {
    rigViews.emplace_back("", subPoseId, 0, 0, 10, 10, rigId, subPoseId);
  }

  for(const View& view : rigViews)
  {
    sfmData.views.emplace(view.getViewId(), std::make_shared<View>(view));
  }

  const Mat3 r = Mat3::Random();
  const Vec3 c = Vec3::Random();
  const geometry::Pose3 firstPose(r, c);
  const IndexT firstPoseId = std::rand() % nbSubPoses;

  const Rig& rig = sfmData.getRig(rigViews.front());

  // rig uninitialized
  BOOST_CHECK(!rig.isInitialized());

  sfmData.setPose(rigViews.at(firstPoseId), CameraPose(firstPose));

  // setPose done, rig initialized
  BOOST_CHECK(rig.isInitialized());

  // Check rig sub-poses
  for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
  {
    const RigSubPose& subPose = rig.getSubPose(subPoseId);

    if(subPoseId == firstPoseId)
    {
      // first sub-pose should be initialized
      BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);
    }
    else
    {
      // other sub-poses are uninitialized
      BOOST_CHECK(subPose.status == ERigSubPoseStatus::UNINITIALIZED);
    }

    // all sub-poses should be at identity
    BOOST_CHECK(subPose.pose == geometry::Pose3());
  }

  // Check rig pose
  for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
  {
    const View& view = rigViews.at(subPoseId);
    BOOST_CHECK(sfmData.getPose(view).getTransform() == firstPose);
  }
}

BOOST_AUTO_TEST_CASE(rig_setPose)
{
  static constexpr IndexT rigId = 0;
  static constexpr std::size_t nbSubPoses = 5;
  static constexpr std::size_t nbPoses = 2;

  SfMData sfmData;

  sfmData.intrinsics.emplace(0, std::make_shared<camera::Pinhole>(1000, 1000, 36.0, std::rand()%10000, std::rand()%10000));
  sfmData.getRigs().emplace(rigId, Rig(nbSubPoses));

  std::vector<View> rigViews;

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      rigViews.emplace_back("", viewId, 0, poseId, 10, 10, rigId, subPoseId);
    }
  }

  for(const View& view : rigViews)
  {
    sfmData.views.emplace(view.getViewId(), std::make_shared<View>(view));
  }

  const Rig& rig = sfmData.getRig(rigViews.front());

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      const View& view = *(sfmData.views.at(viewId));
      const RigSubPose& subPose = rig.getSubPose(subPoseId);

      if(subPoseId == 0)
      {
        // first sub-pose, rig pose is unknown
        BOOST_CHECK(!sfmData.existsPose(view));

        if(poseId == 0)
        {
          // first rig pose, first sub-pose, sub-pose uninitialized
          BOOST_CHECK(subPose.status == ERigSubPoseStatus::UNINITIALIZED);
        }
        else
        {
          // not first rig pose, first sub-pose, sub-pose initialized
          BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);
        }

        const Mat3 r = Mat3::Random();
        const Vec3 c = Vec3::Random();
        const geometry::Pose3 firstPose = geometry::Pose3(r, c);

        sfmData.setPose(view, CameraPose(firstPose));

        // setPose done, sub-pose must be initialized
        BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);

        // setPose done, rig initialized
        BOOST_CHECK(sfmData.existsPose(view));
        BOOST_CHECK(sfmData.getPose(view).getTransform() == firstPose);
      }
      else
      {

        // rig pose should be initialized
        BOOST_CHECK(sfmData.existsPose(view));

        if(poseId == 0) //other poses are redundant
        {
          const Mat3 r = Mat3::Random();
          const Vec3 c = Vec3::Random();
          const geometry::Pose3 pose = geometry::Pose3(r, c);

          // first rig pose, sub-pose must be uninitialized
          BOOST_CHECK(subPose.status == ERigSubPoseStatus::UNINITIALIZED);

          sfmData.setPose(view, CameraPose(pose));

          // setPose done, sub-pose must be initialized
          BOOST_CHECK(subPose.status != ERigSubPoseStatus::UNINITIALIZED);
        }
      }
    }
  }
}

BOOST_AUTO_TEST_CASE(rig_getPose)
{
  static constexpr IndexT rigId = 0;
  static constexpr std::size_t nbSubPoses = 5;
  static constexpr std::size_t nbPoses = 2;

  SfMData sfmData;

  sfmData.intrinsics.emplace(0, std::make_shared<camera::Pinhole>(1000, 1000, 36.0, std::rand()%10000, std::rand()%10000));
  sfmData.getRigs().emplace(rigId, Rig(nbSubPoses));

  std::vector<View> rigViews;

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      rigViews.emplace_back("", viewId, 0, poseId, 10, 10, rigId, subPoseId);
    }
  }

  for(const View& view : rigViews)
  {
    sfmData.views.emplace(view.getViewId(), std::make_shared<View>(view));
  }

  const Rig& rig = sfmData.getRig(rigViews.front());

  for(std::size_t poseId = 0; poseId < nbPoses; ++poseId)
  {
    for(std::size_t subPoseId = 0; subPoseId < nbSubPoses; ++subPoseId)
    {
      const IndexT viewId = poseId * nbSubPoses + subPoseId;
      const View& view = *(sfmData.views.at(viewId));
      const RigSubPose& subPose = rig.getSubPose(subPoseId);

      if(subPoseId == 0)
      {
        const Mat3 r = Mat3::Random();
        const Vec3 c = Vec3::Random();
        const geometry::Pose3 firstPose = geometry::Pose3(r, c);

        sfmData.setPose(view, CameraPose(firstPose));

        // setPose done, rig initialized
        if(poseId == 0)
        {
          // the rig pose is the first pose
          BOOST_CHECK(sfmData.getPose(view).getTransform() == firstPose);
        }
        else
        {
          // the rig pose is the sub-pose inverse multiply by the rig pose
          BOOST_CHECK(sfmData.getPose(view).getTransform() == (subPose.pose.inverse() * firstPose));
        }

      }
      else
      {
        const geometry::Pose3 rigPose = sfmData.getPose(view).getTransform();

        if(poseId == 0) //other poses are redundant
        {
          const Mat3 r = Mat3::Random();
          const Vec3 c = Vec3::Random();
          const geometry::Pose3 absolutePose = geometry::Pose3(r, c);

          sfmData.setPose(view, CameraPose(absolutePose));

          // the view sub-pose is the absolute pose multiply by the rig pose inverse
          BOOST_CHECK(subPose.pose == (absolutePose * rigPose.inverse()));
        }

        // the view absolute pose is the sub-pose multiply by the rig pose
        BOOST_CHECK(sfmData.getPose(view).getTransform() == (subPose.pose * sfmData.getAbsolutePose(view.getPoseId()).getTransform()));
      }
    }
  }
}
<|endoftext|>


<commit_before>/// @file
/// @author uentity
/// @date 29.05.2019
/// @brief Tree filesystem archive implementation
/// @copyright
/// This Source Code Form is subject to the terms of the Mozilla Public License,
/// v. 2.0. If a copy of the MPL was not distributed with this file,
/// You can obtain one at https://mozilla.org/MPL/2.0/

#include "tree_fs_impl.h"

#include <bs/tree/errors.h>
#include <bs/tree/node.h>
#include <bs/kernel/radio.h>

#include <bs/serialize/tree_fs_input.h>
#include <bs/serialize/object_formatter.h>
#include <bs/serialize/base_types.h>
#include <bs/serialize/tree.h>
#include <bs/serialize/cafbind.h>

#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/string_generator.hpp>

#include <cereal/types/vector.hpp>
#include <fmt/format.h>
#include <fmt/ostream.h>

#include <caf/all.hpp>

NAMESPACE_BEGIN(blue_sky)
namespace fs = std::filesystem;
using NodeLoad = tree_fs_input::NodeLoad;

const auto uuid_from_str = boost::uuids::string_generator{};

///////////////////////////////////////////////////////////////////////////////
//  tree_fs_input::impl
//
struct tree_fs_input::impl : detail::file_heads_manager<false> {
	using heads_mgr_t = detail::file_heads_manager<false>;
	using fmanager_t = detail::objfrm_manager;
	using Error = tree::Error;

	impl(std::string root_fname, NodeLoad mode) :
		heads_mgr_t{std::move(root_fname)}, mode_(mode),
		manager_(kernel::radio::system().spawn<fmanager_t>(false))
	{}

	auto begin_node(tree_fs_input& ar) -> error {
		return error::eval_safe(
			// node reference (2nd arg) is ONLY used for template matching
			[&]{ return head().map( [&](auto* ar) { prologue(*ar, *(tree::node*)nullptr); }); },
			[&]{ return enter_root(); }
		);
	}

	auto end_node(tree_fs_input& ar, tree::node& N) -> error {
		if(cur_path_.empty()) return Error::NodeWasntStarted;

		// always return to parent dir after node is loaded
		auto finally = scope_guard{[=, p = cur_path_] {
			if(auto er = enter_dir(p, cur_path_)) throw er;
		}};

		std::string node_dir;
		std::vector<std::string> leafs_order;
		return error::eval_safe(
			// read node's metadata
			[&]{ return head().map( [&](auto* ar) {
				(*ar)(cereal::make_nvp("node_dir", node_dir));
				(*ar)(cereal::make_nvp("leafs_order", leafs_order));
				// we finished reading node
				epilogue(*ar, N);
			}); },
			// load leafs
			[&]{ return load_node(ar, N, std::move(node_dir), std::move(leafs_order)); }
		);
	}

	auto load_node(
		tree_fs_input& ar, tree::node& N, std::string node_dir, std::vector<std::string> leafs_order
	) -> error {
		using Options = fs::directory_options;

		// skip empty dirs in normal mode
		if(mode_ == NodeLoad::Normal && leafs_order.empty()) return perfect;
		// enter node's dir
		if(auto er = enter_dir(cur_path_ / node_dir, cur_path_)) return er;

		std::string united_err_msg;
		auto push_error = [&](auto er) {
			if(er.ok()) return;
			if(!united_err_msg.empty()) united_err_msg += " | ";
			united_err_msg += er.what();
		};

		// fill leafs by scanning directory and loading link files
		const auto normal_load = [&] { std::for_each(
			leafs_order.begin(), leafs_order.end(),
			[&](auto& f) {
				push_error(error::eval_safe(
					[&] { add_head(cur_path_ / std::move(f)); },
					[&] {
						auto finally = detail::scope_guard{[this]{ pop_head(); }};
						tree::link L;
						ar(L);
						N.insert(std::move(L));
					}
				));
			}
		); };

		const auto recover_load = [&] {
			// setup node iterator
			auto Niter = fs::directory_iterator{};
			if(auto er = error::eval_safe([&] {
				Niter = fs::directory_iterator(cur_path_, Options::skip_permission_denied);
			})) {
				push_error(std::move(er));
				return;
			}

			// read links
			for(auto& f : Niter) {
				// skip directories
				if(error::eval_safe([&]{ return !fs::is_directory(f); })) continue;

				// try load file as a link
				push_error(error::eval_safe(
					[&] { add_head(f); },
					[&] {
						auto finally = detail::scope_guard{[this]{ pop_head(); }};
						tree::link L;
						ar(L);
						N.insert(std::move(L));
					}
				));
			}

			// [NOTE] implementation with parallel STL
			//std::for_each(
			//	std::execution::par, begin(Niter), end(Niter),
			//	[&](auto& f) {
			//		// skip directories
			//		if(error::eval_safe([&]{ return !fs::is_directory(f); })) return;

			//		// try load file as a link
			//		push_error(error::eval_safe(
			//			[&] { add_head(f); },
			//			[&] {
			//				auto finally = detail::scope_guard{[this]{ pop_head(); }};

			//				tree::link L;
			//				ar(L);
			//				N.insert(std::move(L));
			//			}
			//		));
			//	}
			//);

			// restore links order
			using namespace tree;
			if(N.size() < 2 || leafs_order.size() < 2) return;

			// convert string uids to UUIDs
			auto wanted_order = lids_v(leafs_order.size());
			std::transform(
				leafs_order.cbegin(), leafs_order.cend(), wanted_order.begin(),
				[](const auto& s_uid) { return uuid_from_str(s_uid); }
			);

			// extract current order of link IDs
			auto res_order = N.keys(Key::AnyOrder);

			// sort according to passed `leafs_order`
			const auto lo_begin = wanted_order.begin(), lo_end = wanted_order.end();
			std::sort(res_order.begin(), res_order.end(), [&](auto i1, auto i2) {
				return std::find(lo_begin, lo_end, i1) < std::find(lo_begin, lo_end, i2);
			});
			// apply custom order
			N.rearrange(std::move(res_order));
		};

		// invoke laod
		if(mode_ == NodeLoad::Normal)
			normal_load();
		else
			recover_load();

		if(united_err_msg.empty()) return perfect;
		else return united_err_msg;
	}

	auto load_object(tree_fs_input& ar, objbase& obj) -> error {
	return error::eval_safe([&]() -> error {
		auto cur_head = head();
		if(!cur_head) return cur_head.error();
		// open node & close on exit
		prologue(*cur_head.value(), obj);
		auto finally = scope_guard{ [&]{ epilogue(*cur_head.value(), obj); } };

		// 1, 2. read object format & filename
		std::string obj_filename, obj_frm;
		ar(
			cereal::make_nvp("fmt", obj_frm),
			cereal::make_nvp("filename", obj_filename)
		);

		// obtain formatter
		auto F = get_formatter(obj.type_id(), obj_frm);
		if(!F) return { fmt::format("{} -> {}", obj.type_id(), obj_frm), Error::MissingFormatter };

		// 3. if object is node and formatter don't store leafs, then load 'em explicitly
		if(obj.is_node() && !F->stores_node)
			ar(cereal::make_nvp( "node", static_cast<tree::node&>(obj) ));
		else
			(**cur_head)(cereal::make_nvp( "object", obj ));

		// 4. read object data from specified file
		EVAL
			[&]{ return enter_root(); },
			[&]{ return objects_path_.empty() ?
				enter_dir(root_path_ / objects_dname_, objects_path_) : perfect;
			}
		RETURN_EVAL_ERR

		auto obj_path = objects_path_ / obj_filename;
		auto abs_obj_path = fs::path{};
		SCOPE_EVAL_SAFE
			abs_obj_path = fs::absolute(obj_path);
		RETURN_SCOPE_ERR

		caf::anon_send(
			manager_, caf::actor_cast<caf::actor>(manager_),
			const_cast<const objbase&>(obj).shared_from_this(), obj_frm, fs::absolute(obj_path).u8string()
		);
		// defer wait until save completes
		if(!has_wait_deferred_) {
			ar(cereal::defer(cereal::Functor{ [](auto& ar){ ar.wait_objects_loaded(); } }));
			has_wait_deferred_ = true;
		}
		return perfect;
	}); }

	auto wait_objects_loaded(timespan how_long) -> std::vector<error> {
		auto res = fmanager_t::wait_jobs_done(manager_, how_long);
		has_wait_deferred_ = false;
		return res;
	}

	NodeLoad mode_;
	// async loaders manager
	fmanager_t::actor_type manager_;
	bool has_wait_deferred_ = false;
};

///////////////////////////////////////////////////////////////////////////////
//  input archive
//
tree_fs_input::tree_fs_input(std::string root_fname, NodeLoad mode)
	: Base(this), pimpl_{ std::make_unique<impl>(std::move(root_fname), mode) }
{}

tree_fs_input::~tree_fs_input() = default;

auto tree_fs_input::head() -> result_or_err<cereal::JSONInputArchive*> {
	return pimpl_->head();
}

auto tree_fs_input::begin_node() -> error {
	return pimpl_->begin_node(*this);
}

auto tree_fs_input::end_node(const tree::node& N) -> error {
	return pimpl_->end_node(*this, const_cast<tree::node&>(N));
}

auto tree_fs_input::load_object(objbase& obj) -> error {
	return pimpl_->load_object(*this, obj);
}

auto tree_fs_input::wait_objects_loaded(timespan how_long) const -> std::vector<error> {
	return pimpl_->wait_objects_loaded(how_long);
}

auto tree_fs_input::loadBinaryValue(void* data, size_t size, const char* name) -> void {
	head().map([=](auto* jar) {
		jar->loadBinaryValue(data, size, name);
	});
}

///////////////////////////////////////////////////////////////////////////////
//  prologue, epilogue
//
auto prologue(tree_fs_input& ar, tree::node const&) -> void {
	ar.begin_node();
}

auto epilogue(tree_fs_input& ar, tree::node const& N) -> void {
	ar.end_node(N);
}

auto prologue(
	tree_fs_input& ar, cereal::memory_detail::LoadAndConstructLoadWrapper<tree_fs_input, tree::node> const&
) -> void {
	ar.begin_node();
}

auto epilogue(
	tree_fs_input& ar, cereal::memory_detail::LoadAndConstructLoadWrapper<tree_fs_input, tree::node> const& N
) -> void {
	ar.end_node( *const_cast<cereal::construct<tree::node>&>(N.construct).ptr() );
}

NAMESPACE_END(blue_sky)
<commit_msg>serial/tree_fs: emulate never-accessed node ref via uninitialized `std::optional`<commit_after>/// @file
/// @author uentity
/// @date 29.05.2019
/// @brief Tree filesystem archive implementation
/// @copyright
/// This Source Code Form is subject to the terms of the Mozilla Public License,
/// v. 2.0. If a copy of the MPL was not distributed with this file,
/// You can obtain one at https://mozilla.org/MPL/2.0/

#include "tree_fs_impl.h"

#include <bs/tree/errors.h>
#include <bs/tree/node.h>
#include <bs/kernel/radio.h>

#include <bs/serialize/tree_fs_input.h>
#include <bs/serialize/object_formatter.h>
#include <bs/serialize/base_types.h>
#include <bs/serialize/tree.h>
#include <bs/serialize/cafbind.h>

#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/string_generator.hpp>

#include <cereal/types/vector.hpp>
#include <fmt/format.h>
#include <fmt/ostream.h>

#include <caf/all.hpp>

#include <optional>

NAMESPACE_BEGIN(blue_sky)
namespace fs = std::filesystem;
using NodeLoad = tree_fs_input::NodeLoad;

const auto uuid_from_str = boost::uuids::string_generator{};

///////////////////////////////////////////////////////////////////////////////
//  tree_fs_input::impl
//
struct tree_fs_input::impl : detail::file_heads_manager<false> {
	using heads_mgr_t = detail::file_heads_manager<false>;
	using fmanager_t = detail::objfrm_manager;
	using Error = tree::Error;

	impl(std::string root_fname, NodeLoad mode) :
		heads_mgr_t{std::move(root_fname)}, mode_(mode),
		manager_(kernel::radio::system().spawn<fmanager_t>(false))
	{}

	auto begin_node(tree_fs_input& ar) -> error {
		static const auto sentinel = std::optional<tree::node>{};
		return error::eval_safe(
			// sentinel is ONLY used for template matching
			[&]{ return head().map( [&](auto* ar) { prologue(*ar, *sentinel); }); },
			[&]{ return enter_root(); }
		);
	}

	auto end_node(tree_fs_input& ar, tree::node& N) -> error {
		if(cur_path_.empty()) return Error::NodeWasntStarted;

		// always return to parent dir after node is loaded
		auto finally = scope_guard{[=, p = cur_path_] {
			if(auto er = enter_dir(p, cur_path_)) throw er;
		}};

		std::string node_dir;
		std::vector<std::string> leafs_order;
		return error::eval_safe(
			// read node's metadata
			[&]{ return head().map( [&](auto* ar) {
				(*ar)(cereal::make_nvp("node_dir", node_dir));
				(*ar)(cereal::make_nvp("leafs_order", leafs_order));
				// we finished reading node
				epilogue(*ar, N);
			}); },
			// load leafs
			[&]{ return load_node(ar, N, std::move(node_dir), std::move(leafs_order)); }
		);
	}

	auto load_node(
		tree_fs_input& ar, tree::node& N, std::string node_dir, std::vector<std::string> leafs_order
	) -> error {
		using Options = fs::directory_options;

		// skip empty dirs in normal mode
		if(mode_ == NodeLoad::Normal && leafs_order.empty()) return perfect;
		// enter node's dir
		if(auto er = enter_dir(cur_path_ / node_dir, cur_path_)) return er;

		std::string united_err_msg;
		auto push_error = [&](auto er) {
			if(er.ok()) return;
			if(!united_err_msg.empty()) united_err_msg += " | ";
			united_err_msg += er.what();
		};

		// fill leafs by scanning directory and loading link files
		const auto normal_load = [&] { std::for_each(
			leafs_order.begin(), leafs_order.end(),
			[&](auto& f) {
				push_error(error::eval_safe(
					[&] { add_head(cur_path_ / std::move(f)); },
					[&] {
						auto finally = detail::scope_guard{[this]{ pop_head(); }};
						tree::link L;
						ar(L);
						N.insert(std::move(L));
					}
				));
			}
		); };

		const auto recover_load = [&] {
			// setup node iterator
			auto Niter = fs::directory_iterator{};
			if(auto er = error::eval_safe([&] {
				Niter = fs::directory_iterator(cur_path_, Options::skip_permission_denied);
			})) {
				push_error(std::move(er));
				return;
			}

			// read links
			for(auto& f : Niter) {
				// skip directories
				if(error::eval_safe([&]{ return !fs::is_directory(f); })) continue;

				// try load file as a link
				push_error(error::eval_safe(
					[&] { add_head(f); },
					[&] {
						auto finally = detail::scope_guard{[this]{ pop_head(); }};
						tree::link L;
						ar(L);
						N.insert(std::move(L));
					}
				));
			}

			// [NOTE] implementation with parallel STL
			//std::for_each(
			//	std::execution::par, begin(Niter), end(Niter),
			//	[&](auto& f) {
			//		// skip directories
			//		if(error::eval_safe([&]{ return !fs::is_directory(f); })) return;

			//		// try load file as a link
			//		push_error(error::eval_safe(
			//			[&] { add_head(f); },
			//			[&] {
			//				auto finally = detail::scope_guard{[this]{ pop_head(); }};

			//				tree::link L;
			//				ar(L);
			//				N.insert(std::move(L));
			//			}
			//		));
			//	}
			//);

			// restore links order
			using namespace tree;
			if(N.size() < 2 || leafs_order.size() < 2) return;

			// convert string uids to UUIDs
			auto wanted_order = lids_v(leafs_order.size());
			std::transform(
				leafs_order.cbegin(), leafs_order.cend(), wanted_order.begin(),
				[](const auto& s_uid) { return uuid_from_str(s_uid); }
			);

			// extract current order of link IDs
			auto res_order = N.keys(Key::AnyOrder);

			// sort according to passed `leafs_order`
			const auto lo_begin = wanted_order.begin(), lo_end = wanted_order.end();
			std::sort(res_order.begin(), res_order.end(), [&](auto i1, auto i2) {
				return std::find(lo_begin, lo_end, i1) < std::find(lo_begin, lo_end, i2);
			});
			// apply custom order
			N.rearrange(std::move(res_order));
		};

		// invoke laod
		if(mode_ == NodeLoad::Normal)
			normal_load();
		else
			recover_load();

		if(united_err_msg.empty()) return perfect;
		else return united_err_msg;
	}

	auto load_object(tree_fs_input& ar, objbase& obj) -> error {
	return error::eval_safe([&]() -> error {
		auto cur_head = head();
		if(!cur_head) return cur_head.error();
		// open node & close on exit
		prologue(*cur_head.value(), obj);
		auto finally = scope_guard{ [&]{ epilogue(*cur_head.value(), obj); } };

		// 1, 2. read object format & filename
		std::string obj_filename, obj_frm;
		ar(
			cereal::make_nvp("fmt", obj_frm),
			cereal::make_nvp("filename", obj_filename)
		);

		// obtain formatter
		auto F = get_formatter(obj.type_id(), obj_frm);
		if(!F) return { fmt::format("{} -> {}", obj.type_id(), obj_frm), Error::MissingFormatter };

		// 3. if object is node and formatter don't store leafs, then load 'em explicitly
		if(obj.is_node() && !F->stores_node)
			ar(cereal::make_nvp( "node", static_cast<tree::node&>(obj) ));
		else
			(**cur_head)(cereal::make_nvp( "object", obj ));

		// 4. read object data from specified file
		EVAL
			[&]{ return enter_root(); },
			[&]{ return objects_path_.empty() ?
				enter_dir(root_path_ / objects_dname_, objects_path_) : perfect;
			}
		RETURN_EVAL_ERR

		auto obj_path = objects_path_ / obj_filename;
		auto abs_obj_path = fs::path{};
		SCOPE_EVAL_SAFE
			abs_obj_path = fs::absolute(obj_path);
		RETURN_SCOPE_ERR

		caf::anon_send(
			manager_, caf::actor_cast<caf::actor>(manager_),
			const_cast<const objbase&>(obj).shared_from_this(), obj_frm, fs::absolute(obj_path).u8string()
		);
		// defer wait until save completes
		if(!has_wait_deferred_) {
			ar(cereal::defer(cereal::Functor{ [](auto& ar){ ar.wait_objects_loaded(); } }));
			has_wait_deferred_ = true;
		}
		return perfect;
	}); }

	auto wait_objects_loaded(timespan how_long) -> std::vector<error> {
		auto res = fmanager_t::wait_jobs_done(manager_, how_long);
		has_wait_deferred_ = false;
		return res;
	}

	NodeLoad mode_;
	// async loaders manager
	fmanager_t::actor_type manager_;
	bool has_wait_deferred_ = false;
};

///////////////////////////////////////////////////////////////////////////////
//  input archive
//
tree_fs_input::tree_fs_input(std::string root_fname, NodeLoad mode)
	: Base(this), pimpl_{ std::make_unique<impl>(std::move(root_fname), mode) }
{}

tree_fs_input::~tree_fs_input() = default;

auto tree_fs_input::head() -> result_or_err<cereal::JSONInputArchive*> {
	return pimpl_->head();
}

auto tree_fs_input::begin_node() -> error {
	return pimpl_->begin_node(*this);
}

auto tree_fs_input::end_node(const tree::node& N) -> error {
	return pimpl_->end_node(*this, const_cast<tree::node&>(N));
}

auto tree_fs_input::load_object(objbase& obj) -> error {
	return pimpl_->load_object(*this, obj);
}

auto tree_fs_input::wait_objects_loaded(timespan how_long) const -> std::vector<error> {
	return pimpl_->wait_objects_loaded(how_long);
}

auto tree_fs_input::loadBinaryValue(void* data, size_t size, const char* name) -> void {
	head().map([=](auto* jar) {
		jar->loadBinaryValue(data, size, name);
	});
}

///////////////////////////////////////////////////////////////////////////////
//  prologue, epilogue
//
auto prologue(tree_fs_input& ar, tree::node const&) -> void {
	ar.begin_node();
}

auto epilogue(tree_fs_input& ar, tree::node const& N) -> void {
	ar.end_node(N);
}

auto prologue(
	tree_fs_input& ar, cereal::memory_detail::LoadAndConstructLoadWrapper<tree_fs_input, tree::node> const&
) -> void {
	ar.begin_node();
}

auto epilogue(
	tree_fs_input& ar, cereal::memory_detail::LoadAndConstructLoadWrapper<tree_fs_input, tree::node> const& N
) -> void {
	ar.end_node( *const_cast<cereal::construct<tree::node>&>(N.construct).ptr() );
}

NAMESPACE_END(blue_sky)
<|endoftext|>


<commit_before>// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#include <errno.h>

#include "bin/utils.h"

OSError::OSError() {
  set_code(errno);
  SetMessage(strerror(errno));
}
<commit_msg>Fix missing member initialization on Mac OS<commit_after>// Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

#include <errno.h>

#include "bin/utils.h"

OSError::OSError() : code_(0), message_(NULL) {
  set_code(errno);
  SetMessage(strerror(errno));
}
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 1680
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1095644 by johtaylo@johtaylo-JTBUILDER03-increment on 2014/11/11 03:00:13<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 1681
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 2400
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1396638 by johtaylo@johtaylo-jtincrementor-increment on 2017/04/11 03:00:05<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 2401
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2906
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1786576 by chui@ocl-promo-incrementor on 2019/05/23 03:00:03<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2907
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 2300
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1351938 by johtaylo@johtaylo-jtincrementor-increment on 2016/12/11 03:00:04<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 2301
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2517
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1469594 by johtaylo@johtaylo-jtincrementor2-increment on 2017/10/13 03:00:04<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2518
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2567
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1500642 by johtaylo@johtaylo-jtincrementor2-increment on 2018/01/06 03:00:04<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2568
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 2250
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1329729 by johtaylo@johtaylo-jtincrementor-increment on 2016/10/21 03:00:11<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 2251
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 3049
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<commit_msg>P4 to Git Change 2038561 by chui@ocl-promo-incrementor on 2019/11/29 03:00:14<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 3050
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2877
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1768921 by chui@ocl-promo-incrementor on 2019/04/12 03:00:40<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
#define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif  // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
#define AMD_PLATFORM_BUILD_NUMBER 2878
#endif  // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
#define AMD_PLATFORM_REVISION_NUMBER 0
#endif  // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
#define AMD_PLATFORM_RELEASE_INFO
#endif  // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING                                                                           \
  XSTR(AMD_PLATFORM_BUILD_NUMBER)                                                                  \
  "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
#define AMD_PLATFORM_INFO                                                                          \
  "AMD-APP" AMD_PLATFORM_RELEASE_INFO DEBUG_ONLY(                                                  \
      "." IF(IS_OPTIMIZED, "opt", "dbg")) " (" AMD_BUILD_STRING ")"
#endif  // ATI_PLATFORM_INFO

#endif  // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 1997
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1225522 by johtaylo@johtaylo-JTBUILDER03-increment on 2016/01/07 03:00:14<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 1998
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<|endoftext|>


<commit_before>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 1788
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<commit_msg>P4 to Git Change 1145697 by johtaylo@johtaylo-JTBUILDER03-increment on 2015/04/29 03:00:12<commit_after>//
// Copyright (c) 2010 Advanced Micro Devices, Inc. All rights reserved.
//

#ifndef VERSIONS_HPP_
#define VERSIONS_HPP_

#include "utils/macros.hpp"

#ifndef AMD_PLATFORM_NAME
# define AMD_PLATFORM_NAME "AMD Accelerated Parallel Processing"
#endif // AMD_PLATFORM_NAME

#ifndef AMD_PLATFORM_BUILD_NUMBER
# define AMD_PLATFORM_BUILD_NUMBER 1789
#endif // AMD_PLATFORM_BUILD_NUMBER

#ifndef AMD_PLATFORM_REVISION_NUMBER
# define AMD_PLATFORM_REVISION_NUMBER 0
#endif // AMD_PLATFORM_REVISION_NUMBER

#ifndef AMD_PLATFORM_RELEASE_INFO
# define AMD_PLATFORM_RELEASE_INFO
#endif // AMD_PLATFORM_RELEASE_INFO

#define AMD_BUILD_STRING XSTR(AMD_PLATFORM_BUILD_NUMBER) \
    "." XSTR(AMD_PLATFORM_REVISION_NUMBER)

#ifndef AMD_PLATFORM_INFO
# define AMD_PLATFORM_INFO "AMD-APP" AMD_PLATFORM_RELEASE_INFO \
    DEBUG_ONLY("." IF(IS_OPTIMIZED,"opt","dbg")) " (" AMD_BUILD_STRING ")"
#endif // ATI_PLATFORM_INFO

#endif // VERSIONS_HPP_
<|endoftext|>