-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add xrt::elf raw elf data constructor #7963
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
#ifdef __cplusplus | ||
# include <string> | ||
# include <vector> | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
|
@@ -32,7 +33,17 @@ class elf : public detail::pimpl<elf_impl> | |
public: | ||
XRT_API_EXPORT | ||
elf(const std::string& fnm); | ||
|
||
|
||
/** | ||
* elf() - Constructor from raw ELF data | ||
* | ||
* @param data | ||
* Raw data of elf | ||
* | ||
*/ | ||
XRT_API_EXPORT | ||
elf(const std::vector<char>& data); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A constructor from std::vector isn't great IMO. What if data is not held in a vector? A std::span would be better, but that's c++20. I would opt for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stsoe |
||
|
||
XRT_API_EXPORT | ||
xrt::uuid | ||
get_cfg_uuid() const; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are copying the vector here. Can we write a simple adapter for std::vector to make it look like std::istream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone did this:
https://stackoverflow.com/questions/16875321/stdistringstream-from-stdstring-without-copying
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed