1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
|
/*=========================================================================
Program: ParaView
Module: vtkSIProxy.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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.
=========================================================================*/
/**
* @class vtkSIProxy
*
* vtkSIProxy is the server-implementation for a vtkSMProxy that helps the
* vtkSMProxy with managing/updating VTK objects.
*/
#ifndef vtkSIProxy_h
#define vtkSIProxy_h
#include "vtkPVServerImplementationCoreModule.h" //needed for exports
#include "vtkSIObject.h"
#include "vtkSmartPointer.h" // needed for vtkSmartPointer.
class vtkAlgorithmOutput;
class vtkSIProperty;
class vtkPVXMLElement;
class vtkSIProxyDefinitionManager;
class VTKPVSERVERIMPLEMENTATIONCORE_EXPORT vtkSIProxy : public vtkSIObject
{
public:
static vtkSIProxy* New();
vtkTypeMacro(vtkSIProxy, vtkSIObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* This method is called before the deletion of the SIObject.
* Basically this is used to remove all dependency with other SIObject so after
* a first pass on all SIObject with a AboutToDelete() we can simply delete the
* remaining SIObjects.
*/
virtual void AboutToDelete() VTK_OVERRIDE;
/**
* Push a new state to the underneath implementation
*/
virtual void Push(vtkSMMessage* msg) VTK_OVERRIDE;
/**
* Pull the current state of the underneath implementation
*/
virtual void Pull(vtkSMMessage* msg) VTK_OVERRIDE;
//@{
/**
* Returns access to the VTKObject pointer, if any.
* Note this is a raw pointer to the local instance of the VTK object. Any
* changes you make directly using this object pointer will not be reflected
* on other processes.
*/
vtkObjectBase* GetVTKObject();
void SetVTKObject(vtkObjectBase*);
//@}
/**
* Provides access to the property helper.
*/
vtkSIProperty* GetSIProperty(const char* name);
//@{
/**
* Returns the VTKClassName.
*/
vtkGetStringMacro(VTKClassName);
//@}
//@{
/**
* Assigned by the XML parser. The name assigned in the XML
* configuration. Can be used to figure out the origin of the
* proxy.
*/
vtkGetStringMacro(XMLName);
//@}
//@{
/**
* Assigned by the XML parser. The group in the XML configuration that
* this proxy belongs to. Can be used to figure out the origin of the
* proxy.
*/
vtkGetStringMacro(XMLGroup);
//@}
/**
* Return true if that Proxy is supposed to have NO vtk class, which means
* its a NullProxy.
*/
bool IsNullProxy() { return (VTKClassName == NULL); };
//@{
/**
* These methods are called to add/remove input connections by
* vtkSIInputProperty. This indirection makes it possible for subclasses to
* insert VTK-algorithms in the input pipeline.
*/
virtual void AddInput(int input_port, vtkAlgorithmOutput* connection, const char* method);
virtual void CleanInputs(const char* method);
//@}
/**
* Triggers UpdateInformation() on vtkObject if possible.
* Default implementation does pretty much nothing.
*/
virtual void UpdatePipelineInformation() {}
/**
* Called by vtkSMProxy::RecreateVTKObjects() to re-create the VTK objects.
*/
virtual void RecreateVTKObjects();
/**
* Counter part to vtkSMSelfGeneratingSourceProxy::ExtendDefinition(). Called by that
* method to let the vtkSIProxy know about the extended definition.
*/
virtual bool ExtendDefinition(const char* xml);
protected:
vtkSIProxy();
~vtkSIProxy();
/**
* Returns the subproxy helper for the subproxy with the given name, if any.
*/
vtkSIProxy* GetSubSIProxy(const char* name);
//@{
/**
* API to iterate over subproxy helpers.
*/
unsigned int GetNumberOfSubSIProxys();
vtkSIProxy* GetSubSIProxy(unsigned int cc);
//@}
/**
* Provides access to the vtkSIProxyDefinitionManager held by the session.
*/
vtkSIProxyDefinitionManager* GetProxyDefinitionManager();
/**
* Creates the VTK objects. This also parses the xml definition for proxy to
* create property-handlers.
* Returns true if object are (or have been) created successfully.
* \c message is used to obtain information about what proxy helper this is if
* the objects need to be created.
*/
virtual bool CreateVTKObjects();
/**
* Called to delete VTK objects.
*/
void DeleteVTKObjects();
/**
* Called after CreateVTKObjects(). The main difference for subclasses when
* overriding CreateVTKObjects() or OnCreateVTKObjects() is that
* CreateVTKObjects() is called before ReadXMLAttributes() is called, while
* OnCreateVTKObjects() is called after ReadXMLAttributes().
*/
virtual void OnCreateVTKObjects();
/**
* Called by vtkSIProxy::Push() to ensure that the vtkSIProxy has been
* initialized.
*/
bool InitializeAndCreateVTKObjects(vtkSMMessage* message);
//@{
/**
* Parses the XML to create property/subproxy helpers.
*/
virtual bool ReadXMLAttributes(vtkPVXMLElement* element);
virtual bool ReadXMLProperty(vtkPVXMLElement* property_element);
virtual bool ReadXMLSubProxy(vtkPVXMLElement* subproxy_element);
//@}
/**
* Adds a vtkSMProperty's server-implementation.
*/
void AddSIProperty(const char* name, vtkSIProperty*);
vtkSetStringMacro(VTKClassName);
vtkSetStringMacro(XMLGroup);
vtkSetStringMacro(XMLName);
vtkSetStringMacro(XMLSubProxyName);
vtkSetStringMacro(PostPush);
vtkSetStringMacro(PostCreation);
char* VTKClassName;
char* XMLGroup;
char* XMLName;
char* XMLSubProxyName;
char* PostPush;
char* PostCreation;
int NumberOfInputPorts;
vtkSmartPointer<vtkObjectBase> VTKObject;
bool ObjectsCreated;
private:
vtkSIProxy(const vtkSIProxy&) VTK_DELETE_FUNCTION;
void operator=(const vtkSIProxy&) VTK_DELETE_FUNCTION;
class vtkInternals;
vtkInternals* Internals;
};
#endif
|