MIP_SDK
v3.0.0
MicroStrain Communications Library for embedded systems
|
Go to the documentation of this file.
27 operator bool()
const {
return result; }
46 bool isEmpty()
const {
return m_results.empty(); }
47 bool notEmpty()
const {
return !m_results.empty(); }
48 size_t count()
const {
return m_results.size(); }
50 bool allSuccessful()
const {
return std::all_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return r.result.isAck(); }); }
51 bool allFailed()
const {
return std::all_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return !r.result.isAck(); }); }
52 bool anySuccessful()
const {
return std::any_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return r.result.isAck(); }); }
53 bool anyFailed()
const {
return std::any_of (m_results.begin(), m_results.end(), [](
const Entry& r){ return !r.result.isAck(); }); }
54 bool noneSuccessful()
const {
return std::none_of(m_results.begin(), m_results.end(), [](
const Entry& r){ return r.result.isAck(); }); }
55 bool noneFailed()
const {
return std::none_of(m_results.begin(), m_results.end(), [](
const Entry& r){ return !r.result.isAck(); }); }
57 bool allMatch (
CmdResult result)
const {
return std::all_of (m_results.begin(), m_results.end(), [result](
const Entry& r){ return r.result == result; }); }
58 bool anyMatch (
CmdResult result)
const {
return std::any_of (m_results.begin(), m_results.end(), [result](
const Entry& r){ return r.result == result; }); }
59 bool noneMatch(
CmdResult result)
const {
return std::none_of(m_results.begin(), m_results.end(), [result](
const Entry& r){ return r.result == result; }); }
67 if (
count() == 1)
return m_results.front().result;
73 void clear() { m_results.clear(); }
79 template<
class MipType>
83 void extend(
const CompositeResult& other) { m_results.insert(m_results.end(), other.m_results.begin(), other.m_results.end()); }
114 auto begin() {
return m_results.begin(); }
115 auto end() {
return m_results.end(); }
117 auto begin()
const {
return m_results.begin(); }
118 auto end()
const {
return m_results.end(); }
121 std::vector<Entry> m_results;
125 template<
class Cmd,
class... Args>
bool allMatch(CmdResult result) const
Definition: composite_result.hpp:57
Entry & first()
Definition: composite_result.hpp:106
void extend(const CompositeResult &other)
Definition: composite_result.hpp:83
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:24
const Entry & first() const
Definition: composite_result.hpp:105
size_t count() const
Definition: composite_result.hpp:48
bool operator!() const
Definition: composite_result.hpp:62
CompositeResult & operator+=(bool result)
Definition: composite_result.hpp:86
const Entry & last() const
Definition: composite_result.hpp:108
mip_cmd_result
Represents the status of a MIP command.
Definition: mip_result.h:27
bool operator!() const
Definition: composite_result.hpp:28
Represents a list of zero or more actions and their results.
Definition: composite_result.hpp:19
Entry & last()
Definition: composite_result.hpp:109
void append(CmdResult result, CompositeDescriptor desc=0x0000)
Definition: composite_result.hpp:77
CmdResult runCommand(const Cmd &cmd, Timeout additionalTime=0)
Definition: mip_interface.hpp:205
CompositeResult(bool success)
Definition: composite_result.hpp:41
CompositeResult(CmdResult result)
Definition: composite_result.hpp:42
CompositeResult(CompositeDescriptor cmd, CmdResult result)
Definition: composite_result.hpp:43
CmdResult firstResult() const
Definition: composite_result.hpp:111
bool allSuccessful() const
Definition: composite_result.hpp:50
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:112
CompositeResult & operator+=(Entry result)
Definition: composite_result.hpp:88
bool anyFailed() const
Definition: composite_result.hpp:53
CompositeResult::Entry runCommandEx(Interface &device, const Cmd &cmd, Args &&... args)
Definition: composite_result.hpp:126
CompositeResult & operator+=(CmdResult result)
Definition: composite_result.hpp:87
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:46
auto end() const
Definition: composite_result.hpp:118
bool anyMatch(CmdResult result) const
Definition: composite_result.hpp:58
CompositeResult(const Entry &result)
Definition: composite_result.hpp:44
bool appendAndCheckThisCmd(bool result, uint32_t id)
Definition: composite_result.hpp:92
Represents the status of a MIP command.
Definition: mip_result.hpp:24
A combination of a MIP descriptor pair and u16 ID value.
Definition: descriptor_id.hpp:14
CompositeResult()
Definition: composite_result.hpp:40
void append(CmdResult result, uint16_t index=0)
Definition: composite_result.hpp:80
bool noneMatch(CmdResult result) const
Definition: composite_result.hpp:59
Definition: composite_result.hpp:22
auto begin() const
Definition: composite_result.hpp:117
CmdResult summary() const
Definition: composite_result.hpp:64
Entry(CmdResult r, DescriptorId d={})
Definition: composite_result.hpp:34
bool notEmpty() const
Definition: composite_result.hpp:47
DescriptorId descriptor
Command or action that was executed.
Definition: composite_result.hpp:25
bool noneSuccessful() const
Definition: composite_result.hpp:54
void append(Entry result)
Definition: composite_result.hpp:78
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:35
Entry(bool r, DescriptorId d={})
Definition: composite_result.hpp:33
bool allFailed() const
Definition: composite_result.hpp:51
auto end()
Definition: composite_result.hpp:115
bool noneFailed() const
Definition: composite_result.hpp:55
void clear()
Definition: composite_result.hpp:73
static constexpr C::mip_cmd_result STATUS_NONE
Command has been initialized but not queued yet.
Definition: mip_result.hpp:32
bool appendAndCheckThisCmd(Entry result)
Definition: composite_result.hpp:94
Convenience struct holding both descriptor set and field descriptor.
Definition: mip_descriptors.hpp:22
auto begin()
Definition: composite_result.hpp:114
Represents a connected MIP device.
Definition: mip_interface.hpp:55
bool appendAndCheckThisCmd(CmdResult result, CompositeDescriptor desc)
Definition: composite_result.hpp:93
bool operator==(mip::C::mip_cmd_result value) const
Definition: composite_result.hpp:30
bool anySuccessful() const
Definition: composite_result.hpp:52
bool operator!=(mip::C::mip_cmd_result value) const
Definition: composite_result.hpp:31