Class HostEnvironment

Class Documentation

class flamegpu::HostEnvironment

This class provides host function access to Environment Properties It acts as a wrapper to EnvironmentManager, proxying calls, converting variable name and model_name into a combined hash Pairs with EnvironmentManager, AgentEnvironment and EnvironmentDescription This class is only to be constructed by HostAPI

Note

Not thread-safe

Public Functions

template<typename T>
T getProperty(const std::string &name) const

Gets an environment property

Getters

Parameters

name – name used for accessing the property

Template Parameters

T – Type of the environment property

Throws

exception::InvalidEnvProperty – If a property of the name does not exist

template<typename T, EnvironmentManager::size_type N>
std::array<T, N> getProperty(const std::string &name) const

Gets an environment property array

Parameters

name – name used for accessing the property

Template Parameters
  • T – Type of the elements of the environment property array

  • N – Length of the environment property array

Throws

exception::InvalidEnvProperty – If a property array of the name does not exist

template<typename T>
T getProperty(const std::string &name, const EnvironmentManager::size_type &index) const

Gets an element of an environment property array

See

get(const std::string &)

Parameters
  • name – name used for accessing the property

  • index – Index of the element within the environment property array to return

Template Parameters

T – Type of the elements of the environment property array

Throws
template<typename T>
T setProperty(const std::string &name, const T &value) const

Sets an environment property

Setters

Parameters
  • name – name used for accessing the property

  • value – to set the property

Template Parameters

T – Type of the elements of the environment property

Throws
Returns

Returns the previous value

template<typename T, EnvironmentManager::size_type N>
std::array<T, N> setProperty(const std::string &name, const std::array<T, N> &value) const

Sets an environment property array

Parameters
  • name – name used for accessing the property array

  • value – to set the property array

Template Parameters
  • T – Type of the elements of the environment property array

  • N – Length of the environmental property array

Throws
Returns

Returns the previous value

template<typename T>
T setProperty(const std::string &name, const EnvironmentManager::size_type &index, const T &value) const

Sets an element of an environment property array

See

get(const std::string &)

Parameters
  • name – name used for accessing the property array

  • index – element within the environment property array to set

  • value – to set the element of the property array

Template Parameters

T – Type of the environmental property array

Throws
Returns

Returns the previous value

Protected Functions

explicit HostEnvironment(const unsigned int &instance_id)

Constructor, to be called by HostAPI

Protected Attributes

EnvironmentManager &env_mgr

Provides access to EnvironmentManager singleton

const unsigned int instance_id

Access to instance id of the CUDASimulation This is used to augment all variable names