Commit 9a213546 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

A cleaner solution to init CS Interp. for extra kits.

Added support to ADD_PARAVIEW_PLUGIN to specify extra CS wrapped kit names. This
is cleaner than vtkStreamLibraryWrapper and works without any extra hassle after
the plugin is loaded.
parent a9eadd53
......@@ -846,7 +846,8 @@ ENDMACRO(PARAVIEW_QT4_ADD_RESOURCES)
# REQUIRED_ON_SERVER is to specify whether this plugin should be loaded on server
# REQUIRED_ON_CLIENT is to specify whether this plugin should be loaded on client
# REQUIRED_PLUGINS is to specify the plugin names that this plugin depends on
# CS_KITS is experimental option to add wrapped kits. This may change in
# future.
# ADD_PARAVIEW_PLUGIN(Name Version
# [SERVER_MANAGER_SOURCES source files]
# [SERVER_MANAGER_XML XMLFile]
......@@ -860,6 +861,7 @@ ENDMACRO(PARAVIEW_QT4_ADD_RESOURCES)
# [REQUIRED_ON_SERVER]
# [REQUIRED_ON_CLIENT]
# [REQUIRED_PLUGINS pluginname1 pluginname2]
# [CS_KITS kit1 kit2...]
# )
FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
SET(QT_RCS)
......@@ -877,6 +879,7 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
SET(ARG_GUI_SOURCES)
SET(ARG_REQUIRED_PLUGINS)
SET(ARG_AUTOLOAD)
SET(ARG_CS_KITS)
SET(PLUGIN_NAME "${NAME}")
SET(PLUGIN_VERSION "${VERSION}")
......@@ -890,7 +893,7 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
PV_PLUGIN_PARSE_ARGUMENTS(ARG
"SERVER_MANAGER_SOURCES;SERVER_MANAGER_XML;SERVER_SOURCES;PYTHON_MODULES;GUI_INTERFACES;GUI_RESOURCES;GUI_RESOURCE_FILES;GUI_SOURCES;SOURCES;REQUIRED_PLUGINS;REQUIRED_ON_SERVER;REQUIRED_ON_CLIENT;AUTOLOAD"
"SERVER_MANAGER_SOURCES;SERVER_MANAGER_XML;SERVER_SOURCES;PYTHON_MODULES;GUI_INTERFACES;GUI_RESOURCES;GUI_RESOURCE_FILES;GUI_SOURCES;SOURCES;REQUIRED_PLUGINS;REQUIRED_ON_SERVER;REQUIRED_ON_CLIENT;AUTOLOAD;CS_KITS"
"" ${ARGN} )
PV_PLUGIN_LIST_CONTAINS(reqired_server_arg "REQUIRED_ON_SERVER" ${ARGN})
......@@ -961,6 +964,17 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
${ARG_SERVER_SOURCES}
${PY_SRCS})
SET (PLUGIN_EXTRA_CS_INITS)
SET (PLUGIN_EXTRA_CS_INITS_EXTERNS)
IF (ARG_CS_KITS)
FOREACH(kit ${ARG_CS_KITS})
SET (PLUGIN_EXTRA_CS_INITS
"${kit}CS_Initialize(interp);\n${PLUGIN_EXTRA_CS_INITS}")
SET (PLUGIN_EXTRA_CS_INITS_EXTERNS
"extern \"C\" void ${kit}CS_Initialize(vtkClientServerInterpreter*);\n${PLUGIN_EXTRA_CS_INITS_EXTERNS}")
ENDFOREACH(kit)
ENDIF (ARG_CS_KITS)
IF(GUI_SRCS OR SM_SRCS OR ARG_SOURCES OR ARG_PYTHON_MODULES)
CONFIGURE_FILE(
${ParaView_CMAKE_DIR}/pqParaViewPlugin.h.in
......
......@@ -39,7 +39,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# include "vtkClientServerInterpreterInitializer.h"
# include "vtkClientServerInterpreter.h"
extern "C" void @PLUGIN_NAME@_Initialize(vtkClientServerInterpreter *arlu);
extern "C" void @PLUGIN_NAME@_Initialize(vtkClientServerInterpreter *);
@PLUGIN_EXTRA_CS_INITS_EXTERNS@
extern "C" void VTK_EXPORT @PLUGIN_NAME@_CombinedInitialize(
vtkClientServerInterpreter *interp)
{
@PLUGIN_NAME@_Initialize(interp);
// Now initialize any extra kits as requested.
@PLUGIN_EXTRA_CS_INITS@
}
# endif
#endif
......@@ -61,7 +70,7 @@ vtkClientServerInterpreterInitializer::InterpreterInitializationCallback
@PLUGIN_NAME@_Plugin::GetInitializeInterpreterCallback()
{
# ifdef INITIALIZE_WRAPPING
return @PLUGIN_NAME@_Initialize;
return @PLUGIN_NAME@_CombinedInitialize;
# endif
return NULL;
}
......
......@@ -87,7 +87,6 @@ add_paraview_plugin(
vtkPVStreamingParallelHelper.cxx
vtkSMStreamingRepresentationProxy.cxx
vtkSMStreamingViewProxy.cxx
vtkStreamLibraryWrapper.cxx
SERVER_MANAGER_XML
StreamingView.xml
GUI_RESOURCE_FILES
......@@ -115,6 +114,7 @@ add_paraview_plugin(
PrioritizingView.cxx
RefiningView.cxx
pqStreamingControls.cxx
CS_KITS vtkStreaming
)
TARGET_LINK_LIBRARIES ( StreamingView vtkStreamingCS )
......@@ -69,7 +69,6 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkPVSynchronizedRenderWindows.h"
#include "vtkRenderer.h"
#include "vtkStreamingDriver.h"
#include "vtkStreamLibraryWrapper.h"
vtkStandardNewMacro(vtkPVStreamingView);
......@@ -82,10 +81,6 @@ void vtkPVStreamingViewRenderLaterFunction(void *instance)
//----------------------------------------------------------------------------
vtkPVStreamingView::vtkPVStreamingView()
{
vtkStreamLibraryWrapper* wrapper = vtkStreamLibraryWrapper::New();
wrapper->EnableWrapping();
wrapper->Delete();
this->StreamDriver = NULL;
this->IsDisplayDone = 1;
vtkMath::UninitializeBounds(this->RunningBounds);
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkStreamLibraryWrapper.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL)
Module: vtkStreamLibraryWrapper.cxx
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Los Alamos National Security, LLC, Los Alamos National
Laboratory, LANL, the U.S. Government, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "vtkStreamLibraryWrapper.h"
#include "vtkObjectFactory.h"
#include "vtkClientServerInterpreter.h"
#include "vtkClientServerInterpreterInitializer.h"
//This sets the CS wrapped classes up so ParaView can call them
extern "C" void vtkStreamingCS_Initialize(vtkClientServerInterpreter *arlu);
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkStreamLibraryWrapper);
int vtkStreamLibraryWrapper::WrappingEnabled = 0;
//----------------------------------------------------------------------------
vtkStreamLibraryWrapper::vtkStreamLibraryWrapper()
{
}
//----------------------------------------------------------------------------
vtkStreamLibraryWrapper::~vtkStreamLibraryWrapper()
{
}
//----------------------------------------------------------------------------
void vtkStreamLibraryWrapper::EnableWrapping()
{
if (!vtkStreamLibraryWrapper::WrappingEnabled)
{
vtkStreamLibraryWrapper::WrappingEnabled = 1;
//register the wrapped classes so ParaView can call them too
vtkClientServerInterpreterInitializer::GetInitializer()->RegisterCallback(
vtkStreamingCS_Initialize);
}
}
//----------------------------------------------------------------------------
void vtkStreamLibraryWrapper::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkStreamLibraryWrapper.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*=========================================================================
Program: VTK/ParaView Los Alamos National Laboratory Modules (PVLANL)
Module: vtkStreamLibraryWrapper.h
Copyright (c) 2007, Los Alamos National Security, LLC
All rights reserved.
Copyright 2007. Los Alamos National Security, LLC.
This software was produced under U.S. Government contract DE-AC52-06NA25396
for Los Alamos National Laboratory (LANL), which is operated by
Los Alamos National Security, LLC for the U.S. Department of Energy.
The U.S. Government has rights to use, reproduce, and distribute this software.
NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY,
EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE.
If software is modified to produce derivative works, such modified software
should be clearly marked, so as not to confuse it with the version available
from LANL.
Additionally, redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Los Alamos National Security, LLC, Los Alamos National
Laboratory, LANL, the U.S. Government, nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY LOS ALAMOS NATIONAL SECURITY, LLC AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL LOS ALAMOS NATIONAL SECURITY, LLC OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
// .NAME vtkStreamLibraryWrapper - class to enable ParaView CS wrapped classes
// .SECTION Description
// An instance of this class is instantiated on the server to initialize
// the ClientServer wrapped library. It is necessary since the VTK level
// code is in a separate dir and lib from the PV plugin level code.
#ifndef __vtkStreamLibraryWrapper_h
#define __vtkStreamLibraryWrapper_h
#include "vtkObject.h"
class VTK_EXPORT vtkStreamLibraryWrapper : public vtkObject
{
public:
static vtkStreamLibraryWrapper* New();
vtkTypeMacro(vtkStreamLibraryWrapper, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Turn on the wrapped library
void EnableWrapping();
protected:
vtkStreamLibraryWrapper();
~vtkStreamLibraryWrapper();
// Description:
// Prevents attempts to turn it on more than once.
static int WrappingEnabled;
private:
vtkStreamLibraryWrapper(const vtkStreamLibraryWrapper&);//Not implemented
void operator=(const vtkStreamLibraryWrapper&);//Not implemented
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment