[9b56f34] | 1 | /*
|
---|
| 2 | * Project: MoleCuilder
|
---|
| 3 | * Description: creates and alters molecular systems
|
---|
| 4 | * Copyright (C) 2013 Frederik Heber. 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 | * toCLIString.cpp
|
---|
| 25 | *
|
---|
| 26 | * Created on: Aug 23, 2013
|
---|
| 27 | * Author: heber
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | // include config.h
|
---|
| 31 | #ifdef HAVE_CONFIG_H
|
---|
| 32 | #include <config.h>
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
[9eb71b3] | 35 | //#include "CodePatterns/MemDebug.hpp"
|
---|
[9b56f34] | 36 |
|
---|
| 37 | #include "toCLIString.hpp"
|
---|
| 38 |
|
---|
[27d0bc] | 39 | #include "Element/element.hpp"
|
---|
[9b56f34] | 40 | #include "LinearAlgebra/RealSpaceMatrix.hpp"
|
---|
| 41 | #include "LinearAlgebra/Vector.hpp"
|
---|
[33e801] | 42 | #include "Parameters/Specifics/KeyValuePair.hpp"
|
---|
| 43 |
|
---|
| 44 | #include "Actions/toPythonString.hpp"
|
---|
[9b56f34] | 45 |
|
---|
| 46 | template <>
|
---|
| 47 | const std::string toCLIString( const boost::filesystem::path & _value)
|
---|
| 48 | {
|
---|
| 49 | return _value.string();
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | template <>
|
---|
[27d0bc] | 53 | const std::string toCLIString( const element & _value)
|
---|
[9b56f34] | 54 | {
|
---|
| 55 | std::stringstream output;
|
---|
[27d0bc] | 56 | output << _value.getAtomicNumber();
|
---|
| 57 | return output.str();
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | template <>
|
---|
| 61 | const std::string toCLIString( const RealSpaceMatrix& _value)
|
---|
| 62 | {
|
---|
| 63 | std::stringstream output;
|
---|
| 64 | output << "\""
|
---|
| 65 | << _value.at(0,0) << ","
|
---|
| 66 | << _value.at(1,0) << ","
|
---|
| 67 | << _value.at(1,1) << ","
|
---|
| 68 | << _value.at(2,0) << ","
|
---|
| 69 | << _value.at(2,1) << ","
|
---|
[33e801] | 70 | << _value.at(2,2)
|
---|
| 71 | << "\"";
|
---|
[9b56f34] | 72 | return output.str();
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | template <>
|
---|
| 76 | const std::string toCLIString( const Vector& _value)
|
---|
| 77 | {
|
---|
| 78 | std::stringstream output;
|
---|
[33e801] | 79 | output << "\"" << toPythonString(_value) << "\"";
|
---|
[27d0bc] | 80 | return output.str();
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | template <>
|
---|
| 84 | const std::string toCLIString( const std::string& _value)
|
---|
| 85 | {
|
---|
| 86 | std::stringstream output;
|
---|
| 87 | output << "\"" << _value << "\"";
|
---|
[9b56f34] | 88 | return output.str();
|
---|
| 89 | }
|
---|
[33e801] | 90 |
|
---|
| 91 | template <>
|
---|
| 92 | const std::string toCLIString( const KeyValuePair& _value)
|
---|
| 93 | {
|
---|
| 94 | std::stringstream output;
|
---|
| 95 | output << "\"" << toPythonString(_value) << "\"";
|
---|
| 96 | return output.str();
|
---|
| 97 | }
|
---|