-
Notifications
You must be signed in to change notification settings - Fork 588
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
Problem with instantiating templates #478
Comments
Again, that works fine for me in isolation, this is what I get: @Name("Spinnaker::GenApi::IEnumerationT<Spinnaker::InterfaceTypeEnum>") @Opaque public class EInterfaceType extends Pointer {
/** Empty constructor. Calls {@code super((Pointer)null)}. */
public EInterfaceType() { super((Pointer)null); }
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public EInterfaceType(Pointer p) { super(p); }
} Please try to figure out a minimal example that fails! Thanks |
Here is little different, but a minimal example that may not generate a template, depending on instantiation order. The template class (simplified), in file #ifndef BASE_PTR_H
#define BASE_PTR_H
namespace MySpace
{
template <class T, class B = T> class MYAPI_API BasePtr
{
public:
BasePtr(void) throw();
};
}
#endif Complete preset: import org.bytedeco.javacpp.annotation.Platform;
import org.bytedeco.javacpp.annotation.Properties;
import org.bytedeco.javacpp.presets.javacpp;
import org.bytedeco.javacpp.tools.Info;
import org.bytedeco.javacpp.tools.InfoMap;
import org.bytedeco.javacpp.tools.InfoMapper;
@Properties(inherit = javacpp.class,
target = "org.bytedeco.javacpp_test.Preset_Test",
global = "org.bytedeco.javacpp_test.global.Preset_Test", value = {
@Platform(value = {"linux-x86_64", "windows"},
include = {
"BasePtr.h",
}),
@Platform(value = "windows",
includepath = "X:/javacpp_test/include")
})
public class Preset_Test implements InfoMapper {
public void map(InfoMap infoMap) {
infoMap
.put(new Info("MySpace::BasePtr<MySpace::Camera,MySpace::ICameraBase>")
.pointerTypes("BasePtr_T_Camera").define())
.put(new Info("MySpace::BasePtr<MySpace::LoggingEventData>")
.pointerTypes("BasePtr_T_LoggingEventData").define())
;
}
} With that preset the first template .put(new Info("MySpace::BasePtr<MySpace::LoggingEventData>")
.pointerTypes("BasePtr_T_LoggingEventData").define())
.put(new Info("MySpace::BasePtr<MySpace::Camera,MySpace::ICameraBase>")
.pointerTypes("BasePtr_T_Camera").define()) both templates |
Thanks! Fixed in commit a105765. |
Commit a105765 fixed one issue (#478 (comment)) |
The definitions of SPINNAKER_API_ABSTRACT and SPINNAKER_API are missing, so that's probably not going to work anyway. Do you still have issues when removing all traces of those? |
Removing SPINNAKER_API_ABSTRACT and SPINNAKER_API did not make difference to template generation (not generated). Corrected includes are attached |
I see, that's "normal" in the sense that the |
Is everything alright? Is it working now? |
Nothing changed here. I may not have a chance to get to it for a couple of days. I am also running in a couple of other unrelated issues in wrapping Spinnaker C++ API, like dealing with pointer wrapper classes (I will post separately when I have them in a simple format) |
Following preset code attempts to create an instance of a template:
Usage of the template in the generated Java code is correctly replaced with
EInterfaceType
. However, the there is no Java class generated to instantiate the template.Note that template is in the namespace
Spinnaker::GenApi
. The template parameter is in the namespaceSpinnaker
. There is a separate preset for each namespace.Simplified preset class for
GenApi
Simplified preset class for
Spinnaker
Simplified C++ definition of the
IEnumerationT
:Definition of
InterfaceTypeEnum
:Need to figure out some way to force the instantiation of that template.
The text was updated successfully, but these errors were encountered: