Commit 92313779 authored by Andrew J. Burns (Cont's avatar Andrew J. Burns (Cont

fixes for Windows Compilation

parent f5300338
......@@ -21,6 +21,7 @@
/* */
/*****************************************************************************/
#include <algorithm>
#include <cctype>
#include "XdmfAttribute.hpp"
#include "XdmfCurvilinearGrid.hpp"
......@@ -277,11 +278,11 @@ XdmfItemFactory::createItem(const std::string & itemTag,
dimensionsString = dimensions->second;
}
#ifdef HAVE_CXX11_SHARED_PTR
char * dimString = strdup(dimensionsString);
char * dimString = strdup(dimensionsString.c_str());
char * token = std::strtok(dimString, " ");
while (token != NULL)
{
dimensionsArray.push_back(atoi(token));
dimensionsArray->pushBack(atoi(token));
token = std::strtok(NULL, " ");
}
......
......@@ -1113,7 +1113,7 @@ XdmfTemplate::setStep(unsigned int stepId)
unsigned int index = 0;
#ifdef HAVE_CXX11_SHARED_PTR
char * trackedString = strdup(content);
char * trackedString = strdup(content.c_str());
char * token = std::strtok(trackedString, " \t\n");
if(mTrackedArrayTypes[i] == XdmfArrayType::String()) {
while (token != NULL)
......
......@@ -44,6 +44,7 @@ XDMF_CHILDREN_IMPLEMENTATION(XdmfArray,
Name)
template<>
XDMFCORE_EXPORT
std::string
XdmfArray::GetValuesString<std::string>::getValuesString<void, void>(const void * const array,
const int numValues) const
......@@ -64,6 +65,7 @@ XdmfArray::GetValuesString<std::string>::getValuesString<void, void>(const void
}
template <>
XDMFCORE_EXPORT
std::string
XdmfArray::getValue<std::string>(const unsigned int index) const
{
......@@ -75,7 +77,16 @@ XdmfArray::getValue<std::string>(const unsigned int index) const
internalRef);
}
template <>
XDMFCORE_EXPORT
void *
XdmfArray::initialize<void>(const unsigned int size)
{
return this->initialize<char>(size);
}
template<>
XDMFCORE_EXPORT
void
XdmfArray::Insert<std::string>::operator()<void>(void * array) const
{
......@@ -91,6 +102,7 @@ XdmfArray::Insert<std::string>::operator()<void>(void * array) const
}
template<>
XDMFCORE_EXPORT
void
XdmfArray::GetValues<std::string>::operator()<void>(const void * array) const
{
......@@ -379,7 +391,7 @@ XdmfArray::getValuesString() const
shared_ptr<XdmfHeavyDataController>
XdmfArray::getHeavyDataController()
{
return boost::const_pointer_cast<XdmfHeavyDataController>
return const_pointer_cast<XdmfHeavyDataController>
(static_cast<const XdmfArray &>(*this).getHeavyDataController(0));
}
......@@ -844,7 +856,7 @@ XdmfArray::populateItem(const std::map<std::string, std::string> & itemPropertie
for (contentIndex = 0; contentIndex < contentVals.size(); ++contentIndex)
{
#ifdef HAVE_CXX11_SHARED_PTR
char * valuesString = strdup(contentVals[contentIndex]);
char * valuesString = strdup(contentVals[contentIndex].c_str());
char * token = std::strtok(valuesString, " \t\n");
if(arrayType == XdmfArrayType::String()) {
while (token != NULL)
......@@ -1048,6 +1060,7 @@ printf("invalid array type\n");
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<unsigned char>()
{
......@@ -1055,6 +1068,7 @@ XdmfArray::setArrayType<unsigned char>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<unsigned short>()
{
......@@ -1062,6 +1076,7 @@ XdmfArray::setArrayType<unsigned short>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<unsigned int>()
{
......@@ -1069,6 +1084,7 @@ XdmfArray::setArrayType<unsigned int>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<char>()
{
......@@ -1076,6 +1092,7 @@ XdmfArray::setArrayType<char>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<short>()
{
......@@ -1083,6 +1100,7 @@ XdmfArray::setArrayType<short>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<int>()
{
......@@ -1090,13 +1108,25 @@ XdmfArray::setArrayType<int>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<long>()
{
mArrayType = XdmfArrayType::Int64();
}
#ifdef WIN32
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<__int64>()
{
mArrayType = XdmfArrayType::Int64();
}
#endif
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<float>()
{
......@@ -1104,6 +1134,7 @@ XdmfArray::setArrayType<float>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<double>()
{
......@@ -1111,6 +1142,7 @@ XdmfArray::setArrayType<double>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<std::string>()
{
......@@ -1118,6 +1150,7 @@ XdmfArray::setArrayType<std::string>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<std::string const* const>()
{
......@@ -1125,6 +1158,7 @@ XdmfArray::setArrayType<std::string const* const>()
}
template <>
XDMFCORE_EXPORT
void
XdmfArray::setArrayType<std::string const*>()
{
......
......@@ -55,16 +55,60 @@ class XdmfArray::XdmfVisitor
{
}
XdmfVisitor& operator=(const XdmfVisitor &orig)
{
mName = orig.mName;
}
template <typename U>
T
operator()(U * array)
{
printf("blank operator\n");
return NULL;
}
virtual
T
operator()()
{
printf("blank operator\n");
return NULL;
}
std::string mName;
};
template <>
class XdmfArray::XdmfVisitor<void>
{
public:
// Parameters other than the array pointer will be passed via the constructor
// This includes output parameters
XdmfVisitor()
{
mName = "none";
}
XdmfVisitor(const XdmfVisitor<void> & orig)
{
mName = orig.mName;
}
~XdmfVisitor()
{
}
template <typename U>
void
operator()(U * array)
{
printf("blank operator\n");
}
virtual
void
operator()()
{
printf("blank operator\n");
}
......@@ -737,6 +781,28 @@ public:
template<typename U>
T
operator()(U * array)
{
return NULL;
}
private:
const unsigned int mArrayPointerNumValues;
};
template<>
class XdmfArray::GetValuesString<void> : public XdmfArray::XdmfVisitor<void> {
public:
GetValuesString(const int arrayPointerNumValues) :
mArrayPointerNumValues(arrayPointerNumValues)
{
mName = "GetValuesString";
}
template<typename U>
void
operator()(U * array)
{
}
......@@ -1095,6 +1161,8 @@ public:
void
operator()(std::string * array) const
{
mArray->insert(mArray->getSize(), array, 1);
/*
//resize if outside capacity
std::stringstream value;
value << mVal;
......@@ -1104,18 +1172,22 @@ public:
array[endpoint + 1] = value.str();
mArray->mDimensions.clear();
mArray->mDimensions.push_back(endpoint + 1);
*/
}
template<typename U>
void
operator()(U * array) const
{
mArray->insert(mArray->getSize(), array, 1);
/*
unsigned int endpoint = mArray->getSize();// TODO
mArray->resize<T>(endpoint + 1);
array = (U *) mArray->mArray;
array[endpoint]=(U)mVal;
mArray->mDimensions.clear();
mArray->mDimensions.push_back(endpoint + 1);
*/
}
private:
......@@ -1508,6 +1580,10 @@ XdmfArray::getValuesInternal()
}
}
template <>
void *
XdmfArray::initialize<void>(const unsigned int size);
template <typename T>
T *
XdmfArray::initialize(const unsigned int size)
......
......@@ -685,7 +685,7 @@ XdmfCoreItemFactory::generateHeavyDataControllers(const std::map<std::string, st
token = std::strtok(dimsString, " ");
while (token != NULL)
{
contentDataspace.push_back(atoi(token));
contentDataspaces.push_back(atoi(token));
token = std::strtok(NULL, " ");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment