MIP_SDK
latest-2-g34f3e39
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
25 operator bool()
const {
return result; }
45 bool isEmpty()
const {
return m_results.empty(); }
46 bool notEmpty()
const {
return !m_results.empty(); }
47 size_t count()
const {
return m_results.size(); }
49 bool allSuccessful()
const {
return std::all_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return r.result.isAck(); }); }
50 bool allFailed()
const {
return std::all_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return !r.result.isAck(); }); }
51 bool anySuccessful()
const {
return std::any_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return r.result.isAck(); }); }
52 bool anyFailed()
const {
return std::any_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return !r.result.isAck(); }); }
53 bool noneSuccessful()
const {
return std::none_of(m_results.begin(), m_results.end(), [](
const Entry& r){ return r.result.isAck(); }); }
54 bool noneFailed()
const {
return std::none_of(m_results.begin(), m_results.end(), [](
const Entry& r){ return !r.result.isAck(); }); }
56 bool allMatch (
CmdResult result)
const {
return std::all_of (m_results.begin(), m_results.end(), [result](
const Entry& r){ return r.result == result; }); }
57 bool anyMatch (
CmdResult result)
const {
return std::any_of (m_results.begin(), m_results.end(), [result](
const Entry& r){ return r.result == result; }); }
58 bool noneMatch(
CmdResult result)
const {
return std::none_of(m_results.begin(), m_results.end(), [result](
const Entry& r){ return r.result == result; }); }
66 if (
count() == 1)
return m_results.front().result;
72 void clear() { m_results.clear(); }
78 template<
class MipType>
82 void extend(
const CompositeResult& other) { m_results.insert(m_results.end(), other.m_results.begin(), other.m_results.end()); }
113 std::vector<Entry>::iterator
begin() {
return m_results.begin(); }
114 std::vector<Entry>::iterator
end() {
return m_results.end(); }
116 std::vector<Entry>::const_iterator
begin()
const {
return m_results.begin(); }
117 std::vector<Entry>::const_iterator
end()
const {
return m_results.end(); }
120 std::vector<Entry> m_results;
123 template<
class Cmd,
class... Args>
bool allMatch(CmdResult result) const
Definition: composite_result.hpp:56
Entry & first()
Definition: composite_result.hpp:105
void extend(const CompositeResult &other)
Definition: composite_result.hpp:82
A collection of C++ classes and functions covering the full mip api.
Definition: commands_3dm.c:11
CmdResult result
Result of action.
Definition: composite_result.hpp:22
const Entry & first() const
Definition: composite_result.hpp:104
size_t count() const
Definition: composite_result.hpp:47
bool operator!() const
Definition: composite_result.hpp:61
CompositeResult & operator+=(bool result)
Definition: composite_result.hpp:85
std::vector< Entry >::const_iterator begin() const
Definition: composite_result.hpp:116
const Entry & last() const
Definition: composite_result.hpp:107
mip_cmd_result
Represents the status of a MIP command.
Definition: mip_result.h:27
bool operator!() const
Definition: composite_result.hpp:26
Represents a list of zero or more actions and their results.
Definition: composite_result.hpp:17
Entry & last()
Definition: composite_result.hpp:108
void append(CmdResult result, CompositeDescriptor desc=0x0000)
Definition: composite_result.hpp:76
CmdResult runCommand(const Cmd &cmd, Timeout additionalTime=0)
Definition: mip_interface.hpp:202
CompositeResult(bool success)
Definition: composite_result.hpp:40
CompositeResult(CmdResult result)
Definition: composite_result.hpp:41
CompositeResult()=default
CompositeResult(CompositeDescriptor cmd, CmdResult result)
Definition: composite_result.hpp:42
CmdResult firstResult() const
Definition: composite_result.hpp:110
bool allSuccessful() const
Definition: composite_result.hpp:49
static constexpr C::mip_cmd_result STATUS_ERROR
Command could not be executed (error sending/receiving)
Definition: mip_result.hpp:27
CmdResult lastResult() const
Definition: composite_result.hpp:111
CompositeResult & operator+=(Entry result)
Definition: composite_result.hpp:87
bool anyFailed() const
Definition: composite_result.hpp:52
std::vector< Entry >::const_iterator end() const
Definition: composite_result.hpp:117
CompositeResult::Entry runCommandEx(Interface &device, const Cmd &cmd, Args &&... args)
Definition: composite_result.hpp:124
CompositeResult & operator+=(CmdResult result)
Definition: composite_result.hpp:86
static constexpr C::mip_cmd_result STATUS_TIMEDOUT
Reply was not received before timeout expired.
Definition: mip_result.hpp:29
@ DESCRIPTOR_SET
Definition: commands_3dm.hpp:31
bool isEmpty() const
Definition: composite_result.hpp:45
bool anyMatch(CmdResult result) const
Definition: composite_result.hpp:57
CompositeResult(const Entry &result)
Definition: composite_result.hpp:43
bool appendAndCheckThisCmd(bool result, uint32_t id)
Definition: composite_result.hpp:91
Represents the status of a MIP command.
Definition: mip_result.hpp:24
std::vector< Entry >::iterator begin()
Definition: composite_result.hpp:113
A combination of a MIP descriptor pair and u16 ID value.
Definition: descriptor_id.hpp:14
void append(CmdResult result, uint16_t index=0)
Definition: composite_result.hpp:79
bool noneMatch(CmdResult result) const
Definition: composite_result.hpp:58
Definition: composite_result.hpp:20
CmdResult summary() const
Definition: composite_result.hpp:63
Entry(CmdResult r, DescriptorId d={})
Definition: composite_result.hpp:33
bool notEmpty() const
Definition: composite_result.hpp:46
DescriptorId descriptor
Command or action that was executed.
Definition: composite_result.hpp:23
bool noneSuccessful() const
Definition: composite_result.hpp:53
void append(Entry result)
Definition: composite_result.hpp:77
static constexpr C::mip_cmd_result ACK_OK
Command completed successfully.
Definition: mip_result.hpp:34
Entry(C::mip_cmd_result r, DescriptorId d={})
Definition: composite_result.hpp:34
Entry(bool r, DescriptorId d={})
Definition: composite_result.hpp:32
bool allFailed() const
Definition: composite_result.hpp:50
bool noneFailed() const
Definition: composite_result.hpp:54
void clear()
Definition: composite_result.hpp:72
static constexpr C::mip_cmd_result STATUS_NONE
Command has been initialized but not queued yet.
Definition: mip_result.hpp:32
std::vector< Entry >::iterator end()
Definition: composite_result.hpp:114
bool appendAndCheckThisCmd(Entry result)
Definition: composite_result.hpp:93
Convenience struct holding both descriptor set and field descriptor.
Definition: mip_descriptors.hpp:21
Represents a connected MIP device.
Definition: mip_interface.hpp:50
bool appendAndCheckThisCmd(CmdResult result, CompositeDescriptor desc)
Definition: composite_result.hpp:92
bool operator==(mip::C::mip_cmd_result value) const
Definition: composite_result.hpp:29
bool anySuccessful() const
Definition: composite_result.hpp:51
bool operator!=(mip::C::mip_cmd_result value) const
Definition: composite_result.hpp:30