[vtkusers] vtkClientServerInterpreter initialization

Henry Lehmann henry.lehmann at informatik.tu-freiberg.de
Fri Apr 26 02:54:15 EDT 2013


Hello,

i setup a program using vtkXMLCollectionReader/vtkFileSeriesReader. The 
source looks like following (c++11):

int main(int argc, char *args[])
{
...
     // manually registering required callbacks, how to do it automatically?
     interp = 
vtkClientServerInterpreterInitializer::GetInitializer()->GetGlobalInterpreter();
     interp->AddNewInstanceFunction("vtkXMLStructuredGridReader", []() 
-> vtkObjectBase* { return vtkXMLStructuredGridReader::New(); });
     interp->AddNewInstanceFunction("vtkXMLStructuredGridWriter", []() 
-> vtkObjectBase* { return vtkXMLStructuredGridWriter::New(); });

     vtkNew<vtkXMLCollectionReader> reader;
     reader->SetFileName(infile.c_str());
...
}

In order to use vtkXMLCollectionReader/vtkFileSeriesReader one needs the 
interpreter and all required NewINstanceFunctions and CommandFunctions 
registered.

What is the proper way to compile and link a program which has all the 
NewInstance/CommandFunctions (of certain modules) registered in the 
global interpreter so that i do not have to do it manually?
I already saw that all the ClientServer Wrapping is generated into the 
build directory during the compilation. How can i use that?

Best regards,
Henry




More information about the vtkusers mailing list