MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / subset

Function subset

dds/DCPS/XTypes/Utils.cpp:1714–1729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1712
1713 template <typename LiteralSeq>
1714 LiteralSeq subset(const LiteralSeq& in, const OPENDDS_SET(DDS::Int32)& toRemove)
1715 {
1716 // Modify the input LiteralSeq to have a subset of the original elements.
1717 // Elements that are removed result in enumerator names (the "detail" part) being
1718 // shifted up to earlier indexes, but the "common" part (integer value) doesn't change.
1719 LiteralSeq subset(in);
1720 for (DDS::UInt32 i = subset.length(); i > 0; --i) {
1721 if (toRemove.count(subset[i - 1].common.value)) {
1722 for (DDS::UInt32 j = i - 1; j < subset.length() - 1; ++j) {
1723 subset[j].detail = subset[j + 1].detail;
1724 }
1725 subset.length(subset.length() - 1);
1726 }
1727 }
1728 return subset;
1729 }
1730
1731 TypeObject remove_enumerators(const TypeObject& to_enum_type,
1732 const Sequence<DDS::Int32>& values)

Callers 1

remove_enumeratorsFunction · 0.85

Calls 2

lengthMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected