Embedded Template Library
1.0
Toggle main menu visibility
Loading...
Searching...
No Matches
icache.h
Go to the documentation of this file.
1
2
3
/******************************************************************************
4
The MIT License(MIT)
5
6
Embedded Template Library.
7
https://github.com/ETLCPP/etl
8
http://www.etlcpp.com
9
10
Copyright(c) 2017 jwellbelove, rlindeman
11
12
Permission is hereby granted, free of charge, to any person obtaining a copy
13
of this software and associated documentation files(the "Software"), to deal
14
in the Software without restriction, including without limitation the rights
15
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16
copies of the Software, and to permit persons to whom the Software is
17
furnished to do so, subject to the following conditions :
18
19
The above copyright notice and this permission notice shall be included in all
20
copies or substantial portions of the Software.
21
22
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
SOFTWARE.
29
******************************************************************************/
30
31
//*****************************************************************************
32
#error This header is in development. Do not use.
33
//*****************************************************************************
34
35
#ifndef __ETL_ICACHE__
36
#define __ETL_ICACHE__
37
38
#include "
platform.h
"
39
#include "
delegate.h
"
40
41
#include <utility>
42
43
namespace
etl
44
{
48
template
<
typename
TKey,
typename
TValue>
49
class
icache
50
{
51
public
:
52
57
icache()
58
:
write_through
(
true
)
59
,
read_store
(
nullptr
)
60
,
write_store
(
nullptr
)
61
{
62
}
63
68
virtual
~icache()
69
{
70
if
(!
write_through
)
71
{
72
flush
();
73
}
74
}
75
79
void
set_read_function(
etl::delegate
<key_value_t&(
void
)> reader_)
80
{
81
read_store
= reader;
82
}
83
87
void
set_write_function(
etl::delegate
<
void
(
const
key_value_t&)> writer_)
88
{
89
write_store
= writer;
90
}
91
95
void
set_write_through(
bool
write_through_)
96
{
97
write_through
= write_through_;
98
}
99
100
virtual
const
T&
read
(
const
TKey& key)
const
= 0;
102
virtual
void
write
(
const
TKey& key,
103
const
TValue& value) = 0;
105
virtual
void
flush
() = 0;
107
108
protected
:
109
110
typedef
ETL_OR_STD::pair<TKey, TValue> key_value_t;
111
112
bool
write_through
;
115
116
etl::delegate
<key_value_t&(void)>*
read_store
;
118
etl::delegate
<void(
const
key_value_t&)>*
write_store
;
120
}
121
}
// namespace etl
122
123
#endif
etl::delegate
Declaration.
Definition
delegate_cpp03.h:191
etl::icache::write_through
bool write_through
Definition
icache.h:112
etl::icache::read_store
etl::delegate< key_value_t &(void)> * read_store
Definition
icache.h:116
etl::icache::flush
virtual void flush()=0
etl::icache::read
virtual const T & read(const TKey &key) const =0
etl::icache::write_store
etl::delegate< void(const key_value_t &)> * write_store
Definition
icache.h:118
etl::icache::write
virtual void write(const TKey &key, const TValue &value)=0
delegate.h
etl
Definition
absolute.h:40
platform.h
include
etl
experimental
icache.h
Generated on
for Embedded Template Library by
1.17.0