Skip to content
Snippets Groups Projects
Commit f96794c7 authored by wierenga's avatar wierenga
Browse files

BugID: 778

Add function to check if all states match some given state.
parent aa3faeb1
No related branches found
No related tags found
No related merge requests found
...@@ -112,7 +112,9 @@ namespace LOFAR { ...@@ -112,7 +112,9 @@ namespace LOFAR {
void clear(int i = -1); void clear(int i = -1);
void reset(int i = -1); void reset(int i = -1);
State get(int i); State get(int i) const;
int getMatchCount(blitz::Range r, State matchstate) const;
void print(std::ostream& out) const; void print(std::ostream& out) const;
public: public:
......
...@@ -27,13 +27,19 @@ ...@@ -27,13 +27,19 @@
using namespace std; using namespace std;
using namespace LOFAR; using namespace LOFAR;
using namespace RTC; using namespace RTC;
using namespace blitz;
RegisterState::State RegisterState::get(int i) RegisterState::State RegisterState::get(int i) const
{ {
ASSERT(i >= 0 && i < m_state.extent(blitz::firstDim)); ASSERT(i >= 0 && i < m_state.extent(blitz::firstDim));
return m_state(i); return m_state(i);
} }
int RegisterState::getMatchCount(Range r, State matchstate) const
{
return sum(where(m_state(r) == matchstate, 1, 0));
}
void RegisterState::print(std::ostream& out) const void RegisterState::print(std::ostream& out) const
{ {
for (int i = 0; i < m_state.extent(blitz::firstDim); i++) { for (int i = 0; i < m_state.extent(blitz::firstDim); i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment