A library for working with phylogenetic and population genetic data.
v0.32.0
name.hpp
Go to the documentation of this file.
1 #ifndef GENESIS_PLACEMENT_PQUERY_NAME_H_
2 #define GENESIS_PLACEMENT_PQUERY_NAME_H_
3 
4 /*
5  Genesis - A toolkit for working with phylogenetic data.
6  Copyright (C) 2014-2019 Lucas Czech and HITS gGmbH
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 
21  Contact:
22  Lucas Czech <lucas.czech@h-its.org>
23  Exelixis Lab, Heidelberg Institute for Theoretical Studies
24  Schloss-Wolfsbrunnenweg 35, D-69118 Heidelberg, Germany
25 */
26 
34 #include <string>
35 
36 namespace genesis {
37 namespace placement {
38 
39 // =================================================================================================
40 // Pquery Name
41 // =================================================================================================
42 
56 {
57 public:
58 
59  // -------------------------------------------------------------------
60  // Constructor and Rule of Five
61  // -------------------------------------------------------------------
62 
67  PqueryName () = default;
68 
72  explicit PqueryName( std::string const& name, double multiplicity = 1.0 )
73  : name( name )
75  {}
76 
77  ~PqueryName() = default;
78 
79  PqueryName( PqueryName const& ) = default;
80  PqueryName( PqueryName&& ) = default;
81 
82  PqueryName& operator= ( PqueryName const& ) = default;
83  PqueryName& operator= ( PqueryName&& ) = default;
84 
85  // -------------------------------------------------------------------
86  // Conversion
87  // -------------------------------------------------------------------
88 
92  operator std::string&()
93  {
94  return name;
95  }
96 
100  operator std::string const&() const
101  {
102  return name;
103  }
104 
105  // -------------------------------------------------------------------
106  // Public Property Data Members
107  // -------------------------------------------------------------------
108 
109  // Yes, the following members are public data members. It's neither nice nor consistent,
110  // but makes life so much easier for the moment. Maybe we'll change that in the future...
111 
118  std::string name;
119 
131  double multiplicity = 1.0;
132 
133 };
134 
135 } // namespace placement
136 } // namespace genesis
137 
138 #endif // include guard
genesis::placement::PqueryName::~PqueryName
~PqueryName()=default
genesis::placement::PqueryName::name
std::string name
Name for a Pquery.
Definition: name.hpp:118
genesis::placement::PqueryName::PqueryName
PqueryName()=default
Default constructor. Initializes the name to an empty string and the multiplicity to 1....
genesis::placement::PqueryName::multiplicity
double multiplicity
Multiplicity of the name.
Definition: name.hpp:131
genesis
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
Definition: placement/formats/edge_color.cpp:42
genesis::placement::PqueryName
A name of a Pquery and its multiplicity.
Definition: name.hpp:55
genesis::placement::PqueryName::operator=
PqueryName & operator=(PqueryName const &)=default
genesis::placement::PqueryName::PqueryName
PqueryName(std::string const &name, double multiplicity=1.0)
Constructor that takes a name and optionally a multiplicity.
Definition: name.hpp:72