Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1494310
AwaitBase.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Size
1 KB
Referenced Files
None
Subscribers
None
AwaitBase.cpp
View Options
//===-- deluxe/executionpolicies/AwaitBase.cpp ------------------*- C++ -*-===//
//
// The RoSA Framework
//
// Distributed under the terms and conditions of the Boost Software License 1.0.
// See accompanying file LICENSE.
//
// If you did not receive a copy of the license file, see
// http://www.boost.org/LICENSE_1_0.txt.
//
//===----------------------------------------------------------------------===//
///
/// \file deluxe/executionpolicies/AwaitBase.cpp
///
/// \author David Juhasz (david.juhasz@tuwien.ac.at)
///
/// \date 2019
///
/// \brief Implementation for deluxe/executionpolicies/AwaitBase.h.
///
//===----------------------------------------------------------------------===//
#include
"AwaitBase.h"
#include
"rosa/support/debug.hpp"
#include
<algorithm>
#include
<sstream>
namespace
rosa
{
namespace
deluxe
{
AwaitBase
::
AwaitBase
(
const
std
::
set
<
size_t
>
&
S
,
CheckerType
&&
Checker
)
:
Set
(
S
),
Checker
(
Checker
)
{}
bool
AwaitBase
::
canHandle
(
const
AgentHandle
H
,
const
DeluxeSystem
&
S
)
const
noexcept
{
return
isDeluxeAgent
(
H
,
S
)
&&
canHandleNumberOfInputs
(
numberOfDeluxeAgentInputs
(
H
,
S
));
}
bool
AwaitBase
::
shouldProcess
(
const
std
::
vector
<
bool
>
&
InputChanged
)
noexcept
{
// Sanity check of usage.
ASSERT
(
canHandleNumberOfInputs
(
InputChanged
.
size
()));
return
Checker
(
Set
.
begin
(),
Set
.
end
(),
[
&
InputChanged
](
const
size_t
I
)
{
return
InputChanged
[
I
];
});
}
bool
AwaitBase
::
canHandleNumberOfInputs
(
const
size_t
NumberOfInputs
)
const
noexcept
{
const
auto
MaxElemIt
=
std
::
max_element
(
Set
.
begin
(),
Set
.
end
());
const
size_t
MaxElem
=
(
MaxElemIt
==
Set
.
end
())
?
0
:
*
MaxElemIt
;
return
MaxElem
<=
NumberOfInputs
;
}
std
::
string
AwaitBase
::
dumpS
(
void
)
const
noexcept
{
std
::
stringstream
SS
;
SS
<<
"["
;
for
(
const
auto
&
Value
:
Set
)
{
SS
<<
" "
<<
Value
;
}
SS
<<
" ]"
;
return
SS
.
str
();
}
}
// End namespace deluxe
}
// End namespace rosa
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Mar 1, 6:39 PM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
281283
Default Alt Text
AwaitBase.cpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline
Log In to Comment