16 #ifndef vtkSMProxyManagerInternals_h 17 #define vtkSMProxyManagerInternals_h 41 #include <vtksys/RegularExpression.hxx> 60 ret->InitializeObjectBase();
67 this->ModifiedObserverTag = 0;
68 this->StateChangedObserverTag = 0;
69 this->UpdateObserverTag = 0;
70 this->UpdateInformationObserverTag = 0;
75 if (this->ModifiedObserverTag && this->Proxy.
GetPointer())
78 this->ModifiedObserverTag = 0;
80 if (this->StateChangedObserverTag && this->Proxy.
GetPointer())
83 this->StateChangedObserverTag = 0;
85 if (this->UpdateObserverTag && this->Proxy.
GetPointer())
88 this->UpdateObserverTag = 0;
90 if (this->UpdateInformationObserverTag && this->Proxy.
GetPointer())
93 this->UpdateInformationObserverTag = 0;
100 :
public std::vector<vtkSmartPointer<vtkSMProxyManagerProxyInfo> >
106 vtkSMProxyManagerProxyListType::iterator iter = this->begin();
107 for (; iter != this->end(); ++iter)
109 if (iter->GetPointer()->Proxy == proxy)
118 vtkSMProxyManagerProxyListType::iterator iter = this->begin();
119 for (; iter != this->end(); ++iter)
121 if (iter->GetPointer()->Proxy.GetPointer() == proxy)
150 return this->Group == other.
Group && this->Name == other.
Name &&
162 return this->Name < other.
Name;
166 return this->Group < other.
Group;
179 return this->Name > other.
Name;
183 return this->Group > other.
Group;
206 typedef std::map<vtkStdString, vtkSmartPointer<vtkSMLink> >
LinkType;
222 std::set<vtkSMProxyManagerEntry>::iterator iter;
223 iter = this->RegisteredProxyTuple.begin();
224 while (iter != this->RegisteredProxyTuple.end())
226 if (iter->Proxy == proxy)
228 tuplesFounds.insert(*iter);
236 std::set<vtkSMProxyManagerEntry>& toRegister, std::set<vtkSMProxyManagerEntry>& toUnregister)
239 std::set<vtkSMProxyManagerEntry> newStateContent;
240 int max = newState->ExtensionSize(PXMRegistrationState::registered_proxy);
241 for (
int cc = 0; cc <
max; cc++)
243 PXMRegistrationState_Entry reg =
244 newState->GetExtension(PXMRegistrationState::registered_proxy, cc);
248 newStateContent.insert(
258 std::set<vtkSMProxyManagerEntry>::iterator iter;
259 iter = newStateContent.begin();
260 while (iter != newStateContent.end())
262 if (this->RegisteredProxyTuple.find(*iter) == this->RegisteredProxyTuple.end())
264 toRegister.insert(*iter);
270 iter = this->RegisteredProxyTuple.begin();
271 vtksys::RegularExpression prototypesRe(
"_prototypes$");
272 while (iter != this->RegisteredProxyTuple.end())
274 if (newStateContent.find(*iter) == newStateContent.end() &&
275 !prototypesRe.find(iter->Group.c_str()))
277 toUnregister.insert(*iter);
284 void RemoveTuples(
const char* name, std::set<vtkSMProxyManagerEntry>& removedEntries)
287 std::string nameString =
name;
291 std::set<vtkSMProxyManagerEntry>::iterator iter;
292 iter = this->RegisteredProxyTuple.begin();
293 while (iter != this->RegisteredProxyTuple.end())
295 if (iter->Name != nameString)
297 resultSet.insert(*iter);
301 this->RegisteredProxyTuple = resultSet;
304 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
305 this->RegisteredProxyMap.begin();
306 for (; it != this->RegisteredProxyMap.end(); it++)
308 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(
name);
309 if (it2 != it->second.end())
317 backup.CopyFrom(this->State);
318 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
319 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
320 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
322 const PXMRegistrationState_Entry* reg =
323 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
325 if (reg->name() != nameString)
327 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
334 std::set<vtkSMProxyManagerEntry>& removedEntries,
bool doMapOnly)
337 std::string groupString = group;
338 std::string nameString =
name;
344 std::set<vtkSMProxyManagerEntry>::iterator iter;
345 iter = this->RegisteredProxyTuple.begin();
346 while (iter != this->RegisteredProxyTuple.end())
348 if (iter->Group != groupString || iter->Name != nameString)
350 resultSet.insert(*iter);
354 this->RegisteredProxyTuple = resultSet;
358 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
359 this->RegisteredProxyMap.find(group);
360 if (it != this->RegisteredProxyMap.end())
362 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(
name);
363 if (it2 != it->second.end())
365 vtkSMProxyManagerProxyListType::iterator it3 = it2->second.begin();
366 while (it3 != it2->second.end())
371 it->second.erase(it2);
376 vtksys::RegularExpression prototypesRe(
"_prototypes$");
377 if (!doMapOnly && !prototypesRe.find(group))
380 backup.CopyFrom(this->State);
381 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
382 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
383 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
385 const PXMRegistrationState_Entry* reg =
386 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
388 if (reg->group() != groupString || reg->name() != nameString)
390 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
401 std::string groupString = group;
402 std::string nameString =
name;
411 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
412 this->RegisteredProxyMap.find(group);
413 if (it != this->RegisteredProxyMap.end())
415 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(
name);
416 if (it2 != it->second.end())
418 vtkSMProxyManagerProxyListType::iterator it3 = it2->second.Find(proxy);
419 if (it3 != it2->second.end())
422 it2->second.erase(it3);
424 if (it2->second.size() == 0)
426 it->second.erase(it2);
432 vtksys::RegularExpression prototypesRe(
"_prototypes$");
433 if (!prototypesRe.find(group))
436 backup.CopyFrom(this->State);
438 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
439 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
441 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
443 const PXMRegistrationState_Entry* reg =
444 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
446 if (reg->group() == groupString && reg->name() == nameString &&
454 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
465 this->State.ClearExtension(PXMRegistrationState::registered_selection_model);
466 std::map<std::string, vtkSmartPointer<vtkSMProxySelectionModel> >::iterator iter;
467 for (iter = this->SelectionModels.begin(); iter != this->SelectionModels.end(); iter++)
469 PXMRegistrationState_Entry* selModel =
470 this->State.AddExtension(PXMRegistrationState::registered_selection_model);
471 selModel->set_name(iter->first);
472 selModel->set_global_id(iter->second->GetGlobalID());
478 this->State.ClearExtension(PXMRegistrationState::registered_link);
480 LinkType::iterator iter;
481 for (iter = this->RegisteredLinkMap.begin(); iter != this->RegisteredLinkMap.end(); iter++)
483 PXMRegistrationState_Entry* linkEntry =
484 this->State.AddExtension(PXMRegistrationState::registered_link);
485 linkEntry->set_name(iter->first);
486 linkEntry->set_global_id(iter->second->GetGlobalID());
bool operator>(const vtkSMProxyManagerEntry &other) const
std::map< vtkStdString, vtkSMProxyManagerProxyMapType > ProxyGroupType
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".
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
virtual vtkTypeUInt32 GetGlobalID()
Get the global unique id for this object.
void UpdateProxySelectionModelState()
vtkSmartPointer< vtkSMProxy > Proxy
std::map< vtkStdString, vtkSmartPointer< vtkSMLink > > LinkType