XdmfTime.cpp 1.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/*
 * XdmfTime.cpp
 *
 *  Created on: Jan 29, 2010
 *      Author: kleiter
 */

#include <sstream>
#include "XdmfTime.hpp"

XdmfTime::XdmfTime(const double & value) :
	mValue(value)
{
}

XdmfTime::~XdmfTime()
{
}

const std::string XdmfTime::ItemTag = "Time";

std::map<std::string, std::string> XdmfTime::getItemProperties() const
{
	std::map<std::string, std::string> timeProperties;
	std::stringstream value;
	value << mValue;
	timeProperties["Value"] = value.str();
	return timeProperties;
}

std::string XdmfTime::getItemTag() const
{
	return ItemTag;
}

double XdmfTime::getValue() const
{
	return mValue;
}

void XdmfTime::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems)
{
	std::map<std::string, std::string>::const_iterator value = itemProperties.find("Value");
	if(value != itemProperties.end())
	{
		mValue = atof(value->second.c_str());
	}
	else
	{
		assert(false);
	}
}

void XdmfTime::setValue(const double & value)
{
	mValue = value;
}