-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueries.hpp
97 lines (70 loc) · 2.23 KB
/
Queries.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
////////////////////////////////////////////////////////////////////////////////
//! \file Queries.hpp
//! \brief The Queries class declaration.
//! \author Chris Oldwood
// Check for previous inclusion
#ifndef APP_QUERIES_HPP
#define APP_QUERIES_HPP
#if _MSC_VER > 1000
#pragma once
#endif
#include "Query.hpp"
#include <XML/Document.hpp>
////////////////////////////////////////////////////////////////////////////////
//! The container of WMI queries to be executed when monitoring.
class Queries
{
private:
//! The type used to store the collection of queries.
typedef std::vector<ConstQueryPtr> Collection;
public:
//! The const iterator type.
typedef Collection::const_iterator const_iterator;
//! Default constructor.
Queries();
//! Destructor.
~Queries();
//
// Properties.
//
//! Get the number of queries.
size_t size() const;
//! Get the query at a given position.
const ConstQueryPtr& query(size_t index) const;
//! Has the collection of queries been modified?
bool isModified() const;
//! Get the collection start iterator.
const_iterator begin() const;
//! Get the collection end iterator.
const_iterator end() const;
//
// Methods.
//
//! Add a query to the collection.
void append(ConstQueryPtr query);
//! Add a sequence of queries to the collection.
void append(const ConstQueryPtr* begin, const ConstQueryPtr* end);
//! Replace a query in the collection.
void replace(size_t index, ConstQueryPtr query);
//! Remove a query from the collection.
void remove(size_t index);
//! Swap two queries in the collection by index.
void swap(size_t first, size_t second);
//! Load the set of queries from the XML document.
void load(const XML::DocumentPtr config);
//! Save the set of queries to the XML document.
void save(XML::DocumentPtr config);
//! Create a deep copy of another collection.
void deepCopy(const Queries& rhs);
//! Replace the entire collection with another.
void replaceAll(const Queries& rhs);
private:
//
// Members.
//
bool m_modified; //!< Has the collection been modified?
Collection m_queries; //!< The collection of queries to execute.
//! Create a deep copy of another collection.
void deepCopy(const Queries& rhs, bool modified);
};
#endif // APP_QUERIES_HPP