16 #ifndef vtkSMProxyManagerInternals_h 17 #define vtkSMProxyManagerInternals_h 40 #include <vtksys/RegularExpression.hxx> 59 ret->InitializeObjectBase();
66 this->ModifiedObserverTag = 0;
67 this->StateChangedObserverTag = 0;
68 this->UpdateObserverTag = 0;
69 this->UpdateInformationObserverTag = 0;
74 if (this->ModifiedObserverTag && this->Proxy.
GetPointer())
77 this->ModifiedObserverTag = 0;
79 if (this->StateChangedObserverTag && this->Proxy.
GetPointer())
82 this->StateChangedObserverTag = 0;
84 if (this->UpdateObserverTag && this->Proxy.
GetPointer())
87 this->UpdateObserverTag = 0;
89 if (this->UpdateInformationObserverTag && this->Proxy.
GetPointer())
92 this->UpdateInformationObserverTag = 0;
99 :
public std::vector<vtkSmartPointer<vtkSMProxyManagerProxyInfo> >
105 vtkSMProxyManagerProxyListType::iterator iter = this->begin();
106 for (; iter != this->end(); ++iter)
108 if (iter->GetPointer()->Proxy == proxy)
117 vtkSMProxyManagerProxyListType::iterator iter = this->begin();
118 for (; iter != this->end(); ++iter)
120 if (iter->GetPointer()->Proxy.GetPointer() == proxy)
149 return this->Group == other.
Group && this->Name == other.
Name &&
161 return this->Name < other.
Name;
165 return this->Group < other.
Group;
178 return this->Name > other.
Name;
182 return this->Group > other.
Group;
205 typedef std::map<std::string, vtkSmartPointer<vtkSMLink> >
LinkType;
221 std::set<vtkSMProxyManagerEntry>::iterator iter;
222 iter = this->RegisteredProxyTuple.begin();
223 while (iter != this->RegisteredProxyTuple.end())
225 if (iter->Proxy == proxy)
227 tuplesFounds.insert(*iter);
235 std::set<vtkSMProxyManagerEntry>& toRegister, std::set<vtkSMProxyManagerEntry>& toUnregister)
238 std::set<vtkSMProxyManagerEntry> newStateContent;
239 int max = newState->ExtensionSize(PXMRegistrationState::registered_proxy);
240 for (
int cc = 0; cc < max; cc++)
242 PXMRegistrationState_Entry reg =
243 newState->GetExtension(PXMRegistrationState::registered_proxy, cc);
247 newStateContent.insert(
257 std::set<vtkSMProxyManagerEntry>::iterator iter;
258 iter = newStateContent.begin();
259 while (iter != newStateContent.end())
261 if (this->RegisteredProxyTuple.find(*iter) == this->RegisteredProxyTuple.end())
263 toRegister.insert(*iter);
269 iter = this->RegisteredProxyTuple.begin();
270 vtksys::RegularExpression prototypesRe(
"_prototypes$");
271 while (iter != this->RegisteredProxyTuple.end())
273 if (newStateContent.find(*iter) == newStateContent.end() &&
274 !prototypesRe.find(iter->Group.c_str()))
276 toUnregister.insert(*iter);
283 void RemoveTuples(
const char* name, std::set<vtkSMProxyManagerEntry>& removedEntries)
286 std::string nameString = name;
289 GroupNameProxySet resultSet;
290 std::set<vtkSMProxyManagerEntry>::iterator iter;
291 iter = this->RegisteredProxyTuple.begin();
292 while (iter != this->RegisteredProxyTuple.end())
294 if (iter->Name != nameString)
296 resultSet.insert(*iter);
300 this->RegisteredProxyTuple = resultSet;
303 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
304 this->RegisteredProxyMap.begin();
305 for (; it != this->RegisteredProxyMap.end(); it++)
307 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(name);
308 if (it2 != it->second.end())
310 this->RemoveTuples(it->first.c_str(), name, removedEntries,
true);
316 backup.CopyFrom(this->State);
317 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
318 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
319 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
321 const PXMRegistrationState_Entry* reg =
322 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
324 if (reg->name() != nameString)
326 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
333 std::set<vtkSMProxyManagerEntry>& removedEntries,
bool doMapOnly)
336 std::string groupString = group;
337 std::string nameString = name;
342 GroupNameProxySet resultSet;
343 std::set<vtkSMProxyManagerEntry>::iterator iter;
344 iter = this->RegisteredProxyTuple.begin();
345 while (iter != this->RegisteredProxyTuple.end())
347 if (iter->Group != groupString || iter->Name != nameString)
349 resultSet.insert(*iter);
353 this->RegisteredProxyTuple = resultSet;
357 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
358 this->RegisteredProxyMap.find(group);
359 if (it != this->RegisteredProxyMap.end())
361 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(name);
362 if (it2 != it->second.end())
364 vtkSMProxyManagerProxyListType::iterator it3 = it2->second.begin();
365 while (it3 != it2->second.end())
370 it->second.erase(it2);
375 vtksys::RegularExpression prototypesRe(
"_prototypes$");
376 if (!doMapOnly && !prototypesRe.find(group))
379 backup.CopyFrom(this->State);
380 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
381 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
382 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
384 const PXMRegistrationState_Entry* reg =
385 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
387 if (reg->group() != groupString || reg->name() != nameString)
389 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
400 std::string groupString = group;
401 std::string nameString = name;
410 vtkSMSessionProxyManagerInternals::ProxyGroupType::iterator it =
411 this->RegisteredProxyMap.find(group);
412 if (it != this->RegisteredProxyMap.end())
414 vtkSMProxyManagerProxyMapType::iterator it2 = it->second.find(name);
415 if (it2 != it->second.end())
417 vtkSMProxyManagerProxyListType::iterator it3 = it2->second.Find(proxy);
418 if (it3 != it2->second.end())
421 it2->second.erase(it3);
423 if (it2->second.size() == 0)
425 it->second.erase(it2);
431 vtksys::RegularExpression prototypesRe(
"_prototypes$");
432 if (!prototypesRe.find(group))
435 backup.CopyFrom(this->State);
437 int nbRegisteredProxy = this->State.ExtensionSize(PXMRegistrationState::registered_proxy);
438 this->State.ClearExtension(PXMRegistrationState::registered_proxy);
440 for (
int cc = 0; cc < nbRegisteredProxy; ++cc)
442 const PXMRegistrationState_Entry* reg =
443 &backup.GetExtension(PXMRegistrationState::registered_proxy, cc);
445 if (reg->group() == groupString && reg->name() == nameString &&
453 this->State.AddExtension(PXMRegistrationState::registered_proxy)->CopyFrom(*reg);
464 this->State.ClearExtension(PXMRegistrationState::registered_selection_model);
465 std::map<std::string, vtkSmartPointer<vtkSMProxySelectionModel> >::iterator iter;
466 for (iter = this->SelectionModels.begin(); iter != this->SelectionModels.end(); iter++)
468 PXMRegistrationState_Entry* selModel =
469 this->State.AddExtension(PXMRegistrationState::registered_selection_model);
470 selModel->set_name(iter->first);
471 selModel->set_global_id(iter->second->GetGlobalID());
477 this->State.ClearExtension(PXMRegistrationState::registered_link);
479 LinkType::iterator iter;
480 for (iter = this->RegisteredLinkMap.begin(); iter != this->RegisteredLinkMap.end(); iter++)
482 PXMRegistrationState_Entry* linkEntry =
483 this->State.AddExtension(PXMRegistrationState::registered_link);
484 linkEntry->set_name(iter->first);
485 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".
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