1 // Copyright 2011 The Kyua Authors.
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of Google Inc. nor the names of its contributors
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 /// \file drivers/scan_results.hpp
30 /// Driver to scan the contents of a results file.
32 /// This driver module implements the logic to scan the contents of a results
33 /// file and to notify the presentation layer as soon as data becomes
34 /// available. This is to prevent reading all the data from the file at once,
35 /// which could take too much memory.
37 #if !defined(DRIVERS_SCAN_RESULTS_HPP)
38 #define DRIVERS_SCAN_RESULTS_HPP
46 #include "engine/filters.hpp"
47 #include "model/context_fwd.hpp"
48 #include "store/read_transaction_fwd.hpp"
49 #include "utils/datetime_fwd.hpp"
50 #include "utils/fs/path_fwd.hpp"
53 namespace scan_results {
56 /// Tuple containing the results of this driver.
59 /// Filters that did not match any available test case.
61 /// The presence of any filters here probably indicates a usage error. If a
62 /// test filter does not match any test case, it is probably a typo.
63 std::set< engine::test_filter > unused_filters;
65 /// Initializer for the tuple's fields.
67 /// \param unused_filters_ The filters that did not match any test case.
68 result(const std::set< engine::test_filter >& unused_filters_) :
69 unused_filters(unused_filters_)
75 /// Abstract definition of the hooks for this driver.
78 virtual ~base_hooks(void) = 0;
80 virtual void begin(void);
82 /// Callback executed when the context is loaded.
84 /// \param context The context loaded from the database.
85 virtual void got_context(const model::context& context) = 0;
87 /// Callback executed when a test results is found.
89 /// \param iter Container for the test result's data. Some of the data are
90 /// lazily fetched, hence why we receive the object instead of the
91 /// individual elements.
92 virtual void got_result(store::results_iterator& iter) = 0;
94 virtual void end(const result& r);
98 result drive(const utils::fs::path&, const std::set< engine::test_filter >&,
102 } // namespace scan_results
103 } // namespace drivers
105 #endif // !defined(DRIVERS_SCAN_RESULTS_HPP)