Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
a66870ec
Commit
a66870ec
authored
Aug 24, 2012
by
Davis King
Browse files
merged
parents
ea2d8ddc
f351fad5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
dlib/serialize.h
dlib/serialize.h
+62
-0
No files found.
dlib/serialize.h
View file @
a66870ec
...
...
@@ -54,6 +54,7 @@
- std::wstring
- std::vector
- std::map
- std::set
- std::pair
- std::complex
- dlib::uint64
...
...
@@ -69,6 +70,7 @@
- std::wstring
- std::vector
- std::map
- std::set
- std::pair
- std::complex
- dlib::uint64
...
...
@@ -123,6 +125,7 @@
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <limits>
#include "uintn.h"
#include "interfaces/enumerable.h"
...
...
@@ -565,6 +568,18 @@ namespace dlib
std
::
istream
&
in
);
template
<
typename
domain
,
typename
compare
,
typename
alloc
>
void
serialize
(
const
std
::
set
<
domain
,
compare
,
alloc
>&
item
,
std
::
ostream
&
out
);
template
<
typename
domain
,
typename
compare
,
typename
alloc
>
void
deserialize
(
std
::
set
<
domain
,
compare
,
alloc
>&
item
,
std
::
istream
&
in
);
template
<
typename
T
,
typename
alloc
>
void
serialize
(
const
std
::
vector
<
T
,
alloc
>&
item
,
...
...
@@ -744,6 +759,53 @@ namespace dlib
{
throw
serialization_error
(
e
.
info
+
"
\n
while deserializing object of type std::map"
);
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
domain
,
typename
compare
,
typename
alloc
>
void
serialize
(
const
std
::
set
<
domain
,
compare
,
alloc
>&
item
,
std
::
ostream
&
out
)
{
try
{
const
unsigned
long
size
=
static_cast
<
unsigned
long
>
(
item
.
size
());
serialize
(
size
,
out
);
typename
std
::
set
<
domain
,
compare
,
alloc
>::
const_iterator
i
;
for
(
i
=
item
.
begin
();
i
!=
item
.
end
();
++
i
)
{
serialize
(
*
i
,
out
);
}
}
catch
(
serialization_error
&
e
)
{
throw
serialization_error
(
e
.
info
+
"
\n
while serializing object of type std::set"
);
}
}
template
<
typename
domain
,
typename
compare
,
typename
alloc
>
void
deserialize
(
std
::
set
<
domain
,
compare
,
alloc
>&
item
,
std
::
istream
&
in
)
{
try
{
item
.
clear
();
unsigned
long
size
;
deserialize
(
size
,
in
);
domain
d
;
for
(
unsigned
long
i
=
0
;
i
<
size
;
++
i
)
{
deserialize
(
d
,
in
);
item
.
insert
(
d
);
}
}
catch
(
serialization_error
&
e
)
{
throw
serialization_error
(
e
.
info
+
"
\n
while deserializing object of type std::set"
);
}
}
// ----------------------------------------------------------------------------------------
template
<
typename
T
,
typename
alloc
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment