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/stream.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
|
|
|
{
|
|
|
|
|
|
|
|
kernel_generation_stream::kgenstream::kgenstream(std::ostringstream& oss,unsigned int const & tab_count) :
|
|
|
|
oss_(oss), tab_count_(tab_count)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
int kernel_generation_stream::kgenstream::sync()
|
|
|
|
{
|
|
|
|
for (unsigned int i=0; i<tab_count_;++i)
|
|
|
|
oss_ << " ";
|
|
|
|
oss_ << str();
|
|
|
|
str("");
|
|
|
|
return !oss_;
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel_generation_stream::kgenstream:: ~kgenstream()
|
|
|
|
{ pubsync(); }
|
|
|
|
|
|
|
|
kernel_generation_stream::kernel_generation_stream() : std::ostream(new kgenstream(oss,tab_count_)), tab_count_(0)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
kernel_generation_stream::~kernel_generation_stream()
|
|
|
|
{ delete rdbuf(); }
|
|
|
|
|
|
|
|
std::string kernel_generation_stream::str()
|
|
|
|
{ return oss.str(); }
|
|
|
|
|
|
|
|
void kernel_generation_stream::inc_tab()
|
|
|
|
{ ++tab_count_; }
|
|
|
|
|
|
|
|
void kernel_generation_stream::dec_tab()
|
|
|
|
{ --tab_count_; }
|
|
|
|
|
|
|
|
}
|
|
|
|
|