4 #ifndef vtkSMSessionProxyManagerInternals_h 5 #define vtkSMSessionProxyManagerInternals_h 17 #include <vtksys/RegularExpression.hxx> 29 this->Superclass::PrintSelf(os, indent);
43 ret->InitializeObjectBase();
53 this->ModifiedObserverTag = 0;
54 this->StateChangedObserverTag = 0;
55 this->UpdateObserverTag = 0;
56 this->UpdateInformationObserverTag = 0;
61 if (this->ModifiedObserverTag && this->Proxy.
GetPointer())
64 this->ModifiedObserverTag = 0;
66 if (this->StateChangedObserverTag && this->Proxy.
GetPointer())
69 this->StateChangedObserverTag = 0;
71 if (this->UpdateObserverTag && this->Proxy.
GetPointer())
74 this->UpdateObserverTag = 0;
76 if (this->UpdateInformationObserverTag && this->Proxy.
GetPointer())
79 this->UpdateInformationObserverTag = 0;
86 :
public std::vector<vtkSmartPointer<vtkSMProxyManagerProxyInfo>>
92 vtkSMProxyManagerProxyListType::iterator iter = this->begin();
93 for (; iter != this->end(); ++iter)
95 if (iter->GetPointer()->Proxy == proxy)
104 vtkSMProxyManagerProxyListType::iterator iter = this->begin();
105 for (; iter != this->end(); ++iter)
107 if (iter->GetPointer()->Proxy.GetPointer() == proxy)
136 return this->Group == other.
Group && this->Name == other.
Name &&
148 return this->Name < other.
Name;
152 return this->Group < other.
Group;
165 return this->Name > other.
Name;
169 return this->Group > other.
Group;
192 typedef std::map<std::string, vtkSmartPointer<vtkSMLink>>
LinkType;
208 std::set<vtkSMProxyManagerEntry>::iterator iter;
209 iter = this->RegisteredProxyTuple.begin();
210 while (iter != this->RegisteredProxyTuple.end())
212 if (iter->Proxy == proxy)
214 tuplesFounds.insert(*iter);
222 std::set<vtkSMProxyManagerEntry>& toRegister, std::set<vtkSMProxyManagerEntry>& toUnregister)
225 std::set<vtkSMProxyManagerEntry> newStateContent;
226 int max = newState->ExtensionSize(PXMRegistrationState::registered_proxy);
227 for (
int cc = 0; cc < max; cc++)
229 PXMRegistrationState_Entry reg =
230 newState->GetExtension(PXMRegistrationState::registered_proxy, cc);
234 newStateContent.insert(
244 std::set<vtkSMProxyManagerEntry>::iterator iter;
245 iter = newStateContent.begin();
246 while (iter != newStateContent.end())
248 if (this->RegisteredProxyTuple.find(*iter) == this->RegisteredProxyTuple.end())
250 toRegister.insert(*iter);
256 iter = this->RegisteredProxyTuple.begin();
257 vtksys::RegularExpression prototypesRe(
"_prototypes$");
258 while (iter != this->RegisteredProxyTuple.end())
260 if (newStateContent.find(*iter) == newStateContent.end() &&
261 !prototypesRe.find(iter->Group.c_str()))
263 toUnregister.insert(*iter);
270 void RemoveTuples(
const char* name, std::set<vtkSMProxyManagerEntry>& removedEntries)
273 std::string nameString = name;
276 GroupNameProxySet resultSet;
277 std::set<vtkSMProxyManagerEntry>::iterator iter;
278 iter = this->RegisteredProxyTuple.begin();
279 while (iter != this->RegisteredProxyTuple.end())
281 if (iter->Name != nameString)
283 resultSet.insert(*iter);
287 this->RegisteredProxyTuple = resultSet;
290 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
291 this->RegisteredProxyMap.begin();
292 for (; it != this->RegisteredProxyMap.end(); it++)
294 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(name);
295 if (it2 != it->second.end())
297 this->RemoveTuples(it->first.c_str(), name, removedEntries,
true);
303 backup.CopyFrom(this->State);
304 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
305 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
306 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
308 const PXMRegistrationState_Entry* reg =
309 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
311 if (reg->name() != nameString)
313 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
320 std::set<vtkSMProxyManagerEntry>& removedEntries,
bool doMapOnly)
323 std::string groupString = group;
324 std::string nameString = name;
329 GroupNameProxySet resultSet;
330 std::set<vtkSMProxyManagerEntry>::iterator iter;
331 iter = this->RegisteredProxyTuple.begin();
332 while (iter != this->RegisteredProxyTuple.end())
334 if (iter->Group != groupString || iter->Name != nameString)
336 resultSet.insert(*iter);
340 this->RegisteredProxyTuple = resultSet;
344 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
345 this->RegisteredProxyMap.find(group);
346 if (it != this->RegisteredProxyMap.end())
348 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(name);
349 if (it2 != it->second.end())
351 vtkSMProxyManagerProxyListType::iterator it3 = it2->second.begin();
352 while (it3 != it2->second.end())
357 it->second.erase(it2);
362 vtksys::RegularExpression prototypesRe(
"_prototypes$");
363 if (!doMapOnly && !prototypesRe.find(group))
366 backup.CopyFrom(this->State);
367 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
368 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
369 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
371 const PXMRegistrationState_Entry* reg =
372 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
374 if (reg->group() != groupString || reg->name() != nameString)
376 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
387 std::string groupString = group;
388 std::string nameString = name;
397 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
398 this->RegisteredProxyMap.find(group);
399 if (it != this->RegisteredProxyMap.end())
401 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(name);
402 if (it2 != it->second.end())
404 vtkSMProxyManagerProxyListType::iterator it3 = it2->second.Find(proxy);
405 if (it3 != it2->second.end())
408 it2->second.erase(it3);
410 if (it2->second.empty())
412 it->second.erase(it2);
418 vtksys::RegularExpression prototypesRe(
"_prototypes$");
419 if (!prototypesRe.find(group))
422 backup.CopyFrom(this->State);
424 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
425 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
427 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
429 const PXMRegistrationState_Entry* reg =
430 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
432 if (reg->group() == groupString && reg->name() == nameString &&
440 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
451 this->State.ClearExtension(PXMRegistrationState::registered_selection_model);
452 std::map<std::string, vtkSmartPointer<vtkSMProxySelectionModel>>::iterator iter;
453 for (iter = this->SelectionModels.begin(); iter != this->SelectionModels.end(); iter++)
455 PXMRegistrationState_Entry* selModel =
456 this->State.AddExtension(PXMRegistrationState::registered_selection_model);
457 selModel->set_name(iter->first);
458 selModel->set_global_id(iter->second->GetGlobalID());
464 this->State.ClearExtension(PXMRegistrationState::registered_link);
466 LinkType::iterator iter;
467 for (iter = this->RegisteredLinkMap.begin(); iter != this->RegisteredLinkMap.end(); iter++)
469 PXMRegistrationState_Entry* linkEntry =
470 this->State.AddExtension(PXMRegistrationState::registered_link);
471 linkEntry->set_name(iter->first);
472 linkEntry->set_global_id(iter->second->GetGlobalID());
bool operator>(const vtkSMProxyManagerEntry &other) const
GroupNameProxySet RegisteredProxyTuple
LinkType RegisteredLinkMap
void ComputeDelta(const vtkSMMessage *newState, vtkSMProxyLocator *locator, std::set< vtkSMProxyManagerEntry > &toRegister, std::set< vtkSMProxyManagerEntry > &toUnregister)
static vtkSMProxyManagerProxyInfo * New()
vtkSMProxyManagerEntry(const char *group, const char *name, vtkSMProxy *proxy)
unsigned long ModifiedObserverTag
vtkSmartPointer< vtkSMProxy > Proxy
void RemoveTuples(const char *name, std::set< vtkSMProxyManagerEntry > &removedEntries)
void RemoveObserver(unsigned long tag)
virtual vtkSMProxy * LocateProxy(vtkTypeUInt32 globalID)
Locate a proxy with the given "name".
void operator=(const vtkSMProxyManagerProxyInfo &)=delete
void PrintSelf(ostream &os, vtkIndent indent) override
Header class that setup every thing in order to use Protobuf messages in a transparent manner...
void FindProxyTuples(vtkSMProxy *proxy, std::set< vtkSMProxyManagerEntry > &tuplesFounds)
std::map< std::string, vtkSmartPointer< vtkSMProxySelectionModel > > SelectionModelsType
bool operator<(const vtkSMProxyManagerEntry &other) const
SelectionModelsType SelectionModels
std::set< vtkSMProxyManagerEntry > GroupNameProxySet
bool RemoveTuples(const char *group, const char *name, vtkSMProxy *proxy)
bool Contains(vtkSMProxy *proxy)
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
SetOfProxies ModifiedProxies
ProxyGroupType RegisteredProxyMap
void RemoveTuples(const char *group, const char *name, std::set< vtkSMProxyManagerEntry > &removedEntries, bool doMapOnly)
proxy for a VTK object(s) on a server
is used to locate proxies referred to in state xmls while loading state files.
vtkSMSessionProxyManager * ProxyManager
vtkSMProxyManagerProxyListType::iterator Find(vtkSMProxy *proxy)
unsigned long UpdateObserverTag
unsigned long StateChangedObserverTag
unsigned long UpdateInformationObserverTag
bool operator==(const vtkSMProxyManagerEntry &other) const
vtkBaseTypeMacro(vtkSMProxyManagerProxyInfo, vtkObjectBase)
std::set< vtkSMProxy * > SetOfProxies
std::map< std::string, vtkSMProxyManagerProxyMapType > ProxyGroupType
virtual vtkTypeUInt32 GetGlobalID()
Get the global unique id for this object.
void UpdateProxySelectionModelState()
vtkSmartPointer< vtkSMProxy > Proxy
std::map< std::string, vtkSmartPointer< vtkSMLink > > LinkType