Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CaseDatasetSource.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* CaseDatasetSource.cc (C) 2000-2021 */
9/* */
10/* Source of a case dataset. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/CaseDatasetSource.h"
15
16#include "arcane/utils/String.h"
17#include "arcane/utils/Array.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
29{
30 public:
31
32 String m_file_name;
33 UniqueArray<std::byte> m_content;
34};
35
36/*---------------------------------------------------------------------------*/
37/*---------------------------------------------------------------------------*/
38
39CaseDatasetSource::
40CaseDatasetSource()
41: m_p(new Impl())
42{
43}
44
45/*---------------------------------------------------------------------------*/
46/*---------------------------------------------------------------------------*/
47
48CaseDatasetSource::
49CaseDatasetSource(const CaseDatasetSource& rhs)
50: m_p(new Impl(*rhs.m_p))
51{
52}
53
54/*---------------------------------------------------------------------------*/
55/*---------------------------------------------------------------------------*/
56
57CaseDatasetSource& CaseDatasetSource::
58operator=(const CaseDatasetSource& rhs)
59{
60 if (&rhs != this) {
61 delete m_p;
62 m_p = new Impl(*rhs.m_p);
63 }
64 return *this;
65}
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70CaseDatasetSource::
71~CaseDatasetSource()
72{
73 delete m_p;
74}
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
79setFileName(const String& name)
80{
81 m_p->m_file_name = name;
82}
83
84/*---------------------------------------------------------------------------*/
85/*---------------------------------------------------------------------------*/
86
88fileName() const
89{
90 return m_p->m_file_name;
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
97setContent(ByteConstSpan bytes)
98{
99 m_p->m_content = bytes;
100}
101
102/*---------------------------------------------------------------------------*/
103/*---------------------------------------------------------------------------*/
104
107{
108 auto d = reinterpret_cast<const std::byte*>(bytes.data());
109 m_p->m_content = ByteConstSpan(d, bytes.size());
110}
111
112/*---------------------------------------------------------------------------*/
113/*---------------------------------------------------------------------------*/
114
116content() const
117{
118 return m_p->m_content;
119}
120
121/*---------------------------------------------------------------------------*/
122/*---------------------------------------------------------------------------*/
123
124} // End namespace Arcane
125
126/*---------------------------------------------------------------------------*/
127/*---------------------------------------------------------------------------*/
Source of a case dataset.
void setFileName(const String &name)
Sets the file name of the dataset.
String fileName() const
File name of the dataset.
void setContent(Span< const std::byte > bytes)
Sets the content of the dataset.
ByteConstSpan content() const
Content of the dataset.
View of an array of elements of type T.
Definition Span.h:635
1D data vector with value semantics (STL style).
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Span< const std::byte > ByteConstSpan
Read-only view of a 1D array of characters.
Definition UtilsTypes.h:548