EMANE  1.2.1
configurationregistrar.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2014,2016 - Adjacent Link LLC, Bridgewater, New
3  * Jersey
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Adjacent Link LLC nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef EMANECONFIGURATIONREGISTRAR_HEADER_
35 #define EMANECONFIGURATIONREGISTRAR_HEADER_
36 
40 #include "emane/any.h"
41 
42 #include <initializer_list>
43 #include <string>
44 #include <limits>
45 
46 namespace EMANE
47 {
57  {
58  public:
62  virtual ~ConfigurationRegistrar();
63 
80  template<typename T>
81  void registerNumeric(const std::string & sName,
83  const std::initializer_list<T> & values = {},
84  const std::string & sUsage = "",
85  T minValue = std::numeric_limits<T>::lowest(),
86  T maxValue = std::numeric_limits<T>::max(),
87  std::size_t minOccurs = 1,
88  std::size_t maxOccurs = 1,
89  const std::string & sRegexPattern = {});
104  template<typename T>
105  void registerNonNumeric(const std::string & sName,
107  const std::initializer_list<T> & values = {},
108  const std::string & sUsage = "",
109  std::size_t minOccurs = 1,
110  std::size_t maxOccurs = 1,
111  const std::string & sRegexPattern = {});
112 
128  virtual void registerValidator(ConfigurationValidator validator) = 0;
129 
130  protected:
132 
150  virtual void registerNumericAny(const std::string & sName,
151  Any::Type type,
152  const ConfigurationProperties & properties,
153  const std::vector<Any> & values,
154  const std::string & sUsage,
155  const Any & minValue,
156  const Any & maxValue,
157  std::size_t minOccurs,
158  std::size_t maxOccurs,
159  const std::string & sRegexPattern = {}) = 0;
160 
176  virtual void registerNonNumericAny(const std::string & sName,
177  Any::Type type,
178  const ConfigurationProperties & properties,
179  const std::vector<Any> & values,
180  const std::string & sUsage,
181  std::size_t minOccurs,
182  std::size_t maxOccurs,
183  const std::string & sRegexPattern = {}) = 0;
184 
185  };
186 }
187 
189 
190 #endif //EMANECONFIGURATIONREGISTRAR_HEADER_
191 
Type
Definition: any.h:52
void registerNonNumeric(const std::string &sName, const ConfigurationProperties &properties=ConfigurationProperties::NONE, const std::initializer_list< T > &values={}, const std::string &sUsage="", std::size_t minOccurs=1, std::size_t maxOccurs=1, const std::string &sRegexPattern={})
virtual void registerValidator(ConfigurationValidator validator)=0
virtual void registerNonNumericAny(const std::string &sName, Any::Type type, const ConfigurationProperties &properties, const std::vector< Any > &values, const std::string &sUsage, std::size_t minOccurs, std::size_t maxOccurs, const std::string &sRegexPattern={})=0
The ConfigurationRegistrar allows NEM layers to register the configuration items they require...
virtual void registerNumericAny(const std::string &sName, Any::Type type, const ConfigurationProperties &properties, const std::vector< Any > &values, const std::string &sUsage, const Any &minValue, const Any &maxValue, std::size_t minOccurs, std::size_t maxOccurs, const std::string &sRegexPattern={})=0
void registerNumeric(const std::string &sName, const ConfigurationProperties &properties=ConfigurationProperties::NONE, const std::initializer_list< T > &values={}, const std::string &sUsage="", T minValue=std::numeric_limits< T >::lowest(), T maxValue=std::numeric_limits< T >::max(), std::size_t minOccurs=1, std::size_t maxOccurs=1, const std::string &sRegexPattern={})
std::function< std::pair< std::string, bool >(const ConfigurationUpdate &update) noexcept > ConfigurationValidator
The Any class can contain an instance of one of any type in its support type set. ...
Definition: any.h:49
Definition: agent.h:43