Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfSpeciesList.h
1/*******************************************************************************
2 * This file is part of Tissue Forge.
3 * Copyright (c) 2022-2024 T.J. Sego
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19
20#ifndef _SOURCE_STATE_TFSPECIESLIST_H_
21#define _SOURCE_STATE_TFSPECIESLIST_H_
22
23#include "tfSpecies.h"
24#include <io/tf_io.h>
25#include <tf_port.h>
26#include <string>
27#include <map>
28
29
30namespace TissueForge {
31
32
33 namespace state {
34
35
36 struct CAPI_EXPORT SpeciesList
37 {
44 int32_t index_of(const std::string &s);
45
51 int32_t size();
52
60
67 TissueForge::state::Species *item(const std::string &s);
68
75
82 HRESULT insert(const std::string &s);
83
89 std::string str();
90
91 SpeciesList() {};
92
94
100 std::string toString();
101
108 static SpeciesList *fromString(const std::string &str);
109
110 private:
111
112 typedef std::map<std::string, TissueForge::state::Species*> Map;
113 Map species_map;
114 };
115
116 }
117
118 namespace io {
119
120 template <>
121 HRESULT toFile(const TissueForge::state::SpeciesList &dataElement, const MetaData &metaData, IOElement &fileElement);
122
123 template <>
124 HRESULT fromFile(const IOElement &fileElement, const MetaData &metaData, TissueForge::state::SpeciesList *dataElement);
125
126 };
127
128}
129
130
131#endif // _SOURCE_STATE_TFSPECIESLIST_H_
Tissue Forge I/O.
Definition tfThreeDFAngleMeshGenerator.h:28
HRESULT toFile(const T &dataElement, const MetaData &metaData, IOElement &fileElement)
Convert an object to an intermediate I/O object.
HRESULT fromFile(const IOElement &fileElement, const MetaData &metaData, T *dataElement)
Instantiate an object from an intermediate I/O object.
Tissue Forge state dynamics modeling features.
Definition tfSpecies.h:42
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26
The Tissue Forge species object.
Definition tfSpecies.h:58
Definition tfSpeciesList.h:37
TissueForge::state::Species * item(const std::string &s)
Get a species by name.
std::string str()
Get a string representation.
HRESULT insert(const std::string &s)
Insert a species by name.
HRESULT insert(TissueForge::state::Species *s)
Insert a species.
static SpeciesList * fromString(const std::string &str)
Create from a JSON string representation.
TissueForge::state::Species * item(int32_t index)
Get a species by index.
std::string toString()
Get a JSON string representation.
int32_t size()
Get the size of the species.
int32_t index_of(const std::string &s)
Get the index of a species name.
int32_t HRESULT
Definition tf_port.h:255