2015-12-19 21:35:35 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015, PHILIPPE TILLET. All rights reserved.
|
|
|
|
*
|
|
|
|
* This file is part of ISAAC.
|
|
|
|
*
|
|
|
|
* ISAAC is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301 USA
|
|
|
|
*/
|
2015-08-04 20:56:05 -07:00
|
|
|
#include "isaac/kernels/binder.h"
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
namespace isaac
|
2015-01-12 13:20:53 -05:00
|
|
|
{
|
|
|
|
|
2015-09-30 15:31:41 -04:00
|
|
|
symbolic_binder::~symbolic_binder()
|
|
|
|
{
|
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-04-29 15:50:57 -04:00
|
|
|
symbolic_binder::symbolic_binder() : current_arg_(0)
|
2015-09-30 15:31:41 -04:00
|
|
|
{
|
|
|
|
}
|
2015-04-29 15:50:57 -04:00
|
|
|
|
|
|
|
unsigned int symbolic_binder::get()
|
2015-09-30 15:31:41 -04:00
|
|
|
{
|
|
|
|
return current_arg_++;
|
|
|
|
}
|
2015-04-29 15:50:57 -04:00
|
|
|
|
2015-09-30 15:31:41 -04:00
|
|
|
//Sequential
|
|
|
|
bind_sequential::bind_sequential()
|
|
|
|
{
|
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-11-19 12:37:18 -05:00
|
|
|
bool bind_sequential::bind(array_base const * a, bool)
|
2015-09-30 15:31:41 -04:00
|
|
|
{
|
2015-11-19 12:37:18 -05:00
|
|
|
return memory.insert(std::make_pair(a, current_arg_)).second;
|
2015-09-30 15:31:41 -04:00
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-11-19 12:37:18 -05:00
|
|
|
unsigned int bind_sequential::get(array_base const * a, bool is_assigned)
|
2015-09-30 15:31:41 -04:00
|
|
|
{
|
2015-11-19 12:37:18 -05:00
|
|
|
return bind(a, is_assigned)?current_arg_++:memory.at(a);
|
2015-09-30 15:31:41 -04:00
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-09-30 15:31:41 -04:00
|
|
|
//Independent
|
|
|
|
bind_independent::bind_independent()
|
|
|
|
{
|
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-11-19 12:37:18 -05:00
|
|
|
bool bind_independent::bind(array_base const * a, bool is_assigned)
|
2015-09-30 15:31:41 -04:00
|
|
|
{
|
2015-11-19 12:37:18 -05:00
|
|
|
return is_assigned?true:memory.insert(std::make_pair(a, current_arg_)).second;
|
2015-09-30 15:31:41 -04:00
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
2015-11-19 12:37:18 -05:00
|
|
|
unsigned int bind_independent::get(array_base const * a, bool is_assigned)
|
2015-09-30 15:31:41 -04:00
|
|
|
{
|
2015-11-19 12:37:18 -05:00
|
|
|
return bind(a, is_assigned)?current_arg_++:memory.at(a);
|
2015-09-30 15:31:41 -04:00
|
|
|
}
|
2015-01-12 13:20:53 -05:00
|
|
|
|
|
|
|
}
|