obu-firmware builds against the vanetza-idf C-ITS library, which until now came from the colleague's microbu-esp32c5 tree beside the repository and was not tracked here, so a clone of this repository could not build the firmware it ships. The library alone is now part of obu-firmware, as obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from there by default; -DVANETZA_IDF_DIR still points the build elsewhere. The rest of the colleague's tree (their own VAM firmware, PKI tooling, station-link Python tools, the V2X2MAP bridge) stays out of this repository and gitignored; nothing is pushed to their repository. NOTES.md, docs/06, TODO.md and the pcap verifier's usage line point at the new location.
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#include "byte_buffer_convertible.hpp"
|
|
#include <algorithm>
|
|
#include <iterator>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace convertible
|
|
{
|
|
|
|
std::unique_ptr<byte_buffer> byte_buffer::duplicate() const
|
|
{
|
|
ByteBuffer duplicate;
|
|
this->convert(duplicate);
|
|
std::unique_ptr<byte_buffer> result {
|
|
new byte_buffer_impl<ByteBuffer>(std::move(duplicate))
|
|
};
|
|
return result;
|
|
}
|
|
|
|
byte_buffer_impl<std::string>::byte_buffer_impl(const std::string& str) : m_buffer(str) {}
|
|
byte_buffer_impl<std::string>::byte_buffer_impl(std::string&& str) : m_buffer(std::move(str)) {}
|
|
|
|
void byte_buffer_impl<std::string>::convert(ByteBuffer& buffer) const
|
|
{
|
|
buffer.clear();
|
|
std::copy(m_buffer.begin(), m_buffer.end(), std::back_inserter(buffer));
|
|
}
|
|
|
|
std::size_t byte_buffer_impl<std::string>::size() const
|
|
{
|
|
return m_buffer.size();
|
|
}
|
|
|
|
std::unique_ptr<byte_buffer> byte_buffer_impl<std::nullptr_t>::duplicate() const
|
|
{
|
|
return std::unique_ptr<byte_buffer> { new byte_buffer_impl<std::nullptr_t>() };
|
|
}
|
|
|
|
} // namespace convertible
|
|
|
|
ByteBufferConvertible::ByteBufferConvertible(const ByteBufferConvertible& other) :
|
|
m_wrapper(other.m_wrapper->duplicate())
|
|
{
|
|
}
|
|
|
|
ByteBufferConvertible& ByteBufferConvertible::operator=(const ByteBufferConvertible& other)
|
|
{
|
|
m_wrapper = other.m_wrapper->duplicate();
|
|
return *this;
|
|
}
|
|
|
|
} // namespace vanetza
|
|
|