NOMAD Source  Version 4.0.0 Beta
AttributeFactory.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------------*/
2 /* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct Search - */
3 /* */
4 /* NOMAD - Version 4.0.0 has been created by */
5 /* Viviane Rochon Montplaisir - Polytechnique Montreal */
6 /* Christophe Tribes - Polytechnique Montreal */
7 /* */
8 /* The copyright of NOMAD - version 4.0.0 is owned by */
9 /* Charles Audet - Polytechnique Montreal */
10 /* Sebastien Le Digabel - Polytechnique Montreal */
11 /* Viviane Rochon Montplaisir - Polytechnique Montreal */
12 /* Christophe Tribes - Polytechnique Montreal */
13 /* */
14 /* NOMAD v4 has been funded by Rio Tinto, Hydro-Québec, NSERC (Natural */
15 /* Sciences and Engineering Research Council of Canada), InnovÉÉ (Innovation */
16 /* en Énergie Électrique) and IVADO (The Institute for Data Valorization) */
17 /* */
18 /* NOMAD v3 was created and developed by Charles Audet, Sebastien Le Digabel, */
19 /* Christophe Tribes and Viviane Rochon Montplaisir and was funded by AFOSR */
20 /* and Exxon Mobil. */
21 /* */
22 /* NOMAD v1 and v2 were created and developed by Mark Abramson, Charles Audet, */
23 /* Gilles Couture, and John E. Dennis Jr., and were funded by AFOSR and */
24 /* Exxon Mobil. */
25 /* */
26 /* Contact information: */
27 /* Polytechnique Montreal - GERAD */
28 /* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */
29 /* e-mail: nomad@gerad.ca */
30 /* */
31 /* This program is free software: you can redistribute it and/or modify it */
32 /* under the terms of the GNU Lesser General Public License as published by */
33 /* the Free Software Foundation, either version 3 of the License, or (at your */
34 /* option) any later version. */
35 /* */
36 /* This program is distributed in the hope that it will be useful, but WITHOUT */
37 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
38 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */
39 /* for more details. */
40 /* */
41 /* You should have received a copy of the GNU Lesser General Public License */
42 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
43 /* */
44 /* You can find information on the NOMAD software at www.gerad.ca/nomad */
45 /*---------------------------------------------------------------------------------*/
46 //
47 // AttributeFactory.hpp
48 // nomad
49 //
50 // Created by Christophe Tribes on 2017-12-08.
51 // Copyright (c) 2017 GERAD. All rights reserved.
52 //
53 
54 #ifndef __NOMAD400_ATTRIBUTEFACTORY__
55 #define __NOMAD400_ATTRIBUTEFACTORY__
56 
57 #include "../Param/TypeAttribute.hpp"
58 
59 #include "../nomad_nsbegin.hpp"
60 
61 
62 /// Factory to make Attribute with a variable number of arguments passed to the Create function.
63 /**
64  The Parameters::registerAttribute is in charge of calling the Create function.
65  */
67 
68 public:
69 
70  template <typename T, typename ... ARGS> std::shared_ptr<Attribute> Create(std::string Name,
71  T initValue,
72  bool algoCompatibilityCheck,
73  bool restartAttribute,
74  bool uniqueEntry,
75  ARGS && ... infoArgs )
76  {
77  return std::make_shared<TypeAttribute<T>>(Name,
78  initValue,
79  algoCompatibilityCheck,
80  restartAttribute,
81  uniqueEntry,
82  std::forward<ARGS>(infoArgs)...);
83 
84  }
85 
86 };
87 
88 #include "../nomad_nsend.hpp"
89 #endif // __NOMAD400_ATTRIBUTEFACTORY__
AttributeFactory::Create
std::shared_ptr< Attribute > Create(std::string Name, T initValue, bool algoCompatibilityCheck, bool restartAttribute, bool uniqueEntry, ARGS &&... infoArgs)
Definition: AttributeFactory.hpp:70
AttributeFactory
Factory to make Attribute with a variable number of arguments passed to the Create function.
Definition: AttributeFactory.hpp:66