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
|
/*=========================================================================
Program: ParaView
Module: $RCSfile$
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 vtkSMCompoundSourceProxyDefinitionBuilder
* @brief used to build a
* vtkSMCompoundSourceProxy definition.
*
* vtkSMCompoundSourceProxyDefinitionBuilder is used to create a XML definition
* for a compound-proxy consisting of other proxies. This class can only build
* one compound-proxy definition at a time. Use Reset() to start a new
* definition.
* @sa
* vtkSMCompoundSourceProxy
*/
#ifndef vtkSMCompoundSourceProxyDefinitionBuilder_h
#define vtkSMCompoundSourceProxyDefinitionBuilder_h
#include "vtkPVServerManagerCoreModule.h" //needed for exports
#include "vtkSMObject.h"
class vtkSMProxy;
class vtkPVXMLElement;
class VTKPVSERVERMANAGERCORE_EXPORT vtkSMCompoundSourceProxyDefinitionBuilder : public vtkSMObject
{
public:
static vtkSMCompoundSourceProxyDefinitionBuilder* New();
vtkTypeMacro(vtkSMCompoundSourceProxyDefinitionBuilder, vtkSMObject);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Resets the builder. This can be used when using the builder to create
* multiple definitions.
*/
void Reset();
/**
* Add a proxy to be included in this compound proxy.
* The name must be unique to each proxy added, otherwise the previously
* added proxy will be replaced.
*/
void AddProxy(const char* name, vtkSMProxy* proxy);
/**
* Expose a property from the sub proxy (added using AddProxy).
* Only exposed properties are accessible externally. Note that the sub proxy
* whose property is being exposed must have been already added using
* AddProxy().
*/
void ExposeProperty(const char* proxyName, const char* propertyName, const char* exposedName);
/**
* Expose an output port from a subproxy. Exposed output ports are treated as
* output ports of the vtkSMCompoundSourceProxy itself.
* This method does not may the output port available. One must call
* CreateOutputPorts().
*/
void ExposeOutputPort(const char* proxyName, const char* portName, const char* exposedName);
/**
* Expose an output port from a subproxy. Exposed output ports are treated as
* output ports of the vtkSMCompoundSourceProxy itself.
* This method does not may the output port available. One must call
* CreateOutputPorts().
*/
void ExposeOutputPort(const char* proxyName, unsigned int portIndex, const char* exposedName);
/**
* Returns the number of sub-proxies.
*/
unsigned int GetNumberOfProxies();
/**
* Returns the sub proxy at a given index.
*/
vtkSMProxy* GetProxy(unsigned int cc);
/**
* Returns the subproxy with the given name.
*/
vtkSMProxy* GetProxy(const char* name);
/**
* Returns the name used to store sub-proxy. Returns 0 if sub-proxy does
* not exist.
*/
const char* GetProxyName(unsigned int index);
/**
* This is the same as save state except it will remove all references to
* "outside" proxies. Outside proxies are proxies that are not contained
* in the compound proxy. As a result, the saved state will be self
* contained. Returns the top element created. It is the caller's
* responsibility to delete the returned element. If root is NULL,
* the returned element will be a top level element.
*/
vtkPVXMLElement* SaveDefinition(vtkPVXMLElement* root);
protected:
vtkSMCompoundSourceProxyDefinitionBuilder();
~vtkSMCompoundSourceProxyDefinitionBuilder();
private:
vtkSMCompoundSourceProxyDefinitionBuilder(
const vtkSMCompoundSourceProxyDefinitionBuilder&) VTK_DELETE_FUNCTION;
void operator=(const vtkSMCompoundSourceProxyDefinitionBuilder&) VTK_DELETE_FUNCTION;
class vtkInternals;
vtkInternals* Internals;
// returns 1 if the value element should be written.
// proxy property values that point to "outside" proxies
// are not written
int ShouldWriteValue(vtkPVXMLElement* valueElem);
void TraverseForProperties(vtkPVXMLElement* root);
void StripValues(vtkPVXMLElement* propertyElem);
};
#endif
|