Commit a2aec845 authored by Bob Obara's avatar Bob Obara

ENH: Reducing the number of Loggers created in a ModelBuilder Session

* The issue was that the Attribute XML I/O code created their own Loggers instead of using the ones passed into the AttributeReader/Attribute/Writer classes. This mod changes this.
* Also removed internal XML related classes from being wrapped.
* Added a clearErrors method to the Logger to reset its error bit.
parent c67c3432
......@@ -241,27 +241,24 @@ void AttributeReaderInternals::parseXml(
// Lets see if any of the parsers can process the node
if (XmlDocV1Parser::canParse(root))
{
XmlDocV1Parser theReader(resource);
XmlDocV1Parser theReader(resource, logger);
theReader.setIncludeFileIndex(m_currentFileIndex);
theReader.setReportDuplicateDefinitionsAsErrors(reportAsError);
theReader.process(root);
logger.append(theReader.messageLog());
}
else if (XmlDocV2Parser::canParse(root))
{
XmlDocV2Parser theReader(resource);
XmlDocV2Parser theReader(resource, logger);
theReader.setIncludeFileIndex(m_currentFileIndex);
theReader.setReportDuplicateDefinitionsAsErrors(reportAsError);
theReader.process(root);
logger.append(theReader.messageLog());
}
else if (XmlDocV3Parser::canParse(root))
{
XmlDocV3Parser theReader(resource);
XmlDocV3Parser theReader(resource, logger);
theReader.setIncludeFileIndex(m_currentFileIndex);
theReader.setReportDuplicateDefinitionsAsErrors(reportAsError);
theReader.process(root);
logger.append(theReader.messageLog());
}
else
{
......
......@@ -63,14 +63,15 @@ unsigned int AttributeWriter::fileVersion() const
bool AttributeWriter::write(
const smtk::attribute::ResourcePtr resource, const std::string& filename, Logger& logger)
{
logger.reset();
XmlStringWriter* theWriter = this->newXmlStringWriter(resource);
// Lets first clear the logger's error state
logger.clearErrors();
XmlStringWriter* theWriter = this->newXmlStringWriter(resource, logger);
theWriter->includeDefinitions(m_includeDefinitions);
theWriter->includeInstances(m_includeInstances);
theWriter->includeViews(m_includeViews);
theWriter->useDirectoryInfo(m_useDirectoryInfo);
std::string result = theWriter->convertToString(logger);
std::string result = theWriter->convertToString();
if (m_useDirectoryInfo && (!logger.hasErrors()))
{
path p(filename);
......@@ -128,29 +129,29 @@ bool AttributeWriter::write(
bool AttributeWriter::writeContents(const smtk::attribute::ResourcePtr resource,
std::string& filecontents, Logger& logger, bool no_declaration)
{
logger.reset();
XmlStringWriter* theWriter = this->newXmlStringWriter(resource);
logger.clearErrors();
XmlStringWriter* theWriter = this->newXmlStringWriter(resource, logger);
theWriter->includeDefinitions(m_includeDefinitions);
theWriter->includeInstances(m_includeInstances);
theWriter->includeViews(m_includeViews);
theWriter->useDirectoryInfo(false);
filecontents = theWriter->convertToString(logger, no_declaration);
filecontents = theWriter->convertToString(no_declaration);
delete theWriter;
return logger.hasErrors();
}
XmlStringWriter* AttributeWriter::newXmlStringWriter(
const smtk::attribute::ResourcePtr resource) const
const smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger) const
{
XmlStringWriter* writer = NULL;
switch (m_fileVersion)
{
case 2:
writer = new XmlV2StringWriter(resource);
writer = new XmlV2StringWriter(resource, logger);
break;
case 3:
writer = new XmlV3StringWriter(resource);
writer = new XmlV3StringWriter(resource, logger);
break;
default:
......
......@@ -63,7 +63,8 @@ public:
protected:
// Instantiates internal writer
// Caller is responsible for deleting the instance
XmlStringWriter* newXmlStringWriter(const smtk::attribute::ResourcePtr resource) const;
XmlStringWriter* newXmlStringWriter(
const smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger) const;
private:
unsigned int m_fileVersion;
......
......@@ -135,6 +135,7 @@ public:
std::size_t numberOfRecords() const { return m_records.size(); }
bool hasErrors() const { return m_hasErrors; }
void clearErrors() { m_hasErrors = false; }
void addRecord(
Severity s, const std::string& m, const std::string& fname = "", unsigned int line = 0);
......
......@@ -378,9 +378,10 @@ void processDerivedValue(pugi::xml_node& node, ItemType item, attribute::Resourc
}
};
XmlDocV1Parser::XmlDocV1Parser(smtk::attribute::ResourcePtr myResource)
XmlDocV1Parser::XmlDocV1Parser(smtk::attribute::ResourcePtr myResource, smtk::io::Logger& logger)
: m_reportAsError(true)
, m_resource(myResource)
, m_logger(logger)
, m_includeIndex(0)
{
}
......@@ -484,9 +485,6 @@ void XmlDocV1Parser::process(xml_document& doc)
void XmlDocV1Parser::process(xml_node& amnode)
{
// Reset the message log
m_logger.reset();
// Lets get the UUID of the resource if there is one
auto idAtt = amnode.attribute("ID");
if (idAtt)
......@@ -501,7 +499,6 @@ void XmlDocV1Parser::process(xml_node& amnode)
m_attRefDefInfo.clear();
m_itemExpressionInfo.clear();
m_attRefInfo.clear();
m_logger.reset();
xml_node node, cnode;
// Get the category information, starting with current set
......
......@@ -60,14 +60,13 @@ struct ItemExpressionInfo
class SMTKCORE_EXPORT XmlDocV1Parser
{
public:
XmlDocV1Parser(smtk::attribute::ResourcePtr resource);
XmlDocV1Parser(smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger);
virtual ~XmlDocV1Parser();
virtual void process(pugi::xml_document& doc);
virtual void process(pugi::xml_node& rootNode);
// This function has no implementation!
static void convertStringToXML(std::string& str);
const smtk::io::Logger& messageLog() const { return m_logger; }
void setReportDuplicateDefinitionsAsErrors(bool mode) { m_reportAsError = mode; }
......@@ -155,7 +154,7 @@ protected:
std::vector<ItemExpressionInfo> m_itemExpressionInfo;
std::vector<AttRefInfo> m_attRefInfo;
std::string m_defaultCategory;
smtk::io::Logger m_logger;
smtk::io::Logger& m_logger;
std::size_t m_includeIndex;
private:
......
......@@ -37,8 +37,8 @@ using namespace pugi;
using namespace smtk::io;
using namespace smtk;
XmlDocV2Parser::XmlDocV2Parser(smtk::attribute::ResourcePtr myResource)
: XmlDocV1Parser(myResource)
XmlDocV2Parser::XmlDocV2Parser(smtk::attribute::ResourcePtr myResource, smtk::io::Logger& logger)
: XmlDocV1Parser(myResource, logger)
{
}
......
......@@ -24,7 +24,7 @@ namespace io
class SMTKCORE_EXPORT XmlDocV2Parser : public XmlDocV1Parser
{
public:
XmlDocV2Parser(smtk::attribute::ResourcePtr resource);
XmlDocV2Parser(smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger);
virtual ~XmlDocV2Parser();
void process(pugi::xml_document& doc) override;
void process(pugi::xml_node& rootNode) override { XmlDocV1Parser::process(rootNode); }
......
......@@ -37,8 +37,8 @@ using namespace pugi;
using namespace smtk::io;
using namespace smtk;
XmlDocV3Parser::XmlDocV3Parser(smtk::attribute::ResourcePtr myResource)
: XmlDocV2Parser(myResource)
XmlDocV3Parser::XmlDocV3Parser(smtk::attribute::ResourcePtr myResource, smtk::io::Logger& logger)
: XmlDocV2Parser(myResource, logger)
{
}
......
......@@ -25,7 +25,7 @@ namespace io
class SMTKCORE_EXPORT XmlDocV3Parser : public XmlDocV2Parser
{
public:
XmlDocV3Parser(smtk::attribute::ResourcePtr resource);
XmlDocV3Parser(smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger);
virtual ~XmlDocV3Parser();
void process(pugi::xml_document& doc) override;
void process(pugi::xml_node& rootNode) override;
......
......@@ -33,11 +33,12 @@ namespace io
class SMTKCORE_EXPORT XmlStringWriter
{
public:
XmlStringWriter(smtk::attribute::ResourcePtr resource)
XmlStringWriter(smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger)
: m_resource(resource)
, m_includeDefinitions(true)
, m_includeInstances(true)
, m_includeViews(true)
, m_logger(logger)
{
}
......@@ -48,12 +49,12 @@ public:
virtual std::string rootNodeName() const = 0;
virtual unsigned int fileVersion() const = 0;
virtual std::string convertToString(smtk::io::Logger& logger, bool no_declaration = false) = 0;
virtual std::string convertToString(bool no_declaration = false) = 0;
// If using the resource's DirectoryInfo - return the ith string (NOTE - make use you have called
// convertToString first!)
virtual std::string getString(std::size_t ith, bool no_declaration = false) = 0;
virtual void generateXml(smtk::io::Logger& logger) = 0;
virtual void generateXml() = 0;
//Control which sections of the attribute resource should be writtern out
// By Default all sections are processed. These are advance options!!
......@@ -77,7 +78,7 @@ protected:
bool m_includeViews;
bool m_useDirectoryInfo;
smtk::io::Logger m_logger;
smtk::io::Logger& m_logger;
};
} // namespace io
} // namespace smtk
......
......@@ -226,8 +226,9 @@ struct XmlV2StringWriter::Internals
std::vector<xml_node> m_roots, m_defs, m_atts, m_views;
};
XmlV2StringWriter::XmlV2StringWriter(const attribute::ResourcePtr myResource)
: XmlStringWriter(myResource)
XmlV2StringWriter::XmlV2StringWriter(
const attribute::ResourcePtr myResource, smtk::io::Logger& logger)
: XmlStringWriter(myResource, logger)
{
m_internals = new Internals();
}
......@@ -252,7 +253,7 @@ unsigned int XmlV2StringWriter::fileVersion() const
return 2;
}
std::string XmlV2StringWriter::convertToString(Logger& logger, bool no_declaration)
std::string XmlV2StringWriter::convertToString(bool no_declaration)
{
// Initialize the xml document(s)
std::size_t i, num = 1;
......@@ -294,7 +295,7 @@ std::string XmlV2StringWriter::convertToString(Logger& logger, bool no_declarati
}
// Generate the element tree
this->generateXml(logger);
this->generateXml();
// Serialize the result
oss.clear();
......@@ -322,11 +323,8 @@ std::string XmlV2StringWriter::getString(std::size_t i, bool no_declaration)
return result;
}
void XmlV2StringWriter::generateXml(Logger& logger)
void XmlV2StringWriter::generateXml()
{
// Reset the message log
m_logger.reset();
auto uuidName = m_resource->id().toString();
xml_node& root(m_internals->m_roots.at(0));
root.append_attribute("ID").set_value(uuidName.c_str());
......@@ -435,7 +433,6 @@ void XmlV2StringWriter::generateXml(Logger& logger)
{
this->processViews();
}
logger = m_logger;
}
void XmlV2StringWriter::processAttributeInformation()
......
......@@ -40,13 +40,12 @@ namespace io
class SMTKCORE_EXPORT XmlV2StringWriter : public XmlStringWriter
{
public:
XmlV2StringWriter(const smtk::attribute::ResourcePtr resource);
XmlV2StringWriter(const smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger);
virtual ~XmlV2StringWriter();
std::string convertToString(smtk::io::Logger& logger, bool no_declaration = false) override;
std::string convertToString(bool no_declaration = false) override;
virtual std::string getString(std::size_t ith, bool no_declaration = false) override;
void generateXml(smtk::io::Logger& logger) override;
const smtk::io::Logger& messageLog() const { return m_logger; }
void generateXml() override;
template <typename Container>
static std::string concatenate(
......
......@@ -32,8 +32,9 @@ namespace smtk
namespace io
{
XmlV3StringWriter::XmlV3StringWriter(const attribute::ResourcePtr myResource)
: XmlV2StringWriter(myResource)
XmlV3StringWriter::XmlV3StringWriter(
const attribute::ResourcePtr myResource, smtk::io::Logger& logger)
: XmlV2StringWriter(myResource, logger)
{
}
......@@ -56,9 +57,9 @@ std::string XmlV3StringWriter::rootNodeName() const
return std::string("SMTK_AttributeResource");
}
void XmlV3StringWriter::generateXml(smtk::io::Logger& logger)
void XmlV3StringWriter::generateXml()
{
XmlV2StringWriter::generateXml(logger);
XmlV2StringWriter::generateXml();
auto root = this->topRootNode();
// Process Resource Association Info
auto associations = m_resource->associations();
......
......@@ -33,9 +33,9 @@ namespace io
class SMTKCORE_EXPORT XmlV3StringWriter : public XmlV2StringWriter
{
public:
XmlV3StringWriter(const smtk::attribute::ResourcePtr resource);
XmlV3StringWriter(const smtk::attribute::ResourcePtr resource, smtk::io::Logger& logger);
virtual ~XmlV3StringWriter();
void generateXml(smtk::io::Logger& logger) override;
void generateXml() override;
protected:
// Override methods
......
......@@ -15,6 +15,9 @@
#include "smtk/io/AttributeReader.h"
#define PUGIXML_HEADER_ONLY
#include "pugixml/src/pugixml.cpp"
namespace py = pybind11;
PySharedPtrClass< smtk::io::AttributeReader > pybind11_init_smtk_io_AttributeReader(py::module &m)
......
......@@ -36,11 +36,6 @@ using PySharedPtrClass = py::class_<T, std::shared_ptr<T>, Args...>;
#include "PybindModelToMesh.h"
#include "PybindReadMesh.h"
#include "PybindWriteMesh.h"
#include "PybindXmlDocV1Parser.h"
#include "PybindXmlDocV2Parser.h"
#include "PybindXmlStringWriter.h"
#include "PybindXmlV2StringWriter.h"
#include "PybindXmlV3StringWriter.h"
#include "smtk/mesh/core/Resource.h"
......@@ -59,20 +54,14 @@ PYBIND11_MODULE(_smtkPybindIO, io)
PySharedPtrClass< smtk::io::mesh::MeshIOMoab > smtk_io_mesh_MeshIOMoab = pybind11_init_smtk_io_mesh_MeshIOMoab(mesh, smtk_io_mesh_MeshIO);
PySharedPtrClass< smtk::io::mesh::MeshIOXMS > smtk_io_mesh_MeshIOXMS = pybind11_init_smtk_io_mesh_MeshIOXMS(mesh, smtk_io_mesh_MeshIO);
PySharedPtrClass< smtk::io::AttRefInfo > smtk_io_AttRefInfo = pybind11_init_smtk_io_AttRefInfo(io);
PySharedPtrClass< smtk::io::AttributeReader > smtk_io_AttributeReader = pybind11_init_smtk_io_AttributeReader(io);
PySharedPtrClass< smtk::io::AttributeWriter > smtk_io_AttributeWriter = pybind11_init_smtk_io_AttributeWriter(io);
PySharedPtrClass< smtk::io::ExportMesh > smtk_io_ExportMesh = pybind11_init_smtk_io_ExportMesh(io);
PySharedPtrClass< smtk::io::ImportMesh > smtk_io_ImportMesh = pybind11_init_smtk_io_ImportMesh(io);
PySharedPtrClass< smtk::io::ItemExpressionInfo > smtk_io_ItemExpressionInfo = pybind11_init_smtk_io_ItemExpressionInfo(io);
PySharedPtrClass< smtk::io::Logger > smtk_io_Logger = pybind11_init_smtk_io_Logger(io);
PySharedPtrClass< smtk::io::ModelToMesh > smtk_io_ModelToMesh = pybind11_init_smtk_io_ModelToMesh(io);
PySharedPtrClass< smtk::io::ReadMesh > smtk_io_ReadMesh = pybind11_init_smtk_io_ReadMesh(io);
PySharedPtrClass< smtk::io::WriteMesh > smtk_io_WriteMesh = pybind11_init_smtk_io_WriteMesh(io);
PySharedPtrClass< smtk::io::XmlDocV1Parser > smtk_io_XmlDocV1Parser = pybind11_init_smtk_io_XmlDocV1Parser(io);
PySharedPtrClass< smtk::io::XmlStringWriter > smtk_io_XmlStringWriter = pybind11_init_smtk_io_XmlStringWriter(io);
PySharedPtrClass< smtk::io::XmlV2StringWriter > smtk_io_XmlV2StringWriter = pybind11_init_smtk_io_XmlV2StringWriter(io);
PySharedPtrClass< smtk::io::XmlV3StringWriter > smtk_io_XmlV3StringWriter = pybind11_init_smtk_io_XmlV3StringWriter(io);
pybind11_init__ZN4smtk2io10exportMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(io);
pybind11_init__ZN4smtk2io10exportMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENSA_INS_5model7ResourceEEES9_(io);
......@@ -100,5 +89,4 @@ PYBIND11_MODULE(_smtkPybindIO, io)
pybind11_init__ZN4smtk2io9writeMeshENSt3__110shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(io);
pybind11_init__ZN4smtk2io12writeNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(io);
pybind11_init__ZN4smtk2io12writeNeumannENSt3__110shared_ptrINS_4mesh10ResourceEEE(io);
PySharedPtrClass< smtk::io::XmlDocV2Parser > smtk_io_XmlDocV2Parser = pybind11_init_smtk_io_XmlDocV2Parser(io, smtk_io_XmlDocV1Parser);
}
......@@ -27,6 +27,7 @@ PySharedPtrClass< smtk::io::Logger > pybind11_init_smtk_io_Logger(py::module &m)
.def_static("instance", &smtk::io::Logger::instance, pybind11::return_value_policy::reference)
.def("numberOfRecords", &smtk::io::Logger::numberOfRecords)
.def("hasErrors", &smtk::io::Logger::hasErrors)
.def("clearErrors", &smtk::io::Logger::clearErrors)
.def("addRecord", &smtk::io::Logger::addRecord, py::arg("s"), py::arg("m"), py::arg("fname") = "", py::arg("line") = 0)
.def("record", &smtk::io::Logger::record, py::arg("i"))
.def("toString", (std::string (smtk::io::Logger::*)(::size_t, bool) const) &smtk::io::Logger::toString, py::arg("i"), py::arg("includeSourceLoc") = false)
......
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.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.
//=========================================================================
#ifndef pybind_smtk_io_XmlDocV1Parser_h
#define pybind_smtk_io_XmlDocV1Parser_h
#include <pybind11/pybind11.h>
#include "smtk/io/XmlDocV1Parser.h"
#define PUGIXML_HEADER_ONLY
#include "pugixml/src/pugixml.cpp"
#include "smtk/attribute/Attribute.h"
#include "smtk/attribute/Definition.h"
#include "smtk/attribute/DirectoryItem.h"
#include "smtk/attribute/DirectoryItemDefinition.h"
#include "smtk/attribute/DoubleItem.h"
#include "smtk/attribute/DoubleItemDefinition.h"
#include "smtk/attribute/FileItem.h"
#include "smtk/attribute/FileItemDefinition.h"
#include "smtk/attribute/GroupItem.h"
#include "smtk/attribute/GroupItemDefinition.h"
#include "smtk/attribute/IntItem.h"
#include "smtk/attribute/IntItemDefinition.h"
#include "smtk/attribute/Item.h"
#include "smtk/attribute/ItemDefinition.h"
#include "smtk/attribute/MeshItem.h"
#include "smtk/attribute/MeshItemDefinition.h"
#include "smtk/attribute/MeshSelectionItem.h"
#include "smtk/attribute/MeshSelectionItemDefinition.h"
#include "smtk/attribute/ModelEntityItem.h"
#include "smtk/attribute/ModelEntityItemDefinition.h"
#include "smtk/attribute/RefItemDefinition.h"
#include "smtk/attribute/StringItem.h"
#include "smtk/attribute/StringItemDefinition.h"
#include "smtk/attribute/Resource.h"
#include "smtk/attribute/ValueItem.h"
#include "smtk/attribute/ValueItemDefinition.h"
#include "smtk/attribute/VoidItem.h"
#include "smtk/attribute/VoidItemDefinition.h"
#include "smtk/model/Entity.h"
#include "smtk/model/EntityRef.h"
#include "smtk/model/EntityTypeBits.h"
#include "smtk/model/Resource.h"
namespace py = pybind11;
PySharedPtrClass< smtk::io::AttRefInfo > pybind11_init_smtk_io_AttRefInfo(py::module &m)
{
PySharedPtrClass< smtk::io::AttRefInfo > instance(m, "AttRefInfo");
instance
.def(py::init<>())
.def(py::init<::smtk::io::AttRefInfo const &>())
.def("deepcopy", (smtk::io::AttRefInfo & (smtk::io::AttRefInfo::*)(::smtk::io::AttRefInfo const &)) &smtk::io::AttRefInfo::operator=)
.def_readwrite("attName", &smtk::io::AttRefInfo::attName)
.def_readwrite("item", &smtk::io::AttRefInfo::item)
.def_readwrite("pos", &smtk::io::AttRefInfo::pos)
;
return instance;
}
PySharedPtrClass< smtk::io::ItemExpressionInfo > pybind11_init_smtk_io_ItemExpressionInfo(py::module &m)
{
PySharedPtrClass< smtk::io::ItemExpressionInfo > instance(m, "ItemExpressionInfo");
instance
.def(py::init<>())
.def(py::init<::smtk::io::ItemExpressionInfo const &>())
.def("deepcopy", (smtk::io::ItemExpressionInfo & (smtk::io::ItemExpressionInfo::*)(::smtk::io::ItemExpressionInfo const &)) &smtk::io::ItemExpressionInfo::operator=)
.def_readwrite("expName", &smtk::io::ItemExpressionInfo::expName)
.def_readwrite("item", &smtk::io::ItemExpressionInfo::item)
.def_readwrite("pos", &smtk::io::ItemExpressionInfo::pos)
;
return instance;
}
PySharedPtrClass< smtk::io::XmlDocV1Parser > pybind11_init_smtk_io_XmlDocV1Parser(py::module &m)
{
PySharedPtrClass< smtk::io::XmlDocV1Parser > instance(m, "XmlDocV1Parser");
instance
.def(py::init<::smtk::io::XmlDocV1Parser const &>())
.def(py::init<::smtk::attribute::ResourcePtr>())
.def_static("canParse", (bool (*)(::pugi::xml_document &)) &smtk::io::XmlDocV1Parser::canParse, py::arg("doc"))
.def_static("canParse", (bool (*)(::pugi::xml_node &)) &smtk::io::XmlDocV1Parser::canParse, py::arg("node"))
.def_static("getRootNode", &smtk::io::XmlDocV1Parser::getRootNode, py::arg("doc"))
.def("messageLog", &smtk::io::XmlDocV1Parser::messageLog)
.def("process", (void (smtk::io::XmlDocV1Parser::*)(::pugi::xml_document &)) &smtk::io::XmlDocV1Parser::process, py::arg("doc"))
.def("process", (void (smtk::io::XmlDocV1Parser::*)(::pugi::xml_node &)) &smtk::io::XmlDocV1Parser::process, py::arg("rootNode"))
.def("setReportDuplicateDefinitionsAsErrors", &smtk::io::XmlDocV1Parser::setReportDuplicateDefinitionsAsErrors, py::arg("mode"))
;
return instance;
}
#endif
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.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.
//=========================================================================
#ifndef pybind_smtk_io_XmlDocV2Parser_h
#define pybind_smtk_io_XmlDocV2Parser_h
#include <pybind11/pybind11.h>
#include "smtk/io/XmlDocV2Parser.h"
namespace py = pybind11;
PySharedPtrClass< smtk::io::XmlDocV2Parser > pybind11_init_smtk_io_XmlDocV2Parser(py::module &m, PySharedPtrClass< smtk::io::XmlDocV1Parser >& parent)
{
PySharedPtrClass< smtk::io::XmlDocV2Parser > instance(m, "XmlDocV2Parser", parent);
instance
.def(py::init<::smtk::io::XmlDocV2Parser const &>())
.def(py::init<::smtk::attribute::ResourcePtr>())
.def_static("canParse", (bool (*)(::pugi::xml_node &)) &smtk::io::XmlDocV2Parser::canParse, py::arg("node"))
.def_static("canParse", (bool (*)(::pugi::xml_document &)) &smtk::io::XmlDocV2Parser::canParse, py::arg("doc"))
.def_static("getRootNode", &smtk::io::XmlDocV2Parser::getRootNode, py::arg("doc"))
.def("process", (void (smtk::io::XmlDocV2Parser::*)(::pugi::xml_document &)) &smtk::io::XmlDocV2Parser::process, py::arg("doc"))
.def("process", (void (smtk::io::XmlDocV2Parser::*)(::pugi::xml_node &)) &smtk::io::XmlDocV2Parser::process, py::arg("rootNode"))
;
return instance;
}
#endif
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.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.
//=========================================================================
#ifndef pybind___XmlStringWriter_h
#define pybind___XmlStringWriter_h
#include <pybind11/pybind11.h>
#include "smtk/io/XmlStringWriter.h"
#include "smtk/io/Logger.h"
namespace py = pybind11;
PySharedPtrClass< smtk::io::XmlStringWriter > pybind11_init_smtk_io_XmlStringWriter(py::module &m)
{
PySharedPtrClass< smtk::io::XmlStringWriter > instance(m, "XmlStringWriter");
instance
.def("convertToString", &smtk::io::XmlStringWriter::convertToString, py::arg("logger"), py::arg("no_declaration") = false)
.def("fileVersion", &smtk::io::XmlStringWriter::fileVersion)
.def("generateXml", &smtk::io::XmlStringWriter::generateXml, py::arg("logger"))
.def("includeDefinitions", &smtk::io::XmlStringWriter::includeDefinitions, py::arg("val"))
.def("includeInstances", &smtk::io::XmlStringWriter::includeInstances, py::arg("val"))
.def("includeViews", &smtk::io::XmlStringWriter::includeViews, py::arg("val"))
;
return instance;
}
#endif
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.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.
//=========================================================================
#ifndef pybind_smtk_io_XmlV2StringWriter_h
#define pybind_smtk_io_XmlV2StringWriter_h
#include <pybind11/pybind11.h>
#include "smtk/io/XmlV2StringWriter.h"
#include "smtk/attribute/Resource.h"
#include "smtk/io/Logger.h"
#include "smtk/io/XmlStringWriter.h"
namespace py = pybind11;
PySharedPtrClass< smtk::io::XmlV2StringWriter, smtk::io::XmlStringWriter > pybind11_init_smtk_io_XmlV2StringWriter(py::module &m)
{
PySharedPtrClass< smtk::io::XmlV2StringWriter, smtk::io::XmlStringWriter > instance(m, "XmlV2StringWriter");
instance
.def(py::init<::smtk::io::XmlV2StringWriter const &>())
.def(py::init<::smtk::attribute::ResourcePtr>())
.def("convertToString", &smtk::io::XmlV2StringWriter::convertToString, py::arg("logger"), py::arg("no_declaration") = false)
.def("generateXml", &smtk::io::XmlV2StringWriter::generateXml, py::arg("logger"))
.def("messageLog", &smtk::io::XmlV2StringWriter::messageLog)
;
return instance;
}
#endif
//=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.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.
//=========================================================================
#ifndef pybind_smtk_io_XmlV3StringWriter_h
#define pybind_smtk_io_XmlV3StringWriter_h
#include <pybind11/pybind11.h>
#include "smtk/io/XmlV3StringWriter.h"
#include "smtk/attribute/Resource.h"
#include "smtk/io/XmlV2StringWriter.h"
namespace py = pybind11;
PySharedPtrClass< smtk::io::XmlV3StringWriter, smtk::io::XmlV2StringWriter > pybind11_init_smtk_io_XmlV3StringWriter(py::module &m)
{
PySharedPtrClass< smtk::io::XmlV3StringWriter, smtk::io::XmlV2StringWriter > instance(m, "XmlV3StringWriter");
instance
.def(py::init<::smtk::io::XmlV3StringWriter const &>())
.def(py::init<::smtk::attribute::ResourcePtr>())
;
return instance;
}
#endif
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