VIPRA Documentation
Loading...
Searching...
No Matches
VIPRA::Input::JSON Class Reference

Parameter and Polygon qualified JSON input module. More...

#include <json.hpp>

Inheritance diagram for VIPRA::Input::JSON:
Collaboration diagram for VIPRA::Input::JSON:

Public Member Functions

void load (std::string const &filepath) override
 Loads the JSON file from the given path.
 
template<typename data_t>
auto get (std::vector< std::string > const &keys) const -> std::optional< data_t >
 Returns the value of the given key from the JSON file.
 
auto serialize () -> std::string override
 
auto get_pedestrians () const -> std::optional< VIPRA::f3dVec > override
 
auto get_obstacles () const -> std::optional< std::vector< VIPRA::Geometry::Polygon > > override
 Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.
 
auto get_spawns () const -> std::optional< std::vector< VIPRA::Geometry::Polygon > > override
 Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.
 
auto get_objectives () const -> std::optional< std::map< std::string, std::vector< VIPRA::Geometry::Polygon > > > override
 Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.
 
auto get_areas () const -> std::optional< std::map< std::string, VIPRA::Geometry::Polygon > > override
 Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.
 
void parse (std::string const &data) override
 
- Public Member Functions inherited from VIPRA::Modules::ParamReader< JSON >
auto get_param (std::string const &type, std::string const &moduleName, std::string const &paramName, VIPRA::Random::Engine &engine) const -> std::optional< std::remove_cvref_t< data_t > >
 
- Public Member Functions inherited from VIPRA::Modules::Serializable
 Serializable (const Serializable &)=default
 
 Serializable (Serializable &&)=default
 
auto operator= (const Serializable &) -> Serializable &=default
 
auto operator= (Serializable &&) -> Serializable &=default
 
- Public Member Functions inherited from VIPRA::Modules::MapInput
 MapInput (const MapInput &)=default
 
 MapInput (MapInput &&)=default
 
auto operator= (const MapInput &) -> MapInput &=default
 
auto operator= (MapInput &&) -> MapInput &=default
 
- Public Member Functions inherited from VIPRA::Modules::PedestrianInput
 PedestrianInput (const PedestrianInput &)=default
 
 PedestrianInput (PedestrianInput &&)=default
 
auto operator= (const PedestrianInput &) -> PedestrianInput &=default
 
auto operator= (PedestrianInput &&) -> PedestrianInput &=default
 

Static Public Member Functions

static constexpr auto module_name () -> const char *
 

Detailed Description

Parameter and Polygon qualified JSON input module.

Member Function Documentation

◆ get()

template<typename data_t>
auto VIPRA::Input::JSON::get ( std::vector< std::string > const & keys) const -> std::optional<data_t>
nodiscard

Returns the value of the given key from the JSON file.

Template Parameters
data_t
key_ts
Parameters
keys
Returns
std::optional<data_t>

◆ get_areas()

auto VIPRA::Input::JSON::get_areas ( ) const -> std::optional< std::map< std::string, VIPRA::Geometry::Polygon > >
nodiscardoverridevirtual

Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.

Template Parameters
data_t
key_ts
Parameters
key
Returns
std::vector<Geometry::Polygon>

Implements VIPRA::Modules::MapInput.

◆ get_objectives()

auto VIPRA::Input::JSON::get_objectives ( ) const -> std::optional< std::map< std::string, std::vector< VIPRA::Geometry::Polygon > > >
nodiscardoverridevirtual

Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.

Template Parameters
data_t
key_ts
Parameters
key
Returns
std::vector<Geometry::Polygon>

Implements VIPRA::Modules::MapInput.

◆ get_obstacles()

auto VIPRA::Input::JSON::get_obstacles ( ) const -> std::optional< std::vector< VIPRA::Geometry::Polygon > >
nodiscardoverridevirtual

Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.

Template Parameters
data_t
key_ts
Parameters
key
Returns
std::vector<Geometry::Polygon>

Implements VIPRA::Modules::MapInput.

◆ get_pedestrians()

auto VIPRA::Input::JSON::get_pedestrians ( ) const -> std::optional<VIPRA::f3dVec>
nodiscardoverridevirtual

◆ get_spawns()

auto VIPRA::Input::JSON::get_spawns ( ) const -> std::optional< std::vector< VIPRA::Geometry::Polygon > >
nodiscardoverridevirtual

Returns polygons as loaded from the input module, std::nullopt if incorrect type / doesn't exist.

Template Parameters
data_t
key_ts
Parameters
key
Returns
std::vector<Geometry::Polygon>

Implements VIPRA::Modules::MapInput.

◆ load()

void VIPRA::Input::JSON::load ( std::string const & filepath)
inlineoverridevirtual

Loads the JSON file from the given path.

Parameters
filepath

Implements VIPRA::Modules::MapInput.

◆ parse()

void VIPRA::Input::JSON::parse ( std::string const & data)
inlineoverridevirtual

◆ serialize()

auto VIPRA::Input::JSON::serialize ( ) -> std::string
inlinenodiscardoverridevirtual

The documentation for this class was generated from the following files: