XdmfReader.cpp 2.94 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*****************************************************************************/
/*                                    XDMF                                   */
/*                       eXtensible Data Model and Format                    */
/*                                                                           */
/*  Id : XdmfReader.cpp                                                      */
/*                                                                           */
/*  Author:                                                                  */
/*     Kenneth Leiter                                                        */
/*     kenneth.leiter@arl.army.mil                                           */
/*     US Army Research Laboratory                                           */
/*     Aberdeen Proving Ground, MD                                           */
/*                                                                           */
/*     Copyright @ 2011 US Army Research Laboratory                          */
/*     All Rights Reserved                                                   */
/*     See Copyright.txt for details                                         */
/*                                                                           */
/*     This software is distributed WITHOUT ANY WARRANTY; without            */
/*     even the implied warranty of MERCHANTABILITY or FITNESS               */
/*     FOR A PARTICULAR PURPOSE.  See the above copyright notice             */
/*     for more information.                                                 */
/*                                                                           */
/*****************************************************************************/
23

24
#include "XdmfItemFactory.hpp"
25
#include "XdmfReader.hpp"
26
#include "XdmfError.hpp"
27

28
shared_ptr<XdmfReader>
29
XdmfReader::New()
30
{
31
  shared_ptr<XdmfReader> p(new XdmfReader());
32
  return p;
33 34
}

35
XdmfReader::XdmfReader() :
36
  XdmfCoreReader(XdmfItemFactory::New())
37 38 39
{
}

40 41 42 43 44
XdmfReader::XdmfReader(const XdmfReader &) :
  XdmfCoreReader(XdmfItemFactory::New())
{
}

45 46 47
XdmfReader::~XdmfReader()
{
}
48

49 50 51 52 53 54
XdmfItem *
XdmfReader::DuplicatePointer(shared_ptr<XdmfItem> original) const
{
  return XdmfCoreReader::DuplicatePointer(original);
}

55 56
// Implemented to make SWIG wrapping work correctly
// (typemaps to return specific subclass instances of XdmfItems)
57
shared_ptr<XdmfItem>
58
XdmfReader::read(const std::string & filePath) const
59
{
60
  return XdmfCoreReader::read(filePath);
61
}
62

63
std::vector<shared_ptr<XdmfItem> >
64 65
XdmfReader::read(const std::string & filePath,
                 const std::string & xPath) const
66
{
67
  return XdmfCoreReader::read(filePath, xPath);
68
}
69 70 71 72 73

// C Wrappers

XDMFREADER * XdmfReaderNew()
{
74 75
  shared_ptr<XdmfReader> returnReader = XdmfReader::New();
  return (XDMFREADER *)((void *)(new XdmfReader(*returnReader.get())));
76 77 78 79
}

void XdmfReaderFree(XDMFREADER * item)
{
80
  delete ((XdmfReader *)item);
81 82 83
}

XDMF_CORE_READER_C_CHILD_WRAPPER(XdmfReader, XDMFREADER)