14#include "arcane/utils/ArcanePrecomp.h"
16#include "arcane/utils/Iostream.h"
17#include "arcane/utils/Array.h"
18#include "arcane/utils/PlatformUtils.h"
19#include "arcane/utils/ITraceMng.h"
20#include "arcane/utils/CheckedConvert.h"
22#include "arcane/core/IApplication.h"
23#include "arcane/core/DomUtils.h"
24#include "arcane/core/XmlNode.h"
25#include "arcane/core/IIOMng.h"
26#include "arcane/core/IParallelSuperMng.h"
27#include "arcane/core/IParallelMng.h"
28#include "arcane/core/IXmlDocumentHolder.h"
75 template <
typename ParallelMngType>
bool
76 _collectiveRead(ParallelMngType* pm,
const String& filename,
ByteArray& bytes,
bool is_binary);
82extern "C++" ARCANE_IMPL_EXPORT IIOMng*
83arcaneCreateIOMng(IParallelMng* pm)
88extern "C++" ARCANE_IMPL_EXPORT
IIOMng*
91 return new IOMng(psm);
100, m_parallel_super_mng(nullptr)
101, m_thread_mng(pm->threadMng())
102, m_trace_mng(pm->traceMng())
111: m_parallel_mng(nullptr)
112, m_parallel_super_mng(psm)
113, m_thread_mng(psm->threadMng())
114, m_trace_mng(psm->application()->traceMng())
134 std::ofstream ofile(filename.
localstr());
140 Integer indented = to_indent ? 1 : -1;
164 return domimp.
_load(filename, m_trace_mng, schemaname, schema_data);
193 ByteConstSpan buffer(
reinterpret_cast<const std::byte*
>(utf8_buf.
data()), utf8_buf.
size());
195 return domimp.
_load(buffer, name, m_trace_mng);
201template <
typename ParallelMngType>
203_collectiveRead(ParallelMngType* pm,
const String& filename,
ByteArray& bytes,
bool is_binary)
209 if (pm->commRank() == 0) {
210 if (!
localRead(filename, bytes, is_binary)) {
217 pm->broadcast(bs, 0);
222 pm->broadcast(bytes, 0);
223 return bytes.empty();
233 return _collectiveRead(m_parallel_mng, filename, bytes, is_binary);
234 return _collectiveRead(m_parallel_super_mng, filename, bytes, is_binary);
constexpr const_pointer data() const noexcept
Pointer to the allocated memory.
constexpr Integer size() const noexcept
Number of elements in the array.
Interface of the input/output manager.
IXmlDocumentHolder * parseXmlBuffer(Span< const Byte > buffer, const String &name) override
Reads and parses the XML file contained in the buffer buffer.
bool localRead(const String &filename, ByteArray &bytes) override
Local reading of a file.
IXmlDocumentHolder * parseXmlString(const String &str, const String &name) override
Reads and parses the XML file contained in the string str.
bool collectiveRead(const String &filename, ByteArray &bytes) override
Collective reading of a file.
bool writeXmlFile(IXmlDocumentHolder *doc, const String &filename, const bool indented) override
Writes the XML tree of the document doc to the file filename.
IXmlDocumentHolder * parseXmlFile(const String &filename, const String &schemaname=String()) override
Reads and parses the XML file filename.
Interface of the parallelism manager for a subdomain.
Abstract class of the parallelism supervisor.
Interface of a thread manager.
Manager of a DOM document.
static IXmlDocumentHolder * loadFromBuffer(Span< const Byte > buffer, const String &name, ITraceMng *tm)
Loads an XML document.
virtual XmlNode documentNode()=0
Document node. This node is null if the document does not exist.
static IXmlDocumentHolder * loadFromFile(const String &filename, ITraceMng *tm)
Loads an XML document.
View of an array of elements of type T.
Unicode character string.
const char * localstr() const
Returns the conversion of the instance into UTF-8 encoding.
ByteConstArrayView utf8() const
Returns the conversion of the instance into UTF-8 encoding.
dom::Node domNode() const
IXmlDocumentHolder * _load(const String &fname, ITraceMng *msg, const String &schemaname)
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
Array< Byte > ByteArray
Dynamic one-dimensional array of characters.
ArrayView< Integer > IntegerArrayView
C equivalent of a 1D array of integers.
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.