-
Notifications
You must be signed in to change notification settings - Fork 75
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
Feature/generate ostream operators #472
Feature/generate ostream operators #472
Conversation
Hi @eboasson, could you please have a look at this PR? Would be great 😃 |
I actually started looking at it yesterday afternoon
You can probably answer some of these straightaway, but as I like to really check any code that goes in you can only save me so much time by providing them 😂 |
ah great @eboasson, here are my answers:
template <typename T>
size_t serdata_print(
const ddsi_sertype* tpcmn, const ddsi_serdata* dcmn, char* buf, size_t bufsize)
{
(void)tpcmn;
(void)dcmn;
//implementation to follow!!!
std::stringstream ss;
ss << static_cast<T*>(dcmn->loan->sample_ptr);
std::string sample_as_string = ss.str();
std::cout << "sample printed" << sample_as_string << std::endl;
if (bufsize > 0)
buf[0] = 0x0;
return 0;
}
|
Good that I asked: another look at the changes with your answers in mind sufficed 😀
I think especially for the examples there is no point in avoiding C++17. Just about everyone has access to a C++17 compiler these days, so it is only the older embedded and/or regulated and/or corporate stuff that might not be able to use it for production code. Supporting those cases is nice, but to put effort into examples ... nah.
I now see what you mean. I think that's a perfectly sensible expectation.
The trace files can include the content of samples, that's when it uses If you do With your suggested implementation, that should change. I do consider that separate from this PR: to me, this PR simply makes that possible, and there's no point in delaying the merging of it because it enables this small improvement. |
fixes #467
This pull requests generates
ostream
operators for each type.