-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblocks_read.h
43 lines (37 loc) · 1.27 KB
/
blocks_read.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// (C) Copyright 2009-2011 Vit Kasal
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#pragma once
#include "commands_definitions.h"
#include <set>
#include <map>
namespace si
{
typedef std::set<unsigned> needed_blocks_container;
template<typename block_type_tt> struct blocks_read: public std::map<unsigned, block_type_tt>
{
typedef std::map<unsigned, block_type_tt> base_container;
typedef typename base_container::value_type base_value_type;
typedef boost::shared_ptr<blocks_read> pointer;
typedef block_type_tt element_type;
unsigned card_id;
unsigned card_serie;
needed_blocks_container needed_blocks;
template<typename block_holder_tt> void block_read(block_holder_tt &block)
{
needed_blocks_container::iterator it = needed_blocks.find(block->template get<common::bn>().value);
if(needed_blocks.end() == it)
{
return;
}
needed_blocks.erase(it);
base_value_type insertion_value(block->template get<common::bn>().value, block->template get<common::read_out_data>());
base_container::insert(insertion_value);
}
bool ready()
{
return needed_blocks.empty();
}
};
}//namespace si