#include <CMapPlottable.hpp>
Public Member Functions | |
CMapPlottable () | |
~CMapPlottable () | |
Destructor. | |
Cvals * | getSecond (const std::string &first) |
void | printPlottableNames () |
std::vector< std::string > | getPlottableNames () |
Static Private Member Functions | |
static void | createMap () |
static float | getAge (const int &ipart) |
Age of a star: the current time - the time at birth. | |
static float | getPressure (const int &ipart) |
Static Private Attributes | |
static std::map< std::string, Cvals * > | _vals_map |
This class contains methods to setup and access a map that maps a string (e.g. x) to the corresponding Cvals object, through which the corresponding property (e.g. "x") of each particle can be accessed.
Note: see the comment in star_map.cpp for more information
CMapPlottable::CMapPlottable | ( | ) |
Constructor: sets up the map
CMapPlottable::~CMapPlottable | ( | ) |
Destructor.
Calls the destructors for each of the map values (which are Cvals instances)
void CMapPlottable::createMap | ( | ) | [static, private] |
Create the actual STL map which maps strings to Cvals objects
float CMapPlottable::getAge | ( | const int & | ipart | ) | [static, private] |
Age of a star: the current time - the time at birth.
static function to allow easy pointer making to this function
std::vector< std::string > CMapPlottable::getPlottableNames | ( | ) |
Return a list with all the names of the plottables
implemented like this and not using a vector & argument because the latter does not seem to work with SIP: need to return something with the stuff we need in it.
float CMapPlottable::getPressure | ( | const int & | ipart | ) | [static, private] |
Pressure (bogus for non-SPH particles, no check is performed)
Cvals * CMapPlottable::getSecond | ( | const std::string & | first | ) |
Get the Cvals corresponding to a string. If not found: returns 0
void CMapPlottable::printPlottableNames | ( | ) |
Print a list of all the plottable names
std::map< std::string, Cvals * > CMapPlottable::_vals_map [static, private] |
the map mapping strings to Cvals instances. Static because accessor functions are static. I do wonder if the Cvals* ever get deleted.. should check if the garbage collection calls delete in the dynamically allocated Cvals* instances.