本文整理汇总了C++中stream类的典型用法代码示例。如果您正苦于以下问题:C++ stream类的具体用法?C++ stream怎么用?C++ stream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了stream类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ad_grid
void ad_grid(stream<axiRawValues> &inData, stream<axiValues> &outData){
#pragma HLS pipeline II=1 enable_flush
// Current Raw Values
axiRawValues currRawValues = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// Current Values
axiValues currValues = {0, 0, 0, 0, 0, 0};
// Read In Values
inData.read(currRawValues);
MATHTYPE det_det_prev = currRawValues.det_det_prev;
MATHTYPE det_ref_prev = currRawValues.det_ref_prev;
MATHTYPE det_curr_prev = currRawValues.det_curr_prev;
MATHTYPE ref_det_prev = currRawValues.ref_det_prev;
MATHTYPE ref_ref_prev = currRawValues.ref_ref_prev;
MATHTYPE ref_curr_prev = currRawValues.ref_curr_prev;
MATHTYPE det_det_curr = currRawValues.det_det_curr;
MATHTYPE det_ref_curr = currRawValues.det_ref_curr;
MATHTYPE det_curr_curr = currRawValues.det_curr_curr;
MATHTYPE ref_det_curr = currRawValues.ref_det_curr;
MATHTYPE ref_ref_curr = currRawValues.ref_ref_curr;
MATHTYPE ref_curr_curr = currRawValues.ref_curr_curr;
// Remove det_window[0], det_window[1]
MATHTYPE det_rm;
#pragma HLS RESOURCE variable=det_rm core=AddSubnS
det_rm = (det_det_prev - ref_det_prev);
// Remove ref_window[0], ref_window[1]
MATHTYPE ref_rm;
#pragma HLS RESOURCE variable=ref_rm core=AddSubnS
ref_rm = (det_ref_prev - ref_ref_prev);
// Remove currWord.data, det_window[DET_W-2]
MATHTYPE curr_rm;
#pragma HLS RESOURCE variable=curr_rm core=AddSubnS
curr_rm = (det_curr_prev - ref_curr_prev);
// Add det_window[0], det_window[1]
MATHTYPE det_add;
#pragma HLS RESOURCE variable=det_add core=AddSubnS
det_add = (det_det_curr - ref_det_curr);
// Add ref_window[0], ref_window[1]
MATHTYPE ref_add;
#pragma HLS RESOURCE variable=ref_add core=AddSubnS
ref_add = (det_ref_curr - ref_ref_curr);
// Add currWord.data, det_window[DET_W-2]
MATHTYPE curr_add;
#pragma HLS RESOURCE variable=curr_add core=AddSubnS
curr_add = (det_curr_curr - ref_curr_curr);
currValues.det_rm = det_rm;
currValues.ref_rm = ref_rm;
currValues.curr_rm = curr_rm;
currValues.det_add = det_add;
currValues.ref_add = ref_add;
currValues.curr_add = curr_add;
outData.write(currValues);
}
开发者ID:djmmoss,项目名称:SAD,代码行数:68,代码来源:ad_grid.cpp
示例2: read
void MappedRAM::read(const stream& memory) {
memory.read(data_, min(memory.size(), size_));
}
开发者ID:PGGB,项目名称:Higan,代码行数:3,代码来源:memory-inline.hpp
示例3: save
void Interface::save(unsigned id, const stream &stream) {
if(id == ID::RAM) {
stream.write(cartridge.ram_data(), cartridge.ram_size());
}
}
开发者ID:IcooN,项目名称:OpenEmu,代码行数:5,代码来源:interface.cpp
示例4: estimateTerritory
bool FuegoAssistant::estimateTerritory(int color)
{
string command;
string readLine;
//uct_param_globalsearch territory_statistics 1
if(!setTerritoryParam){
sendCommandWithEmptyResponse("uct_param_globalsearch territory_statistics 1", readLine);
setTerritoryParam = true;
}
//the problem here is that i need to generate a move from fuego first before i can see the territory stats
//first, disable tree search (node threhold normally = 3)
//uct_param_search expand_threshold 10000000
sendCommandWithEmptyResponse("uct_param_search expand_threshold 100000000", readLine);
//disable forced player move
sendCommandWithEmptyResponse("uct_param_player forced_opening_moves 0", readLine);
//if there are book moves, should probably disable book first
command = "book_moves";
writeToFuego << command<<endl;
writeToFuego.flush();
do{
getline(readFromFuego, readLine);
}while(readLine[0]!='=');
vector<string> l;
if(helper::split(readLine, l, ' ') >1)
{
//needs to remove book
sendCommandWithEmptyResponse("book_clear", readLine);
bookLoaded =false;
}
addStone_mutex.lock();
//generate a fake move from fuego
sendCommandWithEmptyResponse(string("genmove ")+ helper::convert_int_color(color), readLine);
//undo the move
sendCommandWithEmptyResponse("undo", readLine);
addStone_mutex.unlock();
//get territory stats
if(!sendCommandWithEmptyResponse("uct_stat_territory", readLine)){
//this problem should be fixed
fprintf(stderr, "[FuegoAssistant]something is wrong probably cuz fuego uses forced opening moves\n");
for(int i=0; i<19*19; i++){
estimateScore[i] = 0;
}
return false;
}
//save the result
for(int i=18; i>=0; i--){
getline(readFromFuego, readLine);
//cout<<"return: "<<endl<<readLine<<endl<<"END"<<endl;
//cout <<"is this okay?"<<endl;
helper::split(readLine, l, ' ');
int j=0;
for(int z=0; z<l.size(); z++)
{
if(l[z][0] != ' '){
estimateScore[i*19+j] = ::atof(l[z].c_str());
j++;
}
}
}
return true;
}
开发者ID:spchuang,项目名称:AugmentedRealityGo,代码行数:73,代码来源:FuegoAssistant.cpp
注:本文中的stream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论