2 * Copyright 2015, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
15 #include <ObjectList.h>
24 virtual ~QueryListener();
25 virtual void EntryCreated(QueryList
& source
,
26 const entry_ref
& ref
, ino_t node
) = 0;
27 virtual void EntryRemoved(QueryList
& source
,
28 const node_ref
& nodeRef
) = 0;
32 typedef std::map
<node_ref
, entry_ref
> RefMap
;
35 class QueryList
: public BHandler
, public BLocker
{
40 status_t
Init(const char* predicate
,
41 BVolume
* volume
= NULL
);
43 void AddListener(QueryListener
* listener
);
44 void RemoveListener(QueryListener
* listener
);
46 const RefMap
& Entries() const
49 virtual void MessageReceived(BMessage
* message
);
52 void _AddEntry(const entry_ref
& ref
, ino_t node
);
53 void _RemoveEntry(const node_ref
& nodeRef
);
54 void _NotifyEntryCreated(const entry_ref
& ref
,
56 void _NotifyEntryRemoved(const node_ref
& nodeRef
);
57 void _AddVolume(BVolume
& volume
,
58 const char* predicate
);
60 static status_t
_FetchQuery(void* self
);
61 status_t
_FetchQuery();
64 typedef std::vector
<thread_id
> ThreadVector
;
65 typedef std::vector
<BQuery
*> QueryVector
;
70 QueryVector fQueryQueue
;
71 ThreadVector fFetchThreads
;
72 BObjectList
<QueryListener
> fListeners
;
76 #endif // QUERY_LIST_H