You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use IDL definitions such as module (= C++ namespace) in my main template of my custom template group.
The main template only takes ctx (context) and definitions arguments. The latter is/seems to be a list of all definitions in the parsed IDL file. main(ctx, definitions) ::= << Main Template >>
However the definitions list contains the module and prints the code which is inside the module(ctx, parent, module, definition_list) ::= << Print name: $module.name$ >>
template.
When looking at Definitions.java, Module.java or TreeNode.java you find some public functions.
In here for example there is public bool isIsModule() which should return true for every definition in definitions of type Module.
While $module.name$ (name property and getter inherited from TreeNode) within the module template of my group works and prints the correct name as in my IDL file
does not work, even though I called the isIsModule() function from here (omitting the first lowercase "is" as usual when calling other functions which work).
The code in module template is similar to the one used in DDSPubSubTypeHeader.stghere where a namespace is added to the datatype's TypeHeader including all other definitions....
Basically all I want to do is have conditional code in my main template based on the Module that was defined in the IDL file that is being parsed. And skip that code if no module definition was found in the IDL file...
For example a forward declaration in correct module namespace
namespace MyModule {
class Foo;
} // namespace MyModule
Haven't found the exact place where definitions are passed to the main template call/execution... so I'm not sure how to debug that.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I'm trying to use IDL definitions such as
module(= C++ namespace) in my main template of my custom template group.The main template only takes
ctx(context) anddefinitionsarguments. The latter is/seems to be a list of all definitions in the parsed IDL file.main(ctx, definitions) ::= << Main Template >>However the
definitionslist contains the module and prints the code which is inside themodule(ctx, parent, module, definition_list) ::= << Print name: $module.name$ >>template.
When looking at Definitions.java, Module.java or TreeNode.java you find some public functions.
In here for example there is
public bool isIsModule()which should returntruefor everydefinitionindefinitionsof typeModule.While
$module.name$(name property and getter inherited fromTreeNode) within themoduletemplate of my group works and prints the correct name as in my IDL file"Iterating" (I don't know if this can be even called like this in a template) the
defintionsthat are given tomain(ctx, definitions)likedoes not work, even though I called the
isIsModule()function from here (omitting the first lowercase "is" as usual when calling other functions which work).The code in
moduletemplate is similar to the one used inDDSPubSubTypeHeader.stghere where a namespace is added to the datatype'sTypeHeaderincluding all other definitions....Basically all I want to do is have conditional code in my main template based on the Module that was defined in the IDL file that is being parsed. And skip that code if no
moduledefinition was found in the IDL file...For example a forward declaration in correct module namespace
Haven't found the exact place where
definitionsare passed to the main template call/execution... so I'm not sure how to debug that.Any help and tips appreciated :)
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions