vtkSMProxy.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMProxy.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
130 #ifndef vtkSMProxy_h
131 #define vtkSMProxy_h
132 
133 #include "vtkClientServerID.h" // needed for vtkClientServerID
134 #include "vtkRemotingServerManagerModule.h" //needed for exports
135 #include "vtkSMRemoteObject.h"
136 
137 struct vtkSMProxyInternals;
138 
140 class vtkPVInformation;
141 class vtkSMLoadStateContext;
142 class vtkPVXMLElement;
143 class vtkSMDocumentation;
144 class vtkSMProperty;
145 class vtkSMPropertyGroup;
147 class vtkSMProxyLocator;
148 class vtkSMProxyManager;
150 class vtkSMProxyObserver;
151 
153 {
154 public:
155  static vtkSMProxy* New();
157  void PrintSelf(ostream& os, vtkIndent indent) override;
158 
159  // Description:
160  // Set or override a key/value pair as annotation to that proxy.
161  // If the value is NULL, this method is equivalent to RemoveAnnotation(key)
162  void SetAnnotation(const char* key, const char* value);
163 
168  const char* GetAnnotation(const char* key);
169 
173  void RemoveAnnotation(const char* key);
174 
178  void RemoveAllAnnotations();
179 
183  bool HasAnnotation(const char* key);
184 
188  int GetNumberOfAnnotations();
189 
193  const char* GetAnnotationKeyAt(int index);
194 
199  void SetLocation(vtkTypeUInt32) override;
200 
205  virtual vtkSMProperty* GetProperty(const char* name)
206  {
207  return this->GetProperty(name, /*self-only*/ 0);
208  }
209 
215  virtual vtkSMProperty* GetProperty(const char* name, int selfOnly);
216 
224  const char* GetPropertyName(vtkSMProperty* prop);
225 
231  virtual void UpdateVTKObjects();
232 
238  virtual void RecreateVTKObjects();
239 
241 
247  bool UpdateProperty(const char* name) { return this->UpdateProperty(name, 0); }
248  bool UpdateProperty(const char* name, int force);
250 
254  void InvokeCommand(const char* name) { this->UpdateProperty(name, 1); }
255 
257 
260  vtkGetStringMacro(VTKClassName);
262 
264 
269  vtkSetStringMacro(VTKClassName);
271 
275  virtual vtkSMPropertyIterator* NewPropertyIterator();
276 
282  unsigned int GetNumberOfConsumers();
283 
289  vtkSMProxy* GetConsumerProxy(unsigned int idx);
290 
296  vtkSMProperty* GetConsumerProperty(unsigned int idx);
297 
302  unsigned int GetNumberOfProducers();
303 
307  vtkSMProxy* GetProducerProxy(unsigned int idx);
308 
314  vtkSMProperty* GetProducerProperty(unsigned int idx);
315 
317 
322  vtkGetStringMacro(XMLName);
324 
326 
331  vtkGetStringMacro(XMLGroup);
333 
335 
341  vtkGetStringMacro(XMLLabel);
343 
348  virtual void UpdatePropertyInformation();
349 
354  virtual void UpdatePropertyInformation(vtkSMProperty* prop);
355 
363  virtual void MarkAllPropertiesAsModified();
364 
371  virtual void ResetPropertiesToXMLDefaults();
372 
379  virtual void ResetPropertiesToDomainDefaults();
380 
382  {
383  DEFAULT = 0,
384  ONLY_XML = 1,
385  ONLY_DOMAIN = 2
386  };
387 
397  virtual void ResetPropertiesToDefault(ResetPropertiesMode mode = DEFAULT);
398 
402  enum
403  {
404  COPY_PROXY_PROPERTY_VALUES_BY_REFERENCE = 0,
405 
406  COPY_PROXY_PROPERTY_VALUES_BY_CLONING // < No longer supported!!!
407  };
408 
410 
423  void Copy(vtkSMProxy* src);
424  void Copy(vtkSMProxy* src, const char* exceptionClass);
425  virtual void Copy(vtkSMProxy* src, const char* exceptionClass, int proxyPropertyCopyFlag);
427 
431  virtual void MarkModified(vtkSMProxy* modifiedProxy);
432 
434 
437  vtkGetObjectMacro(Documentation, vtkSMDocumentation);
439 
441 
449  vtkGetObjectMacro(Hints, vtkPVXMLElement);
451 
453 
456  vtkGetMacro(ObjectsCreated, int);
458 
467  void InitializeAndCopyFromProxy(vtkSMProxy* source);
468 
473  virtual void MarkDirty(vtkSMProxy* modifiedProxy);
474 
479  vtkObjectBase* GetClientSideObject();
480 
482 
487  bool GatherInformation(vtkPVInformation* information);
488  bool GatherInformation(vtkPVInformation* information, vtkTypeUInt32 location);
490 
499  virtual vtkPVXMLElement* SaveXMLState(vtkPVXMLElement* root);
503  virtual vtkPVXMLElement* SaveXMLState(vtkPVXMLElement* root, vtkSMPropertyIterator* iter);
504 
512  virtual int LoadXMLState(vtkPVXMLElement* element, vtkSMProxyLocator* locator);
513 
515 
520  void PrototypeOn() override;
521  void PrototypeOff() override;
522  void SetPrototype(bool undo) override;
524 
530  void UpdateSelfAndAllInputs();
531 
536  bool GetIsSubProxy();
537 
542  vtkSMProxy* GetParentProxy();
543 
549  vtkSMProxy* GetTrueParentProxy();
550 
558  void EnableLocalPushOnly() override;
559 
564  void DisableLocalPushOnly() override;
565 
570  const vtkSMMessage* GetFullState() override;
571 
579  void LoadState(const vtkSMMessage* msg, vtkSMProxyLocator* locator) override;
580 
584  vtkSMPropertyGroup* GetPropertyGroup(size_t index) const;
585 
589  size_t GetNumberOfPropertyGroups() const;
590 
592 
607  void SetLogName(const char* name);
608  vtkGetStringMacro(LogName);
610 
614  const char* GetLogNameOrDefault();
615 
616 protected:
617  vtkSMProxy();
618  ~vtkSMProxy() override;
619 
623  void ExecuteStream(
624  const vtkClientServerStream& msg, bool ignore_errors = false, vtkTypeUInt32 location = 0);
625 
626  // Any method changing the annotations will trigger this method that will
627  // update the local full state as well as sending the annotation state part
628  // to the session.
629  virtual void UpdateAndPushAnnotationState();
630 
632 
635  virtual const vtkClientServerStream& GetLastResult();
636  virtual const vtkClientServerStream& GetLastResult(vtkTypeUInt32 location);
638 
645  virtual void AddProperty(const char* name, vtkSMProperty* prop);
646 
650  virtual void MarkConsumersAsDirty(vtkSMProxy* modifiedProxy);
651 
660  virtual void MarkDirtyFromProducer(
661  vtkSMProxy* modifiedProxy, vtkSMProxy* producer, vtkSMProperty* property);
662 
673  void MarkInputsAsDirty();
674 
676 
682  friend class vtkSMCameraLink;
683  friend class vtkSMCompoundProxy;
685  friend class vtkSMInputProperty;
687  friend class vtkSMPart;
688  friend class vtkSMProperty;
689  friend class vtkSMPropertyIterator;
692  friend class vtkSMProxyObserver;
693  friend class vtkSMProxyProperty;
694  friend class vtkSMProxyRegisterUndoElement;
695  friend class vtkSMProxyUnRegisterUndoElement;
696  friend class vtkSMSourceProxy;
697  friend class vtkSMUndoRedoStateLoader;
699  friend class vtkSMStateLocator;
701  friend class vtkSMStateLoader;
703 
705 
710  vtkSetStringMacro(XMLName);
712 
714 
719  vtkSetStringMacro(XMLGroup);
721 
723 
729  vtkSetStringMacro(XMLLabel);
731 
733 
740  vtkSetStringMacro(XMLSubProxyName);
742 
748  virtual void CreateVTKObjects();
749 
755  void RemoveAllObservers();
756 
778  virtual void SetPropertyModifiedFlag(const char* name, int flag);
779 
785  void AddSubProxy(const char* name, vtkSMProxy* proxy, int overrideOK = 0);
786 
790  void RemoveSubProxy(const char* name);
791 
795  vtkSMProxy* GetSubProxy(const char* name);
796 
800  vtkSMProxy* GetSubProxy(unsigned int index);
801 
806  const char* GetSubProxyName(unsigned int index);
807 
812  const char* GetSubProxyName(vtkSMProxy*);
813 
817  unsigned int GetNumberOfSubProxies();
818 
823  virtual void AddConsumer(vtkSMProperty* property, vtkSMProxy* proxy);
824 
828  virtual void RemoveConsumer(vtkSMProperty* property, vtkSMProxy* proxy);
829 
833  virtual void RemoveAllConsumers();
834 
839  void AddProducer(vtkSMProperty* property, vtkSMProxy* proxy);
840 
844  void RemoveProducer(vtkSMProperty* property, vtkSMProxy* proxy);
845 
855  virtual void PostUpdateData(bool using_cache);
856 
860  bool WarnIfDeprecated();
861 
867  virtual void UpdatePipelineInformation();
868 
869  // When an algorithm proxy is marked modified, NeedsUpdate is
870  // set to true. In PostUpdateData(), NeedsUpdate is set to false.
871  // This is used to keep track of data information validity.
873 
875 
879  vtkSMProperty* NewProperty(const char* name);
880  vtkSMProperty* NewProperty(const char* name, vtkPVXMLElement* propElement);
882 
887  void LinkProperty(vtkSMProperty* inputProperty, vtkSMProperty* outputProperty);
888 
894  vtkSMPropertyGroup* NewPropertyGroup(vtkPVXMLElement* propElement);
895 
899  void AppendPropertyGroup(vtkSMPropertyGroup* group);
900 
902 
905  virtual int ReadXMLAttributes(vtkSMSessionProxyManager* pm, vtkPVXMLElement* element);
906  void SetupExposedProperties(const char* subproxy_name, vtkPVXMLElement* element);
907  void SetupSharedProperties(vtkSMProxy* subproxy, vtkPVXMLElement* element);
909 
917  void ExposeSubProxyProperty(const char* subproxy_name, const char* property_name,
918  const char* exposed_name, int overrideOK = 0);
919 
923  virtual void ExecuteSubProxyEvent(vtkSMProxy* o, unsigned long event, void* data);
924 
925  virtual int CreateSubProxiesAndProperties(vtkSMSessionProxyManager* pm, vtkPVXMLElement* element);
926 
933  virtual void UpdatePropertyInformationInternal(vtkSMProperty* prop = NULL);
934 
943  void RebuildStateForProperties();
944 
948  virtual void SetLogNameInternal(
949  const char* name, bool propagate_to_subproxies, bool propagate_to_proxylistdomains);
950 
952 
955  vtkSetStringMacro(SIClassName);
956  vtkGetStringMacro(SIClassName);
957  char* SIClassName;
959 
961  char* XMLGroup;
962  char* XMLName;
963  char* XMLLabel;
968 
975 
981 
985  bool ArePropertiesModified();
986 
987  void SetHints(vtkPVXMLElement* hints);
988  void SetDeprecated(vtkPVXMLElement* deprecated);
989 
990  void SetXMLElement(vtkPVXMLElement* element);
992 
996 
997  // Cached version of State
999 
1000  // Flag used to break consumer loops.
1002 
1004 
1005 protected:
1007  vtkSMProxyObserver* SubProxyObserver;
1008  vtkSMProxy(const vtkSMProxy&) = delete;
1009  void operator=(const vtkSMProxy&) = delete;
1010 
1011 private:
1012  vtkSMProperty* SetupExposedProperty(vtkPVXMLElement* propertyElement, const char* subproxy_name);
1013 
1014  friend class vtkSMProxyInfo;
1015 
1016  char* LogName;
1017  std::string DefaultLogName;
1018 };
1019 
1034 {
1035 public:
1037  : SIOBJECT(proxy)
1038  {
1039  }
1040 };
1041 
1057 {
1058  vtkSMProxy* Reference;
1060  vtkClientServerStream& stream, const VTKOBJECT& manipulator);
1061 
1062 public:
1064  : Reference(proxy)
1065  {
1066  }
1067 };
1069  vtkClientServerStream& stream, const VTKOBJECT& manipulator);
1070 
1071 #endif
bool UpdateProperty(const char *name)
Update the value of one property (pushed to the server) if it is modified.
Definition: vtkSMProxy.h:247
This defines a stream manipulator for the vtkClientServerStream that can be used to indicate to the i...
Definition: vtkSMProxy.h:1056
void RemoveAllObservers()
iterates over a subset of a proxy&#39;s properties
virtual void PrototypeOff()
Allow user to set the remote object to be discard for Undo/Redo action.
property representing pointer(s) to vtkObject(s)
VTKOBJECT(vtkSMProxy *proxy)
Definition: vtkSMProxy.h:1063
virtual void LoadState(const vtkSMMessage *msg, vtkSMProxyLocator *locator)
This method is used to initialise the object to the given state If the definitionOnly Flag is set to ...
#define VTKREMOTINGSERVERMANAGER_EXPORT
virtual void PrototypeOn()
Allow user to set the remote object to be discard for Undo/Redo action.
virtual void EnableLocalPushOnly()
Allow to switch off any push of state change to the server for that particular object.
virtual void SetLocation(vtkTypeUInt32)
Get/Set the location where the underlying VTK-objects are created.
This defines a stream manipulator for the vtkClientServerStream that can be used to indicate to the i...
Definition: vtkSMProxy.h:1033
superclass for all SM properties
char * XMLGroup
Definition: vtkSMProxy.h:961
iterates over the properties of a proxy
Store messages for the interpreter.
singleton/facade to vtkSMSessionProxyManager
char * XMLSubProxyName
Definition: vtkSMProxy.h:964
int InMarkModified
Definition: vtkSMProxy.h:1001
SIPROXY(vtkSMProxy *proxy)
Definition: vtkSMProxy.h:1036
int DoNotUpdateImmediately
Definition: vtkSMProxy.h:966
name
vtkSMMessage * State
Definition: vtkSMProxy.h:998
vtkSMDocumentation * Documentation
Definition: vtkSMProxy.h:993
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
This defines a manipulator for the vtkClientServerStream that can be used to indicate to the interpre...
virtual void DisableLocalPushOnly()
Enable the given remote object to communicate its state normally to the server location.
int ObjectsCreated
Definition: vtkSMProxy.h:965
VTKREMOTINGSERVERMANAGER_EXPORT vtkClientServerStream & operator<<(vtkClientServerStream &stream, const VTKOBJECT &manipulator)
proxy for a VTK source on a server
vtkWeakPointer< vtkSMProxy > ParentProxy
Definition: vtkSMProxy.h:1003
deserializes proxies from their Protobuf states.
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
char * XMLName
Definition: vtkSMProxy.h:962
a proxy excapsulation a pipeline of proxies.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
int InUpdateVTKObjects
Avoids calls to UpdateVTKObjects in UpdateVTKObjects.
Definition: vtkSMProxy.h:974
void InvokeCommand(const char *name)
Convenience method equivalent to UpdateProperty(name, 1).
Definition: vtkSMProxy.h:254
virtual const vtkSMMessage * GetFullState()
This method return the full object state that can be used to create that object from scratch...
is used to locate proxies referred to in state xmls while loading state files.
vtkSMProxyObserver * SubProxyObserver
Definition: vtkSMProxy.h:1007
bool NeedsUpdate
Definition: vtkSMProxy.h:872
int DoNotModifyProperty
Definition: vtkSMProxy.h:967
class providing access to the documentation for a vtkSMProxy.
virtual vtkSMProperty * GetProperty(const char *name)
Return the property with the given name.
Definition: vtkSMProxy.h:205
vtkPVXMLElement * XMLElement
Definition: vtkSMProxy.h:991
vtkSMProxyInternals * Internals
Definition: vtkSMProxy.h:1006
char * VTKClassName
Definition: vtkSMProxy.h:960
Utility class to load state from XML.
baseclass for all proxy-objects that have counter parts on server as well as client processes...
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
virtual void SetPrototype(bool)
Allow user to set the remote object to be discard for Undo/Redo action.
static vtkSMSessionObject * New()
bool PropertiesModified
Flag used to help speed up UpdateVTKObjects and ArePropertiesModified calls.
Definition: vtkSMProxy.h:980
Superclass for information objects.
char * XMLLabel
Definition: vtkSMProxy.h:963
void PrintSelf(ostream &os, vtkIndent indent) override
iterates over the properties of a proxy
proxy representing inputs to a filter
vtkPVXMLElement * Deprecated
Definition: vtkSMProxy.h:995
Class used to retrieve a given message state based on its GlobalID.
char * SIClassName
SIClassName identifies the classname for the helper on the server side.
Definition: vtkSMProxy.h:956
vtkPVXMLElement * Hints
Definition: vtkSMProxy.h:994