Public Member Functions | Static Public Member Functions
bbp::sonata::CompartmentSets Class Reference

A container class that manages a collection of named CompartmentSet objects. More...

#include <compartment_sets.h>

Public Member Functions

 CompartmentSets (const std::string &content)
 
 CompartmentSets (std::unique_ptr< detail::CompartmentSets > &&impl)
 
 CompartmentSets (detail::CompartmentSets &&impl)
 
 CompartmentSets (CompartmentSets &&) noexcept
 
 CompartmentSets (const CompartmentSets &other)=delete
 
CompartmentSetsoperator= (CompartmentSets &&) noexcept
 
CompartmentSet getCompartmentSet (const std::string &key) const
 Access element by key (throws if not found)
 
std::size_t size () const
 Number of compartment sets.
 
bool empty () const
 Is empty?
 
bool contains (const std::string &key) const
 Check if key exists.
 
std::vector< std::string > names () const
 Get names of CompartmentSet(s) as a vector.
 
std::vector< CompartmentSetgetAllCompartmentSets () const
 Get all compartment sets as vector.
 
std::vector< std::pair< std::string, CompartmentSet > > items () const
 Get items (key + compartment set) as vector of pairs.
 
std::string toJSON () const
 Serialize all compartment sets to JSON string.
 
bool operator== (const CompartmentSets &other) const
 
bool operator!= (const CompartmentSets &other) const
 

Static Public Member Functions

static CompartmentSets fromFile (const std::string &path)
 

Detailed Description

A container class that manages a collection of named CompartmentSet objects.

This class provides methods for accessing, querying, and serializing a collection of compartment sets identified by string keys. It supports construction from a JSON string or a file, and encapsulates its internal implementation using the PIMPL idiom.

The class is non-copyable but movable, and offers value-style accessors for ease of use.

Member Function Documentation

◆ fromFile()

static CompartmentSets bbp::sonata::CompartmentSets::fromFile ( const std::string &  path)
static

Create new CompartmentSets from file. In this way we distinguish from the basic string constructor.