| 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 | #include <injeqt/type.h>cxx . . $ `<file>/include/injeqt/type.h`/ |
| 25 | |
| 26 | #include "provider.h"cxx . . $ `<file>/src/internal/provider.h`/ |
| 27 | #include "sorted-unique-vector.h"cxx . . $ `<file>/src/internal/sorted-unique-vector.h`/ |
| 28 | |
| 29 | #include <memory> |
| 30 | |
| 31 | /** |
| 32 | * @file |
| 33 | * @brief Contains classes and functions for representing set of Injeqt providers sorted by provider::provided_type(). |
| 34 | */ |
| 35 | |
| 36 | namespace injeqtcxx . . $ injeqt/ { namespace internalcxx . . $ injeqt/internal/ { |
| 37 | |
| 38 | /** |
| 39 | * @brief Extract provided_type from pointer to provider for storting purposes. |
| 40 | */ |
| 41 | inline typecxx . . $ injeqt/v1/type# type_from_providercxx . . $ injeqt/internal/type_from_provider(ac0d57febace0029).(const stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#> &c) |
| 42 | { |
| 43 | return c->cxx . . $ std/unique_ptr#`operator->`(ca399b2b6292c808).provided_typecxx . . $ injeqt/internal/provider#provided_type(7e9f7f4e42b3414e).(); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @brief Abstraction of Injeqt set of providers. |
| 48 | * |
| 49 | * As provider is an abstract class it stores set of pointers to it. |
| 50 | * |
| 51 | * This set is used to represent all providers available to module and injector. It is |
| 52 | * not possible to store two providers with the same provider::provided_type() values in it. |
| 53 | * Set is sorted by provider::provided_type(). |
| 54 | */ |
| 55 | using providerscxx . . $ injeqt/internal/providers# = sorted_unique_vectorcxx . . $ injeqt/internal/sorted_unique_vector#<typecxx . . $ injeqt/v1/type#, stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<providercxx . . $ injeqt/internal/provider#>, type_from_providercxx . . $ injeqt/internal/type_from_provider(ac0d57febace0029).>; |
| 56 | |
| 57 | }} |