What would be great ultimately is to have libcinder as a library module for Vuo (With all the right type converters between libcinder and Vuo’s types and a system for sharing Context data between the two), this will make it really easy for people to write Vuo nodes with libcinder and also paves the path for a node-based libcinder.
Cool. I guess libc++ would be less of an issue there, since the Cinder library module could avoid having STL types in its interface.
I wanted to ask if it’s possible to make port types for Vuo with C++ classes
Yes. In fact, the VuoList port types do that.
There’s a trick to it, because the port type has to be exported as a C (not C++) symbol. I’ll give VuoList_VuoInteger as an example. This port type is actually a std::vector<VuoInteger> *
. But it’s typedef’ed to something C-friendly in the header file.
In VuoList_VuoInteger.cc, we cast between VuoList_VuoInteger and std::vector<VuoInteger> *
. For example:
VuoList_VuoInteger VuoListCreate_VuoInteger(void)
{
std::vector<VuoInteger> * l = new std::vector<VuoInteger>;
...
return reinterpret_cast<VuoList_VuoInteger>(l);
}
VuoInteger VuoListGetValue_VuoInteger(const VuoList_VuoInteger list, const unsigned long index)
{
std::vector<VuoInteger> * l = (std::vector<VuoInteger> *)list;
...
}
In VuoList_VuoInteger.h, we typedef to something C-friendly. We used to do:
typedef void * VuoList_VuoInteger;
But then we realized that this messed up type checking (e.g. the compiler wouldn’t catch when we accidentally passed VuoList_VuoReal to a function that expected a VuoList_VuoInteger), so now we do this more complicated thingy:
typedef const struct VuoList_VuoInteger_struct { void *l; } * VuoList_VuoInteger;
If you want to see the whole files, you can download the source code. VuoList.h and VuoList.cc are in type/list. If you go into that directory and run ./generateVariants.sh VuoInteger:0
, it generates VuoList_VuoInteger.hh and VuoList_VuoInteger.cc.
Has the SDK changed much recently? I could only get version 1.0.1, I hope that’s fine.
See the SDK section in the 1.1.0 release notes. If you’re concerned about nodes/modules built with the 1.0.1 SDK being compatible with Vuo 1.1.0 and haven’t bought the upgrade, you could try them in with the free trial version.