source: src/UIElements/CommandLineUI/TypeEnumContainer.cpp@ 23b6cf

Last change on this file since 23b6cf was 94d5ac6, checked in by Frederik Heber <heber@…>, 12 years ago

FIX: As we use GSL internally, we are as of now required to use GPL v2 license.

  • GNU Scientific Library is used at every place in the code, especially the sub-package LinearAlgebra is based on it which in turn is used really everywhere in the remainder of MoleCuilder. Hence, we have to use the GPL license for the whole of MoleCuilder. In effect, GPL's COPYING was present all along and stated the terms of the GPL v2 license.
  • Hence, I added the default GPL v2 disclaimer to every source file and removed the note about a (actually missing) LICENSE file.
  • also, I added a help-redistribute action which again gives the disclaimer of the GPL v2.
  • also, I changed in the disclaimer that is printed at every program start in builder_init.cpp.
  • TEST: Added check on GPL statement present in every module to test CodeChecks project-disclaimer.
  • Property mode set to 100644
File size: 4.1 KB
Line 
1/*
2 * Project: MoleCuilder
3 * Description: creates and alters molecular systems
4 * Copyright (C) 2010-2012 University of Bonn. All rights reserved.
5 *
6 *
7 * This file is part of MoleCuilder.
8 *
9 * MoleCuilder is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * MoleCuilder is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with MoleCuilder. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23/*
24 * TypeEnumContainer.cpp
25 *
26 * Created on: Oct 27, 2010
27 * Author: heber
28 */
29
30// include config.h
31#ifdef HAVE_CONFIG_H
32#include <config.h>
33#endif
34
35#include "CodePatterns/MemDebug.hpp"
36
37#include <boost/filesystem.hpp>
38#include <iosfwd>
39#include <typeinfo>
40#include <vector>
41
42#include "Actions/Values.hpp"
43#include "CodePatterns/Assert.hpp"
44
45#include "UIElements/CommandLineUI/TypeEnumContainer.hpp"
46
47#include "Atom/atom.hpp"
48#include "LinearAlgebra/BoxVector.hpp"
49#include "LinearAlgebra/RealSpaceMatrix.hpp"
50#include "LinearAlgebra/Vector.hpp"
51#include "Element/element.hpp"
52#include "molecule.hpp"
53#include "RandomNumbers/RandomNumberDistribution_Parameters.hpp"
54
55/** Constructor for class TypeEnumContainer.
56 * Just fills TypeEnumContainer::TypeEnumMap by hand.
57 */
58TypeEnumContainer::TypeEnumContainer()
59{
60 TypeEnumMap[&typeid(void)] = NoneType;
61 TypeEnumMap[&typeid(bool)] = BooleanType;
62 TypeEnumMap[&typeid(RealSpaceMatrix)] = RealSpaceMatrixType;
63 TypeEnumMap[&typeid(BoxVector)] = VectorType;
64 TypeEnumMap[&typeid(Vector)] = VectorType;
65 TypeEnumMap[&typeid(boost::filesystem::path)] = FileType;
66 TypeEnumMap[&typeid(std::vector<boost::filesystem::path>)] = ListOfFilesType;
67 TypeEnumMap[&typeid(int)] = IntegerType;
68 TypeEnumMap[&typeid(std::vector<int>)] = ListOfIntegersType;
69 TypeEnumMap[&typeid(unsigned int)] = UnsignedIntegerType;
70 TypeEnumMap[&typeid(std::vector<unsigned int>)] = ListOfUnsignedIntegersType;
71 TypeEnumMap[&typeid(double)] = DoubleType;
72 TypeEnumMap[&typeid(std::vector<double>)] = ListOfDoublesType;
73 TypeEnumMap[&typeid(std::string)] = StringType;
74 TypeEnumMap[&typeid(std::vector<std::string>)] = ListOfStringsType;
75 TypeEnumMap[&typeid(VectorValue)] = VectorType;
76 TypeEnumMap[&typeid(std::vector<VectorValue>)] = ListOfVectorsType;
77 TypeEnumMap[&typeid(const atom *)] = AtomType;
78 TypeEnumMap[&typeid(std::vector<const atom *>)] = ListOfAtomsType;
79 TypeEnumMap[&typeid(const molecule *)] = MoleculeType;
80 TypeEnumMap[&typeid(std::vector<const molecule *>)] = ListOfMoleculesType;
81 TypeEnumMap[&typeid(const element *)] = ElementType;
82 TypeEnumMap[&typeid(std::vector<const element *>)] = ListOfElementsType;
83 TypeEnumMap[&typeid(RandomNumberDistribution_Parameters)] = RandomNumberDistribution_ParametersType;
84
85 // for debugging: list all stored types
86 //ListAllKnownTypes();
87};
88
89/** Destructor for class TypeEnumContainer.
90 * Clears TypeEnumContainer::TypeEnumMap.
91 */
92TypeEnumContainer::~TypeEnumContainer()
93{
94 TypeEnumMap.clear();
95}
96
97/** Destructor for class TypeEnumContainer.
98 * Clears TypeEnumContainer::TypeEnumMap.
99 */
100void TypeEnumContainer::ListAllKnownTypes() const
101{
102 for (type_map::const_iterator iter = TypeEnumMap.begin(); iter != TypeEnumMap.end(); ++iter) {
103 std::cout << " Known type is " << (iter->first)->name() << " or enum " << iter->second << std::endl;
104 }
105}
106
107/** Getter for TypeEnumContainer::TypeEnumMap.
108 * Note: \a *_type must be present, is checked by ASSERT().
109 * \param *_type type requested
110 */
111enum TypeEnumContainer::EnumOfTypes TypeEnumContainer::getEnumforType(const std::type_info *_type)
112{
113 //std::cout << "Looking for type " << _type->name() << std::endl;
114 ASSERT(TypeEnumMap.find(_type) != TypeEnumMap.end(),
115 "CommandLineParser::getEnumforType() - cannot find the type as enum!.");
116 return (TypeEnumMap[_type]);
117}
118
Note: See TracBrowser for help on using the repository browser.