Home | History | Annotate | Download | only in include
      1 /*
      2  * Copyright (c) 2015, Intel Corporation
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without modification,
      6  * are permitted provided that the following conditions are met:
      7  *
      8  * 1. Redistributions of source code must retain the above copyright notice, this
      9  * list of conditions and the following disclaimer.
     10  *
     11  * 2. Redistributions in binary form must reproduce the above copyright notice,
     12  * this list of conditions and the following disclaimer in the documentation and/or
     13  * other materials provided with the distribution.
     14  *
     15  * 3. Neither the name of the copyright holder nor the names of its contributors
     16  * may be used to endorse or promote products derived from this software without
     17  * specific prior written permission.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
     20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
     23  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     26  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 #pragma once
     31 
     32 #include <string>
     33 #include <list>
     34 #include <utility>
     35 
     36 namespace parameterFramework
     37 {
     38 
     39 /** Parameter Framework configuration. */
     40 struct Config
     41 {
     42     Config() = default;
     43 
     44     /** Emulate C named parameter.
     45      * { .instances = "fuu" } <=> { &Config::instances, "fuu" }
     46      * Passing multiple named parameters is not implemented. */
     47     template <class M, class T = M>
     48     Config(M(Config::*member), T &&value)
     49     {
     50         (this->*member) = std::forward<T>(value);
     51     }
     52 
     53     /** Mapping attribute of the test subsystem. */
     54     std::string subsystemMapping;
     55 
     56     /** Instances of the test subsystem.
     57      *
     58      * Content of the configuration
     59      * SystemClass/Subsystem[name=test]/InstanceDefinition xml node.
     60      */
     61     std::string instances;
     62     /** Content of the configuartion ConfigurableDomains xml node. */
     63     std::string domains;
     64     /** Content of the configuration SubsystemPlugins xml node. */
     65     std::string components;
     66 
     67     struct Plugin
     68     {
     69         using Location = std::string;
     70         using Name = std::string;
     71         /** Each plugin has a location and a path.
     72          *  Locations can be factorized by using */
     73         using Collection = std::list<std::pair<Location, std::list<Name>>>;
     74     };
     75     using Plugins = Plugin::Collection;
     76     Plugins plugins;
     77 
     78     /** Subsystem type. Virtual by default. */
     79     std::string subsystemType = "Virtual";
     80 };
     81 
     82 } // namespace parameterFramework
     83