32 CollectionInterfacePrx entityCollection,
36 PersistentProfilerDataSegmentBase()
40 ProfilerEntityBaseList
41 PersistentProfilerDataSegment::getProfilerDataEntities(
const Ice::Current&)
const
43 ProfilerEntityBaseList entities;
45 for (
const auto& entity : getAllEntities())
47 if (entity->ice_isA(ProfilerEntityBase::ice_staticId()))
49 entities.push_back(ProfilerEntityBasePtr::dynamicCast(entity));
59 ProfilerEventBaseList entities;
63 if (entity->ice_isA(ProfilerEventBase::ice_staticId()))
65 entities.push_back(ProfilerEventBasePtr::dynamicCast(entity));
72 ProfilerTransitionBaseList
75 ProfilerTransitionBaseList entities;
77 for (
const auto& entity : getAllEntities())
79 if (entity->ice_isA(ProfilerTransitionBase::ice_staticId()))
81 entities.push_back(ProfilerTransitionBasePtr::dynamicCast(entity));
87 ProfilerMemorySnapshotBaseList
90 ProfilerMemorySnapshotBaseList entities;
94 if (entity->ice_isA(ProfilerMemorySnapshotBase::ice_staticId()))
96 entities.push_back(ProfilerMemorySnapshotBasePtr::dynamicCast(entity));
103 ProfilerProcessBaseList
106 ProfilerProcessBaseList entities;
110 if (entity->ice_isA(ProfilerProcessBase::ice_staticId()))
112 entities.push_back(ProfilerProcessBasePtr::dynamicCast(entity));
119 ProfilerMemoryUsageBaseList
122 ProfilerMemoryUsageBaseList entities;
126 if (entity->ice_isA(ProfilerMemoryUsageBase::ice_staticId()))
128 entities.push_back(ProfilerMemoryUsageBasePtr::dynamicCast(entity));
137 const ProfilerMemorySnapshotBasePtr& memorySnapshot,
144 memorySnapshot, entities);
146 if (entityId.empty())
155 const ProfilerTransitionBasePtr& transition,
160 std::string entityId =
162 transition, transitionEntities);
163 if (entityId.empty())
171 ProfilerTransitionBasePtr entity =
172 ProfilerTransitionBasePtr::dynamicCast(
getEntityById(entityId));
173 entity->setCount(entity->getCount() + 1);
179 template <
typename T>
182 const std::vector<T>& entities)
184 std::string entityId(
"");
185 if (entities.empty())
190 auto entityIterator = std::find_if(entities.begin(),
192 [&entity](EntityBasePtr current)
193 { return entity->equalsAttributes(current); });
194 if (entityIterator != entities.end())
196 entityId = (*entityIterator)->getId();
The PersistentEntitySegment class is the base class for all memory segments containing memoryx::Entit...
std::string addEntity(const EntityBasePtr &entity, const ::Ice::Current &c=Ice::emptyCurrent) override
addEntity add new entity and return the newly generated entity ID
EntityBasePtr getEntityById(const ::std::string &entityId, const ::Ice::Current &=Ice::emptyCurrent) const override
EntityBaseList getEntitiesByAttrValue(const ::std::string &attrName, const ::std::string &attrValue, const ::Ice::Current &=Ice::emptyCurrent) const override
EntityBaseList getAllEntities(const ::Ice::Current &=Ice::emptyCurrent) const override
getAllEntities returns a list of all entities managed by this memory segment
void updateEntity(const ::std::string &entityId, const EntityBasePtr &update, const ::Ice::Current &=Ice::emptyCurrent) override
static std::string GetEntityIdFromList(const EntityBasePtr &entity, const std::vector< T > &entities)
ProfilerProcessBaseList getProfilerProcessCpuUsageEntities(const Ice::Current &=Ice::emptyCurrent) const override
ProfilerEventBaseList getProfilerEventEntities(const Ice::Current &=Ice::emptyCurrent) const override
ProfilerMemoryUsageBaseList getProfilerMemoryUsageBaseEntities(const Ice::Current &=Ice::emptyCurrent) const override
std::string saveOrUpdateTransition(const ProfilerTransitionBasePtr &transition, const Ice::Current &=Ice::emptyCurrent) override
saveOrUpdateTransition if the ProfilerTransition already exists, the count() of it is increased,...
ProfilerMemorySnapshotBaseList getProfilerMemorySnapshotEntities(const Ice::Current &=Ice::emptyCurrent) const override
PersistentProfilerDataSegment(CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds=true)
ProfilerTransitionBaseList getProfilerTransitionEntities(const Ice::Current &=Ice::emptyCurrent) const override
std::string saveUniqueMemorySnapshot(const ProfilerMemorySnapshotBasePtr &memorySnapshot, const Ice::Current &=Ice::emptyCurrent) override
saveUniqueMemorySnapshot checks if memorySnaphsot already exists in the segment and creates it otherw...
static const std::string ATTRIBUTE_STATENAME
::IceInternal::Handle<::Ice::Communicator > CommunicatorPtr