-
Notifications
You must be signed in to change notification settings - Fork 29
Utility functions to transform enum to string and back #148
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
Conversation
std::string ConvertEnumToStr(info::device_type devTy); | ||
info::device_type ConvertStrToEnum(std::string devTyStr); |
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.
Names of functions is too common. Should be like device_type2string
or StrToDeviceType
or DeviceTypeFromString
.
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.
How about DDPL_StrToDeviceType
and DPPL_DeviceTypeFromStr
? I want to keep the naming convention consistent.
#include <sstream> | ||
using namespace cl::sycl; | ||
|
||
std::string ConvertEnumToStr(info::device_type devTy) |
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.
Please, add docstring.
Is there a code which uses conversion from string to enum? I do not see is removal in changes. |
|
Now it is not uses in project, but Dipto wrote that it is good design to create pairs of functions for conversion. |
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.
LGTM.
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.
Small modifications required.
std::string StrToDeviceType(info::device_type devTy); | ||
info::device_type DeviceTypeToStr(std::string devTyStr); |
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.
Use DPPL_
prefix or wrap it in namespace dppl
. In C we have global namespace for all functions. But this is C++ and internal functions so we could use namspaces.
This PR closes #102