Class sdm::MultiSpace
Class List > sdm > MultiSpace
A multi-space is a set a spaces. More...
#include <multi_space.hpp>
Inherits the following classes: sdm::Space
Public Types inherited from sdm::Space
See sdm::Space
Type | Name |
---|---|
typedef std::shared_ptr< ItemIterator > | iterator_type |
Public Functions
Type | Name |
---|---|
MultiSpace () | |
MultiSpace (const std::vector< std::shared_ptr< Space >> &) | |
virtual std::vector< number > | getDim () const Get the dimension of the space. |
number | getNumSpaces () const Get the number of sub-space. |
std::shared_ptr< Space > | getSpace (number index) const Get a specific subspace. |
std::vector< std::shared_ptr< Space > > | getSpaces () const Get all spaces. |
virtual bool | isDiscrete () const Check if the space is discrete. |
bool | operator!= (const MultiSpace &) const |
MultiSpace & | operator= (const MultiSpace &) |
bool | operator== (const MultiSpace &) const |
void | setSpaces (const std::vector< std::shared_ptr< Space >> &) Change the list of spaces. You may prefer build a new MultiSpace instead of changing values of existing one. |
virtual std::string | str () const Space as a string. |
Public Functions inherited from sdm::Space
See sdm::Space
Type | Name |
---|---|
virtual iterator_type | begin () = 0 |
virtual iterator_type | end () = 0 |
virtual std::vector< number > | getDim () const = 0 Get the dimension of the space. |
bool | isContinuous () const Check if the space is continous. |
virtual bool | isDiscrete () const = 0 Check if the space is discrete. |
bool | operator!= (const Space & sp) const |
bool | operator== (const Space & sp) const |
virtual std::shared_ptr< Item > | sample () const Sample a random item from the space. |
virtual std::string | str () const = 0 Space as a string. |
std::shared_ptr< DiscreteSpace > | toDiscreteSpace () |
std::shared_ptr< MultiDiscreteSpace > | toMultiDiscreteSpace () |
virtual | ~Space () |
Protected Attributes
Type | Name |
---|---|
std::vector< std::shared_ptr< Space > > | spaces_ The list of spaces. |
Detailed Description
Each space can be of any derived class of Space class. By default Space is set to Space, which means that any space can be used (can be composed of both discrete and continuous spaces). MultiSpace herites from Space so you can even build hierarchical spaces like MultiSpace of MultiSpace (MultiSpace<MultiSpace<Space>>>).
Template parameters:
Public Functions Documentation
function MultiSpace [1/2]
sdm::MultiSpace::MultiSpace ()
function MultiSpace [2/2]
sdm::MultiSpace::MultiSpace (
const std::vector< std::shared_ptr< Space >> &
)
function getDim
virtual std::vector< number > sdm::MultiSpace::getDim () const
Implements sdm::Space::getDim
function getNumSpaces
number sdm::MultiSpace::getNumSpaces () const
function getSpace
std::shared_ptr< Space > sdm::MultiSpace::getSpace (
number index
) const
Parameters:
index
the index of the space
Returns:
a shared pointer on a specific space
function getSpaces
std::vector< std::shared_ptr< Space > > sdm::MultiSpace::getSpaces () const
Returns:
the list of space pointers
function isDiscrete
virtual bool sdm::MultiSpace::isDiscrete () const
Implements sdm::Space::isDiscrete
function operator!=
bool sdm::MultiSpace::operator!= (
const MultiSpace &
) const
function operator=
MultiSpace & sdm::MultiSpace::operator= (
const MultiSpace &
)
function operator==
bool sdm::MultiSpace::operator== (
const MultiSpace &
) const
function setSpaces
void sdm::MultiSpace::setSpaces (
const std::vector< std::shared_ptr< Space >> &
)
function str
virtual std::string sdm::MultiSpace::str () const
Implements sdm::Space::str
Protected Attributes Documentation
variable spaces_
std::vector<std::shared_ptr<Space> > sdm::MultiSpace::spaces_;
Friends Documentation
friend operator<<
inline friend std::ostream & sdm::MultiSpace::operator<< (
std::ostream & os,
const MultiSpace & sp
)
The documentation for this class was generated from the following file src/sdm/core/space/multi_space.hpp