-
Notifications
You must be signed in to change notification settings - Fork 13
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
Added methods for working with enums. #491
Conversation
#' myEnum <- enum(c(a = "b")) | ||
#' myEnum <- enumPut("c", "d", myEnum) | ||
#' myEnum <- enumPut(c("c", "d", "g"), c(12, 2, "a"), myEnum, overwrite = TRUE) | ||
enumPut <- function(keys, values, enum, overwrite = FALSE) { |
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.
Allows to extend existing enums
@PavelBal CAn you add a test file for this? The behavior is starting to justify it :) |
#' | ||
#' @return Enum without the removed entries | ||
#' @export | ||
enumRemove <- function(keys, enum) { |
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.
woudl it work with keys being ONE value and not an array?
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.
Yepp.
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.
So why do we always do sthg like this in ospsuite-r
quantities<- c(quantities) to ensure that we have a list
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.
I think... Because a quantity (or any R6-object) by themselves are kind of a list, and trying to iterate over an R6-object produces some mess... Having an object as enum-key would not work.
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.
oh yeah that's right. Thanks brother
@msevestre I added some tests. |
@PavelBal Build is failing |
oh yeah it's failing because I need to merge the other branch first. then if you can merge/rebase develop into your branch, we should be good to go |
@msevestre rebased |
looks good. I'll merge when the build is finished |
@PavelBal You need to create thew new documentation file (CTRL+SHIFT+D )to update the documentation. Otheriwse it won't be vibisle |
Oh, I thought it's re-created on build... Added! |
still one example that is being run...pain in the butt. You probably need to regenerate the documentation so that it is being updated. |
@msevestre Actually, I just realized... I expose all those methods, but we do not expose |
This was an issue because enum is used in TLF and other Lib and we were getting conflicts. That why we didn't export. Yes you can still use it from the outside? |
You cannot create a new one:
|
What we can try to do is Anyway, in the meantime, can you put the dontrunn flag or sthg like this in the example so that the build passes? |
No description provided.