helper class OneRemoteConfigProvider
This commit is contained in:
parent
b73754dfd6
commit
34dd478848
@ -131,3 +131,7 @@ bool cfdp::VarLenField::operator<(const cfdp::VarLenField &other) const {
|
|||||||
bool cfdp::VarLenField::operator==(const cfdp::VarLenField &other) const {
|
bool cfdp::VarLenField::operator==(const cfdp::VarLenField &other) const {
|
||||||
return getWidth() == other.getWidth() and getValue() == other.getValue();
|
return getWidth() == other.getWidth() and getValue() == other.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cfdp::VarLenField::operator!=(const cfdp::VarLenField &other) const {
|
||||||
|
return not(*this == other);
|
||||||
|
}
|
||||||
|
@ -27,6 +27,7 @@ class VarLenField : public SerializeIF {
|
|||||||
VarLenField(cfdp::WidthInBytes width, size_t value);
|
VarLenField(cfdp::WidthInBytes width, size_t value);
|
||||||
|
|
||||||
bool operator==(const VarLenField &other) const;
|
bool operator==(const VarLenField &other) const;
|
||||||
|
bool operator!=(const VarLenField &other) const;
|
||||||
bool operator<(const VarLenField &other) const;
|
bool operator<(const VarLenField &other) const;
|
||||||
|
|
||||||
ReturnValue_t setValue(cfdp::WidthInBytes, size_t value);
|
ReturnValue_t setValue(cfdp::WidthInBytes, size_t value);
|
||||||
|
@ -11,6 +11,25 @@ class RemoteConfigTableIF {
|
|||||||
virtual bool getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) = 0;
|
virtual bool getRemoteCfg(const cfdp::EntityId& remoteId, cfdp::RemoteEntityCfg** cfg) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class for the common case that there is exactly one remote entity
|
||||||
|
*/
|
||||||
|
class OneRemoteConfigProvider : public RemoteConfigTableIF {
|
||||||
|
public:
|
||||||
|
explicit OneRemoteConfigProvider(RemoteEntityCfg cfg) : cfg(std::move(cfg)) {}
|
||||||
|
|
||||||
|
bool getRemoteCfg(const EntityId& remoteId, cfdp::RemoteEntityCfg** cfg_) override {
|
||||||
|
if (remoteId != cfg.remoteId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*cfg_ = &cfg;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
RemoteEntityCfg cfg;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
|
||||||
#endif // FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
#endif // FSFW_CFDP_HANDLER_REMOTECONFIGTABLEIF_H
|
||||||
|
Loading…
Reference in New Issue
Block a user