Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
5d99c379
There was an error fetching the commit references. Please try again later.
Commit
5d99c379
authored
5 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Implementing serialization/deserialization of StaticArray.
parent
11593e3b
No related branches found
No related tags found
1 merge request
!41
Tutorials
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TNL/Containers/StaticArray.h
+19
-0
19 additions, 0 deletions
src/TNL/Containers/StaticArray.h
src/TNL/Containers/StaticArray.hpp
+32
-0
32 additions, 0 deletions
src/TNL/Containers/StaticArray.hpp
with
51 additions
and
0 deletions
src/TNL/Containers/StaticArray.h
+
19
−
0
View file @
5d99c379
...
@@ -230,6 +230,25 @@ protected:
...
@@ -230,6 +230,25 @@ protected:
template
<
int
Size
,
typename
Value
>
template
<
int
Size
,
typename
Value
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
str
,
const
StaticArray
<
Size
,
Value
>&
a
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
str
,
const
StaticArray
<
Size
,
Value
>&
a
);
/**
* \brief Serialization of arrays into binary files.
*/
template
<
int
Size
,
typename
Value
>
File
&
operator
<<
(
File
&
file
,
const
StaticArray
<
Size
,
Value
>&
array
);
template
<
int
Size
,
typename
Value
>
File
&
operator
<<
(
File
&&
file
,
const
StaticArray
<
Size
,
Value
>&
array
);
/**
* \brief Deserialization of arrays from binary files.
*/
template
<
int
Size
,
typename
Value
>
File
&
operator
>>
(
File
&
file
,
StaticArray
<
Size
,
Value
>&
array
);
template
<
int
Size
,
typename
Value
>
File
&
operator
>>
(
File
&&
file
,
StaticArray
<
Size
,
Value
>&
array
);
}
// namespace Containers
}
// namespace Containers
}
// namespace TNL
}
// namespace TNL
...
...
This diff is collapsed.
Click to expand it.
src/TNL/Containers/StaticArray.hpp
+
32
−
0
View file @
5d99c379
...
@@ -343,5 +343,37 @@ std::ostream& operator<<( std::ostream& str, const StaticArray< Size, Value >& a
...
@@ -343,5 +343,37 @@ std::ostream& operator<<( std::ostream& str, const StaticArray< Size, Value >& a
return
str
;
return
str
;
}
}
// Serialization of arrays into binary files.
template
<
int
Size
,
typename
Value
>
File
&
operator
<<
(
File
&
file
,
const
StaticArray
<
Size
,
Value
>&
array
)
{
for
(
int
i
=
0
;
i
<
Size
;
i
++
)
file
.
save
(
&
array
[
i
]
);
return
file
;
}
template
<
int
Size
,
typename
Value
>
File
&
operator
<<
(
File
&&
file
,
const
StaticArray
<
Size
,
Value
>&
array
)
{
File
&
f
=
file
;
return
f
<<
array
;
}
// Deserialization of arrays from binary files.
template
<
int
Size
,
typename
Value
>
File
&
operator
>>
(
File
&
file
,
StaticArray
<
Size
,
Value
>&
array
)
{
for
(
int
i
=
0
;
i
<
Size
;
i
++
)
file
.
load
(
&
array
[
i
]
);
return
file
;
}
template
<
int
Size
,
typename
Value
>
File
&
operator
>>
(
File
&&
file
,
StaticArray
<
Size
,
Value
>&
array
)
{
File
&
f
=
file
;
return
f
>>
array
;
}
}
// namespace Containers
}
// namespace Containers
}
// namespace TNL
}
// namespace TNL
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment