Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
HEPnOS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sds
HEP
HEPnOS
Commits
fc5472c0
Commit
fc5472c0
authored
Apr 13, 2018
by
Matthieu Dorier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storeRawData and loadRawData are now public
parent
e4b3a9c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
29 deletions
+30
-29
include/hepnos/DataSet.hpp
include/hepnos/DataSet.hpp
+28
-27
src/DataSet.cpp
src/DataSet.cpp
+2
-2
No files found.
include/hepnos/DataSet.hpp
View file @
fc5472c0
...
...
@@ -43,31 +43,6 @@ class DataSet {
*/
DataSet
(
DataStore
*
ds
,
uint8_t
level
,
const
std
::
string
&
container
,
const
std
::
string
&
name
);
/**
* @brief Stores binary data associated with a particular key into this DataSet.
* This function will return true if the key did not already exist and the
* write succeeded. It will return false otherwise.
*
* @param key Key.
* @param buffer Binary data to insert.
*
* @return trye if the key did not already exist and the write succeeded,
* false otherwise.
*/
bool
storeBuffer
(
const
std
::
string
&
key
,
const
std
::
vector
<
char
>&
buffer
);
/**
* @brief Loads binary data associated with a particular key from the DataSet.
* This function will return true if the key exists and the read succeeded.
* It will return false otherwise.
*
* @param key Key.
* @param buffer Buffer in which to put the binary data.
*
* @return true if the key exists and the read succeeded,
* false otherwise.
*/
bool
loadBuffer
(
const
std
::
string
&
key
,
std
::
vector
<
char
>&
buffer
)
const
;
/**
* @brief Implementation class (used for the Pimpl idiom).
...
...
@@ -162,6 +137,32 @@ class DataSet {
*/
bool
valid
()
const
;
/**
* @brief Stores binary data associated with a particular key into this DataSet.
* This function will return true if the key did not already exist and the
* write succeeded. It will return false otherwise.
*
* @param key Key.
* @param buffer Binary data to insert.
*
* @return trye if the key did not already exist and the write succeeded,
* false otherwise.
*/
bool
storeRawData
(
const
std
::
string
&
key
,
const
std
::
vector
<
char
>&
buffer
);
/**
* @brief Loads binary data associated with a particular key from the DataSet.
* This function will return true if the key exists and the read succeeded.
* It will return false otherwise.
*
* @param key Key.
* @param buffer Buffer in which to put the binary data.
*
* @return true if the key exists and the read succeeded,
* false otherwise.
*/
bool
loadRawData
(
const
std
::
string
&
key
,
std
::
vector
<
char
>&
buffer
)
const
;
/**
* @brief Stores a key/value pair into the DataSet.
* The type of the key should have operator<< available
...
...
@@ -188,7 +189,7 @@ class DataSet {
}
std
::
string
serialized
=
ss_value
.
str
();
std
::
vector
<
char
>
buffer
(
serialized
.
begin
(),
serialized
.
end
());
return
store
Buffer
(
key
,
buffer
);
return
store
RawData
(
key
,
buffer
);
}
/**
...
...
@@ -209,7 +210,7 @@ class DataSet {
template
<
typename
K
,
typename
V
>
bool
load
(
const
K
&
key
,
V
&
value
)
const
{
std
::
vector
<
char
>
buffer
;
if
(
!
load
Buffer
(
key
,
buffer
))
{
if
(
!
load
RawData
(
key
,
buffer
))
{
return
false
;
}
try
{
...
...
src/DataSet.cpp
View file @
fc5472c0
...
...
@@ -66,7 +66,7 @@ bool DataSet::valid() const {
}
bool
DataSet
::
store
Buffer
(
const
std
::
string
&
key
,
const
std
::
vector
<
char
>&
buffer
)
{
bool
DataSet
::
store
RawData
(
const
std
::
string
&
key
,
const
std
::
vector
<
char
>&
buffer
)
{
if
(
!
valid
())
{
throw
Exception
(
"Calling store() on invalid DataSet"
);
}
...
...
@@ -74,7 +74,7 @@ bool DataSet::storeBuffer(const std::string& key, const std::vector<char>& buffe
return
m_impl
->
m_datastore
->
m_impl
->
store
(
0
,
fullname
(),
key
,
buffer
);
}
bool
DataSet
::
load
Buffer
(
const
std
::
string
&
key
,
std
::
vector
<
char
>&
buffer
)
const
{
bool
DataSet
::
load
RawData
(
const
std
::
string
&
key
,
std
::
vector
<
char
>&
buffer
)
const
{
if
(
!
valid
())
{
throw
Exception
(
"Calling load() on invalid DataSet"
);
}
...
...
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