OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
SelectionHandler.h
Go to the documentation of this file.
1#pragma once
2#include <list>
3#include <atomic>
4#include <string>
5#include <map>
6#include <mutex>
7
8#include "OTCore/CoreTypes.h"
9
10
12{
13public:
14 SelectionHandler() = default;
15 ~SelectionHandler() = default;
16
17 //The handler may be processing some notification in another thread. Moving or copying a thread state is not recommendable
18 SelectionHandler(const SelectionHandler& _other) = delete;
22
23 void processSelectionChanged(const std::list<ot::UID>& _selectedEntityIDs, const std::list<ot::UID>& _selectedVisibleEntityIDs);
24 const std::atomic_bool& notificationInProcess() { return m_modelSelectionChangedNotificationInProgress; }
26 void clearAllBuffer();
27 void deselectEntity(ot::UID _entityID, const std::string& _owner);
28
29 const std::list<ot::UID>& getSelectedEntityIDs();
30 const std::list<ot::UID>& getSelectedVisibleEntityIDs();
31
32private:
33 std::atomic_bool m_modelSelectionChangedNotificationInProgress = false;
34 std::mutex m_changeSelectedEntitiesBuffer;
35
36 std::map<std::string,ot::UIDList> m_ownersWithSelection;
37 std::list<ot::UID> m_selectedEntityIDs;
38 std::list<ot::UID> m_selectedVisibleEntityIDs;
39
40 void toggleButtonEnabledState();
41 bool anyMaterialItemSelected();
42 void notifyOwners();
43 void notifyOwnerThread(const std::map<std::string, std::list<ot::UID>>& _ownerEntityListMap);
44
45 void setSelectedEntityIDs(const std::list<ot::UID>& _selectedEntityIDs, const std::list<ot::UID>& _selectedVisibleEntityIDs);
46};
Definition SelectionHandler.h:12
SelectionHandler(SelectionHandler &&_other)=delete
void clearAllBuffer()
Definition SelectionHandler.cpp:26
void clearAllBufferAndNotify()
Definition SelectionHandler.cpp:20
void processSelectionChanged(const std::list< ot::UID > &_selectedEntityIDs, const std::list< ot::UID > &_selectedVisibleEntityIDs)
Definition SelectionHandler.cpp:8
const std::list< ot::UID > & getSelectedVisibleEntityIDs()
Definition SelectionHandler.cpp:57
SelectionHandler(const SelectionHandler &_other)=delete
SelectionHandler & operator=(SelectionHandler &&_other)=delete
const std::atomic_bool & notificationInProcess()
Definition SelectionHandler.h:24
SelectionHandler()=default
const std::list< ot::UID > & getSelectedEntityIDs()
Definition SelectionHandler.cpp:51
SelectionHandler & operator=(const SelectionHandler &_other)=delete
void deselectEntity(ot::UID _entityID, const std::string &_owner)
Definition SelectionHandler.cpp:33
~SelectionHandler()=default
unsigned long UID
Unique identifier (32 bit unsigned integer)
Definition CoreTypes.h:27