Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-cpplib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-cpplib
Commits
4625ad87
Verified
Commit
4625ad87
authored
3 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
EHN: Add ToString to ProtoMessageWrapper
parent
b0d5af32
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!25
F cpp to string
Pipeline
#13624
passed
3 years ago
Stage: info
Stage: setup
Stage: test
Stage: deploy
Pipeline: caosdb-cppinttest
#13626
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/caosdb/protobuf_helper.h
+13
-3
13 additions, 3 deletions
include/caosdb/protobuf_helper.h
include/caosdb/value.h
+6
-15
6 additions, 15 deletions
include/caosdb/value.h
src/caosdb/entity.cpp
+6
-7
6 additions, 7 deletions
src/caosdb/entity.cpp
with
25 additions
and
25 deletions
include/caosdb/protobuf_helper.h
+
13
−
3
View file @
4625ad87
...
...
@@ -22,9 +22,11 @@
#ifndef CAOSDB_PROTOBUF_HELPER_H
#define CAOSDB_PROTOBUF_HELPER_H
#include
"caosdb/status_code.h"
#include
<google/protobuf/arena.h>
// for Arena
#include
<google/protobuf/extension_set.h>
// for Arena
#include
"caosdb/status_code.h"
// for StatusCode, SUCCESS
#include
<google/protobuf/arena.h>
// for Arena
#include
<google/protobuf/extension_set.h>
// for Arena
#include
<google/protobuf/util/json_util.h>
// for JsonOptions, MessageToJs...
#include
<string>
// for string
#define CAOSDB_DEBUG_MESSAGE_STRING(message, out) \
std::string out; \
...
...
@@ -47,6 +49,14 @@ public:
return
StatusCode
::
SUCCESS
;
}
/**
* Return a json representation of this object.
*/
inline
auto
ToString
()
const
noexcept
->
const
std
::
string
{
CAOSDB_DEBUG_MESSAGE_STRING
(
*
wrapped
,
out
)
return
out
;
}
protected
:
ProtoMessageWrapper
()
:
ProtoMessageWrapper
(
Arena
::
CreateMessage
<
P
>
(
get_arena
()))
{}
ProtoMessageWrapper
(
P
*
wrapped
)
:
wrapped
(
wrapped
)
{}
...
...
This diff is collapsed.
Click to expand it.
include/caosdb/value.h
+
6
−
15
View file @
4625ad87
...
...
@@ -22,17 +22,13 @@
#ifndef CAOSDB_VALUE_H
#define CAOSDB_VALUE_H
#include
"caosdb/protobuf_helper.h"
// for ProtoMessageWrapper
#include
"caosdb/logging.h"
// IWYU pragma: keep
#include
"caosdb/entity/v1alpha1/main.pb.h"
// for RepeatedPtrField, Message
#include
<cstdint>
// for int64_t
#include
<google/protobuf/arena.h>
// for Arena
#include
<google/protobuf/generated_message_util.h>
// for Arena
#include
<google/protobuf/util/json_util.h>
// IWYU pragma: keep
#include
<memory>
// for unique_ptr
#include
<string>
// for string, operator==
#include
<utility>
// for move
#include
<vector>
// for vector
#include
<cstdint>
// for int64_t
#include
<google/protobuf/arena.h>
// for Arena
#include
<memory>
// for unique_ptr
#include
<string>
// for string, operator==
#include
<utility>
// for move
#include
<vector>
// for vector
#define LIST_VALUE_CONSTRUCTOR(TYPE, SETTER) \
explicit inline Value(const std::vector<TYPE> &values) : ProtoMessageWrapper<ProtoValue>() { \
...
...
@@ -412,11 +408,6 @@ public:
return
*
this
;
}
inline
auto
ToString
()
const
noexcept
->
const
std
::
string
{
CAOSDB_DEBUG_MESSAGE_STRING
(
*
wrapped
,
out
)
return
out
;
}
friend
class
Entity
;
friend
class
Property
;
...
...
This diff is collapsed.
Click to expand it.
src/caosdb/entity.cpp
+
6
−
7
View file @
4625ad87
...
...
@@ -20,13 +20,12 @@
*
*/
#include
"caosdb/entity.h"
#include
"caosdb/data_type.h"
// for DataType
#include
"caosdb/entity/v1alpha1/main.pb.h"
// for Messages
#include
"caosdb/protobuf_helper.h"
// for get_arena
#include
"caosdb/value.h"
// for Value
#include
<google/protobuf/arena.h>
// for Arena
#include
<google/protobuf/generated_message_util.h>
// for Arena::Create...
#include
<new>
// for operator new
#include
"caosdb/data_type.h"
// for DataType
#include
"caosdb/entity/v1alpha1/main.pb.h"
// for Messages
#include
"caosdb/protobuf_helper.h"
// for get_arena
#include
"caosdb/value.h"
// for Value
#include
<google/protobuf/arena.h>
// for Arena
#include
<new>
// for operator new
namespace
caosdb
::
entity
{
using
ProtoParent
=
caosdb
::
entity
::
v1alpha1
::
Parent
;
...
...
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