Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Project Juggler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
EIC
Project Juggler
Commits
d8e095f1
Commit
d8e095f1
authored
2 years ago
by
Sylvester Joosten
Browse files
Options
Downloads
Patches
Plain Diff
Fix inaccuracies in comments
parent
0e11fb38
Branches
Branches containing commit
No related tags found
1 merge request
!464
Draft: working implemenation of Property
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/algorithms/property.h
+4
-1
4 additions, 1 deletion
core/algorithms/property.h
core/algorithms/service.h
+5
-5
5 additions, 5 deletions
core/algorithms/service.h
with
9 additions
and
6 deletions
core/algorithms/property.h
+
4
−
1
View file @
d8e095f1
...
@@ -67,7 +67,7 @@ public:
...
@@ -67,7 +67,7 @@ public:
Property
(
const
Property
&
)
=
delete
;
Property
(
const
Property
&
)
=
delete
;
void
operator
=
(
const
Property
&
)
=
delete
;
void
operator
=
(
const
Property
&
)
=
delete
;
// Only settable by explicitly calling the
value operator
// Only settable by explicitly calling the
::set() member functio n
// as we want the Property to mostly act as if it is constant
// as we want the Property to mostly act as if it is constant
virtual
void
set
(
std
::
any
v
)
{
virtual
void
set
(
std
::
any
v
)
{
m_value
=
std
::
any_cast
<
T
>
(
v
);
m_value
=
std
::
any_cast
<
T
>
(
v
);
...
@@ -77,6 +77,9 @@ public:
...
@@ -77,6 +77,9 @@ public:
// version that does not go through std::any
// version that does not go through std::any
// Get const reference to the value
// Get const reference to the value
virtual
std
::
any
get
()
const
{
return
m_value
;
}
virtual
std
::
any
get
()
const
{
return
m_value
;
}
// Direct access to the value. Use this one whenever possible (or go through the
// automatic casting)
const
ValueType
&
value
()
const
{
return
m_value
;
}
const
ValueType
&
value
()
const
{
return
m_value
;
}
// automatically cast to T
// automatically cast to T
...
...
This diff is collapsed.
Click to expand it.
core/algorithms/service.h
+
5
−
5
View file @
d8e095f1
...
@@ -21,10 +21,10 @@ namespace algorithms {
...
@@ -21,10 +21,10 @@ namespace algorithms {
// Service service --> keeps track of all services :)
// Service service --> keeps track of all services :)
// --> exposes the underlying
property mixin
of the service so
// --> exposes the underlying
Configurable object
of the service so
// we can configure the services by name in the framework
// we can configure the services by name in the framework
// boundary plugin
// boundary plugin
// --> Special service (does not use the
s
ervice
mixin
to avoid
// --> Special service (does not use the
S
ervice
base class
to avoid
// circularity)
// circularity)
class
ServiceSvc
{
class
ServiceSvc
{
public:
public:
...
@@ -57,7 +57,7 @@ class ServiceSvc {
...
@@ -57,7 +57,7 @@ class ServiceSvc {
};
};
// Thread-safe lazy-evaluated minimal service system
// Thread-safe lazy-evaluated minimal service system
// CRTP
mixin
to add the instance method
// CRTP
base class
to add the instance method
// This could have been part of DEFINE_SERVICE macro, but I think it is better
// This could have been part of DEFINE_SERVICE macro, but I think it is better
// to keep the macro magic to a minimum to maximize transparency
// to keep the macro magic to a minimum to maximize transparency
template
<
class
SvcType
>
class
Service
:
public
PropertyMixin
{
template
<
class
SvcType
>
class
Service
:
public
PropertyMixin
{
...
@@ -67,8 +67,8 @@ template <class SvcType> class Service : public PropertyMixin {
...
@@ -67,8 +67,8 @@ template <class SvcType> class Service : public PropertyMixin {
static
SvcType
svc
;
static
SvcType
svc
;
return
svc
;
return
svc
;
}
}
// constructor for the service
mixin
registers the service, except
// constructor for the service
base class
registers the service, except
// for the ServiceSvc which is its own thing (a
nd that would be
cir
i
cular)
// for the ServiceSvc which is its own thing (a
void
circular
ity
)
Service
(
std
::
string_view
name
)
{
Service
(
std
::
string_view
name
)
{
ServiceSvc
::
instance
().
add
(
name
,
this
);
ServiceSvc
::
instance
().
add
(
name
,
this
);
}
}
...
...
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