3 #include <bbp/sonata/nodes.h>
5 #include <nlohmann/json.hpp>
10 class CompartmentSetFilteredIterator;
12 class CompartmentSets;
33 uint64_t sectionIndex = 0;
39 return nodeId == other.nodeId && sectionIndex == other.sectionIndex &&
40 offset == other.offset;
44 return !(*
this == other);
49 inline std::ostream& operator<<(std::ostream& os,
const CompartmentLocation& cl) {
50 os <<
"CompartmentLocation("
51 <<
"nodeId: " << cl.nodeId <<
", "
52 <<
"sectionIndex: " << cl.sectionIndex <<
", "
53 <<
"offset: " << cl.offset <<
")";
59 using iterator_category = std::forward_iterator_tag;
61 using difference_type = std::ptrdiff_t;
66 std::unique_ptr<detail::CompartmentSetFilteredIterator> impl);
82 std::unique_ptr<detail::CompartmentSetFilteredIterator> impl_;
99 explicit CompartmentSet(std::shared_ptr<detail::CompartmentSet>&& impl);
101 std::pair<CompartmentSetFilteredIterator, CompartmentSetFilteredIterator> filtered_crange(
127 std::shared_ptr<detail::CompartmentSet> impl_;
170 std::vector<std::string>
names()
const;
176 std::vector<std::pair<std::string, CompartmentSet>>
items()
const;
185 std::unique_ptr<detail::CompartmentSets> impl_;
Definition: compartment_sets.h:57
Definition: compartment_sets.h:94
std::size_t size(const Selection &selection=Selection({})) const
Size of the set, optionally filtered by selection.
CompartmentLocation operator[](std::size_t index) const
Access element by index. It returns a copy!
std::string toJSON() const
Serialize to JSON string.
const std::string & population() const
Population name.
A container class that manages a collection of named CompartmentSet objects.
Definition: compartment_sets.h:142
std::vector< std::pair< std::string, CompartmentSet > > items() const
Get items (key + compartment set) as vector of pairs.
std::vector< CompartmentSet > getAllCompartmentSets() const
Get all compartment sets as vector.
CompartmentSet getCompartmentSet(const std::string &key) const
Access element by key (throws if not found)
std::size_t size() const
Number of compartment sets.
std::string toJSON() const
Serialize all compartment sets to JSON string.
bool empty() const
Is empty?
static CompartmentSets fromFile(const std::string &path)
std::vector< std::string > names() const
Get names of CompartmentSet(s) as a vector.
bool contains(const std::string &key) const
Check if key exists.
Definition: selection.h:13
Definition: compartment_sets.h:30
bool operator==(const CompartmentLocation &other) const
Definition: compartment_sets.h:38