I am developing a custom ProcessFlow activity (using the module SDK) which essentially incorporates a bunch of existing activities into one block - currently it's only inheriting from the Delay class. Among other things, something I would like to do is create a token from within this object. I want to also handle the case where the user needs the labels copied to the new token immediately after it is created. These are simplified versions of some attempts:
Next activity starts before label can be assigned:
Token* newToken = Token::create(origToken->instance()->ownerNode(), nextActivity, true); createcopy(origToken->labels, newToken->labels, 1, 1, 0, 1);
Next activity never starts, and releasing the token skips the activity. I don't want users to have to worry about this caveat (e.g., having to create a dummy block):
Token* newToken = Token::create(origToken->instance()->ownerNode(), nextActivity, false); createcopy(origToken->labels, newToken->labels, 1, 1, 0, 1); releasetoken(newToken->holder, 0);
Also tried this but it errors out:
Token* newToken = Token::create(origToken->instance()->ownerNode(), nextActivity, false); createcopy(origToken->labels, newToken->labels, 1, 1, 0, 1); ((Activity*)nextActivity)->start(newToken->instance(), *newToken);
I also looked into using CreateTokens::createTokens, (I don't know exactly how that works but I can do some trial and error), but that function is private and I couldn't seem to figure out how friend classes work. Ideally I would be able to just implement my own simpler version of what this method essentially does.
Thoughts? Thanks in advance.