Debian Codegraph @

src/internal/type-relations.h

raw symbols SCIP
1 /*
2 * %injeqt copyright begin%
3 * Copyright 2014 Rafał Malinowski ([email protected])
4 * %injeqt copyright end%
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #pragma once
22
23 #include <injeqt/injeqt.h>cxx . . $ `<file>/include/injeqt/injeqt.h`/
24
25 #include "implemented-by-mapping.h"cxx . . $ `<file>/src/internal/implemented-by-mapping.h`/
26 #include "internal.h"cxx . . $ `<file>/src/internal/internal.h`/
27 #include "types.h"cxx . . $ `<file>/src/internal/types.h`/
28
29 /**
30 * @file
31 * @brief Contains classes and functions for defining relations between Injeqt types.
32 */
33
34 namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ {
35
36 /**
37 * @brief Defines relations between Injeqt types.
38 * @see make_type_relations(const std::vector<type> &) to learn about alghoritm
39 *
40 * This class is used in model to compute relations between all injeqt types and in
41 * make_validated_dependencies(const type &) to check if there is ambiguity between dependencies
42 * of a type. If a type configured in module lands in ambiguous() set then whole injector
43 * conifguration is considered invalid.
44 *
45 * To create object of this type use make_type_relations(const std::vector<type> &) to ensure that
46 * it is valid.
47 */
48 class INJEQT_INTERNAL_APIcxx . . $ `src/internal/internal.h:26:9`! type_relationscxx . . $ injeqt/internal/type_relations# final
49 {
50
51 public:
52 /**
53 * @brief Create empty type_relations object.
54 */
55 type_relationscxx . . $ injeqt/internal/type_relations#type_relations(49f6e7a06ebc5aa8).();
56
57 /**
58 * @brief Create new type_relations object.
59 * @param unique unique mappings
60 * @param ambiguous set of ambiguous types
61 *
62 * This constructor does not check for validity of data. Use make_type_relations(const std::vector<type> &)
63 * factory function to ensure that data is valid.
64 */
65 explicit type_relationscxx . . $ injeqt/internal/type_relations#type_relations(a71c920939daffde).(implemented_by_mappingcxx . . $ injeqt/internal/implemented_by_mapping# unique, typescxx . . $ injeqt/internal/types# ambiguous);
66
67 /**
68 * @return mappings of unique types.
69 */
70 const implemented_by_mappingcxx . . $ injeqt/internal/implemented_by_mapping# & uniquecxx . . $ injeqt/internal/type_relations#unique(f204e9055a5335f3).() const;
71
72 /**
73 * @return set of ambiguous types.
74 */
75 const typescxx . . $ injeqt/internal/types# & ambiguouscxx . . $ injeqt/internal/type_relations#ambiguous(e96f08e6bae3c6ec).() const;
76
77 private:
78 implemented_by_mappingcxx . . $ injeqt/internal/implemented_by_mapping# _uniquecxx . . $ injeqt/internal/type_relations#_unique.;
79 typescxx . . $ injeqt/internal/types# _ambiguouscxx . . $ injeqt/internal/type_relations#_ambiguous.;
80
81 };
82
83 /**
84 * @brief Create valid type_relations from list of types.
85 * @param main_types list of types to create relations from
86 *
87 * Each type T from main_types has set of base types (that can be empty) - it consists of all
88 * base types between T (including) and QObject (excluding). All types that are unique in set
89 * are added to unique() set of result object as implemented_by object with interface_type set
90 * to this base type and implementation_type set to T. All non unique types are added to
91 * ambiguous() set of result object.
92 */
93 INJEQT_INTERNAL_APIcxx . . $ `src/internal/internal.h:26:9`! type_relationscxx . . $ injeqt/internal/type_relations# make_type_relationscxx . . $ injeqt/internal/make_type_relations(c4fcecab799fa482).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<typecxx . . $ injeqt/v1/type#> &main_types);
94
95 /**
96 * @brief Check if relations do not have ambiguous types for provided types.
97 * @param types types to check
98 * @param relations relations to check
99 * @throw ambiguous_types if @p relations contains ambiguous types from set of @p types
100 */
101 INJEQT_INTERNAL_APIcxx . . $ `src/internal/internal.h:26:9`! void validate_non_ambiguouscxx . . $ injeqt/internal/validate_non_ambiguous(cc2d613cdd36498c).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<typecxx . . $ injeqt/v1/type#> &types, const type_relationscxx . . $ injeqt/internal/type_relations# &relations);
102
103 }}