Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F28204682
AwaitBase.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
AwaitBase.cpp
View Options
//===-- app/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 app/executionpolicies/AwaitBase.cpp
///
/// \author David Juhasz (david.juhasz@tuwien.ac.at)
///
/// \date 2019-2020
///
/// \brief Implementation for app/executionpolicies/AwaitBase.h.
///
//===----------------------------------------------------------------------===//
#include
"AwaitBase.h"
#include
"rosa/support/debug.hpp"
#include
<algorithm>
#include
<sstream>
namespace
rosa
{
namespace
app
{
AwaitBase
::
AwaitBase
(
const
std
::
set
<
size_t
>
&
S
,
CheckerType
&&
Checker
)
:
Set
(
S
),
Checker
(
Checker
)
{}
bool
AwaitBase
::
canHandle
(
const
AgentHandle
H
,
const
AppSystem
&
S
)
const
noexcept
{
return
isAppAgent
(
H
,
S
)
&&
canHandleNumberOfInputs
(
numberOfAppAgentInputs
(
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 app
}
// End namespace rosa
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Fri, Nov 20, 10:38 PM (16 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
409636
Default Alt Text
AwaitBase.cpp (1 KB)
Attached To
Mode
R20 SoC_Rosa_repo
Attached
Detach File
Event Timeline