votca 2024.2-dev
Loading...
Searching...
No Matches
propertyiomanipulator.h
Go to the documentation of this file.
1/*
2 * Copyright 2009-2020 The VOTCA Development Team (http://www.votca.org)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18#ifndef VOTCA_TOOLS_PROPERTYIOMANIPULATOR_H
19#define VOTCA_TOOLS_PROPERTYIOMANIPULATOR_H
20
21// Local VOTCA includes
22#include "colors.h"
23#include "property.h"
24
25namespace votca {
26namespace tools {
27
35
36 public:
37 enum Type { XML, HLP, TXT };
38
39 explicit PropertyIOManipulator(Type type = XML, Index level = 0,
40 std::string indentation = "",
41 ColorSchemeBase *color_scheme = nullptr)
42 : type_(type),
43 level_(level),
44 indentation_(indentation),
45 color_scheme_(color_scheme) {
46 ;
47 }
48
50 friend std::ostream &operator<<(std::ostream &os,
52 os.pword(int(Property::getIOindex())) = &piom;
53 return os;
54 }
55
56 const Type &getType() { return type_; }
57 void setType(Type type) { type_ = type; }
58 const Index &getLevel() { return level_; }
59 void setLevel(Index level) { level_ = level; }
60 const std::string &getIndentation() { return indentation_; }
61 void setIndentation(std::string indentation) { indentation_ = indentation; }
63 if (!color_scheme_) {
64 return &DEFAULT_COLORS;
65 }
66 return color_scheme_;
67 }
68
69 template <typename T>
71 if (color_scheme_) {
72 delete color_scheme_;
73 }
74 color_scheme_ = new Color<T>();
75 return color_scheme_;
76 }
77
78 private:
81 std::string indentation_;
83};
84
88
89} // namespace tools
90} // namespace votca
91
92#endif // VOTCA_TOOLS_PROPERTYIOMANIPULATOR_H
Manipulates the format state of the output stream.
PropertyIOManipulator(Type type=XML, Index level=0, std::string indentation="", ColorSchemeBase *color_scheme=nullptr)
friend std::ostream & operator<<(std::ostream &os, PropertyIOManipulator &piom)
void setIndentation(std::string indentation)
static Index getIOindex()
Definition property.h:268
PropertyIOManipulator TXT
Color< csDefault > DEFAULT_COLORS
Definition colors.cc:24
PropertyIOManipulator XML
PropertyIOManipulator HLP
base class for all analysis tools
Definition basebead.h:33
Eigen::Index Index
Definition types.h:26