acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
aaa_update.h
1#pragma once
2
3
4//CLASS_DECL_ACME ::i32 os_get_system_update_poll_time(::i64 iUpdate);
5
6using update_map = map < ::pointer<matter> ::pointer<::update_item>>
7
8class CLASS_DECL_ACME update :
9 virtual public ::object
10{
11protected:
12
13 friend class matter;
14 friend class ::acme::acme;
15
16 static ::pointer<update> get(const ::atom & atom);
17
18 virtual void add(::matter* pmatter);
19 virtual void erase(::matter* pmatter);
20
21 static void _add(const :: atom & atom, ::matter* pmatter);
22
23 static void _erase(const ::atom& atom, ::matter* pmatter);
24
25 static void _erase(::matter* pmatter);
26
27 static ::critical_section* g_pcs;
28 static ::atom_map < ::pointer<update >> g_pmap;
29 static bool g_bDestroyAll;
30
31
32
33public:
34
35
36 ::atom id();
37 bool m_bRet;
38 ::pointer<::layered> m_psender;
39 ::pointer<::layered> m_pobjectTopic;
40 ::action_context m_actioncontext;
41 ::update_map m_map;
42 ::pointer<::layered> m_puserinteraction; // user::interaction
43 ::pointer<::layered> m_pcontrolevent; // user::control_event
44 ::pointer<::file::item> m_pfileitem;
45 //::pointer<::u> m_pupdatetask;
46 ::i64 m_iUpdateSerial;
47 ::user::enum_key m_ekey;
48 ::payload m_var;
49 bool m_bModified;
50 ::i32 m_iMillisSleep;
51 //::i64 m_iUpdate;
52 //::i64 m_iSerial;
53
54
55 update();
56 update(const ::atom & atom);
57 virtual ~update();
58
59
60 virtual void notify();
61
62
63 static void set_modified(const ::atom& atom);
64
65
66
67 virtual void run() override;
68
69 static void post_destroy_all();
70
71 inline bool is_ending() { synchronous_lock synchronouslock(this->synchronization(), DEFAULT_SYNCHRONOUS_LOCK_SUFFIX); return m_map.is_empty(); };
72 inline ::i32 poll_millis() { return os_get_system_update_poll_time(m_iUpdateSerial); };
73
74 static inline bool should_poll(::i32 iMillis)
75 {
76
77 return iMillis >= 100;
78
79 }
80
81
82 //update();
83 //virtual ~update();
84
85
86 ::update& operator =(const ::atom& atom) { id() = atom; return *this; }
87 inline bool operator ==(const ::atom& atom) const { return id() == atom || id() == FULL_ID; }
88
89 //void set_handled_by(const ::particle * pparticle) { m_handledbya.add((::matter*) pparticle); }
90 //bool handled_by(const ::particle * pparticle) const { return m_handledbya.has((::matter*) pparticle); }
91
92
93
94};
95
96
97using manager_pointer = ::pointer<::update>
98
99
100inline auto new_update(const ::atom & atom) { return allocateø ::update(atom); }
101
Definition atom.h:237
Definition bbb_object.h:11