Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Nicolas Pope
ftl
Commits
08f22c35
Commit
08f22c35
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Allow use of tags in URIs
parent
9a9eb50a
No related branches found
No related tags found
1 merge request
!181
Implements #240 custom shortcuts
Pipeline
#16757
failed
5 years ago
Stage: all
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
applications/gui/src/main.cpp
+1
-1
1 addition, 1 deletion
applications/gui/src/main.cpp
applications/reconstruct/src/main.cpp
+1
-1
1 addition, 1 deletion
applications/reconstruct/src/main.cpp
components/common/cpp/src/configuration.cpp
+39
-14
39 additions, 14 deletions
components/common/cpp/src/configuration.cpp
with
41 additions
and
16 deletions
applications/gui/src/main.cpp
+
1
−
1
View file @
08f22c35
...
...
@@ -30,7 +30,7 @@ int main(int argc, char **argv) {
ftl
::
UUID
peer
=
p
->
id
();
auto
cs
=
controller
->
getConfigurables
(
peer
);
for
(
auto
c
:
cs
)
{
LOG
(
INFO
)
<<
"NET CONFIG: "
<<
c
;
//
LOG(INFO) << "NET CONFIG: " << c;
ftl
::
config
::
json_t
*
configuration
=
new
ftl
::
config
::
json_t
;
*
configuration
=
controller
->
get
(
peer
,
c
);
if
(
!
configuration
->
empty
())
{
...
...
This diff is collapsed.
Click to expand it.
applications/reconstruct/src/main.cpp
+
1
−
1
View file @
08f22c35
...
...
@@ -241,7 +241,7 @@ static void run(ftl::Configurable *root) {
//ftl::voxhash::SceneRep *scene = ftl::create<ftl::voxhash::SceneRep>(root, "voxelhash");
ftl
::
rgbd
::
Streamer
*
stream
=
ftl
::
create
<
ftl
::
rgbd
::
Streamer
>
(
root
,
"stream"
,
net
);
ftl
::
rgbd
::
VirtualSource
*
virt
=
ftl
::
create
<
ftl
::
rgbd
::
VirtualSource
>
(
root
,
"virtual"
);
root
->
set
(
"tags"
,
nlohmann
::
json
::
array
({
root
->
getID
()
+
"/virtual"
}));
//
root->set("tags", nlohmann::json::array({ root->getID()+"/virtual" }));
ftl
::
render
::
Triangular
*
splat
=
ftl
::
create
<
ftl
::
render
::
Triangular
>
(
root
,
"renderer"
,
&
scene_B
);
ftl
::
rgbd
::
Group
*
group
=
new
ftl
::
rgbd
::
Group
;
ftl
::
ILW
*
align
=
ftl
::
create
<
ftl
::
ILW
>
(
root
,
"merge"
);
...
...
This diff is collapsed.
Click to expand it.
components/common/cpp/src/configuration.cpp
+
39
−
14
View file @
08f22c35
...
...
@@ -229,6 +229,7 @@ void ftl::config::registerConfigurable(ftl::Configurable *cfg) {
auto
tags
=
cfg
->
get
<
vector
<
string
>>
(
"tags"
);
if
(
tags
)
{
for
(
auto
&
t
:
*
tags
)
{
//LOG(INFO) << "REGISTER TAG: " << t;
tag_index
[
t
].
push_back
(
cfg
);
}
}
...
...
@@ -237,22 +238,45 @@ void ftl::config::registerConfigurable(ftl::Configurable *cfg) {
json_t
null_json
;
/* To allow for custom tag format */
static
std
::
string
preprocessURI
(
const
std
::
string
&
uri
)
{
if
(
uri
[
0
]
==
'['
)
{
size_t
closing
=
uri
.
find_last_of
(
']'
);
string
tags
=
uri
.
substr
(
1
,
closing
-
1
);
// TODO: Allow for multiple tags
const
auto
&
cfgs
=
ftl
::
config
::
findByTag
(
tags
);
// FIXME: Check for more than one tag result
if
(
cfgs
.
size
()
>
0
)
{
//LOG(INFO) << "PREPROC URI " << cfgs[0]->getID() + uri.substr(closing+1);
return
cfgs
[
0
]
->
getID
()
+
uri
.
substr
(
closing
+
1
);
}
else
{
return
uri
;
}
}
else
{
return
uri
;
}
}
bool
ftl
::
config
::
update
(
const
std
::
string
&
puri
,
const
json_t
&
value
)
{
// Remove last component of URI
string
tail
=
""
;
string
head
=
""
;
size_t
last_hash
=
puri
.
find_last_of
(
'#'
);
string
uri
=
preprocessURI
(
puri
);
size_t
last_hash
=
uri
.
find_last_of
(
'#'
);
if
(
last_hash
!=
string
::
npos
)
{
size_t
last
=
p
uri
.
find_last_of
(
'/'
);
size_t
last
=
uri
.
find_last_of
(
'/'
);
if
(
last
!=
string
::
npos
&&
last
>
last_hash
)
{
tail
=
p
uri
.
substr
(
last
+
1
);
head
=
p
uri
.
substr
(
0
,
last
);
tail
=
uri
.
substr
(
last
+
1
);
head
=
uri
.
substr
(
0
,
last
);
}
else
{
tail
=
p
uri
.
substr
(
last_hash
+
1
);
head
=
p
uri
.
substr
(
0
,
last_hash
);
tail
=
uri
.
substr
(
last_hash
+
1
);
head
=
uri
.
substr
(
0
,
last_hash
);
}
}
else
{
LOG
(
WARNING
)
<<
"Expected a # in an update URI: "
<<
p
uri
;
LOG
(
WARNING
)
<<
"Expected a # in an update URI: "
<<
uri
;
return
false
;
}
...
...
@@ -289,18 +313,19 @@ json_t &ftl::config::get(const std::string &puri) {
// Remove last component of URI
string
tail
=
""
;
string
head
=
""
;
size_t
last_hash
=
puri
.
find_last_of
(
'#'
);
string
uri
=
preprocessURI
(
puri
);
size_t
last_hash
=
uri
.
find_last_of
(
'#'
);
if
(
last_hash
!=
string
::
npos
)
{
size_t
last
=
p
uri
.
find_last_of
(
'/'
);
size_t
last
=
uri
.
find_last_of
(
'/'
);
if
(
last
!=
string
::
npos
&&
last
>
last_hash
)
{
tail
=
p
uri
.
substr
(
last
+
1
);
head
=
p
uri
.
substr
(
0
,
last
);
tail
=
uri
.
substr
(
last
+
1
);
head
=
uri
.
substr
(
0
,
last
);
}
else
{
tail
=
p
uri
.
substr
(
last_hash
+
1
);
head
=
p
uri
.
substr
(
0
,
last_hash
);
tail
=
uri
.
substr
(
last_hash
+
1
);
head
=
uri
.
substr
(
0
,
last_hash
);
}
}
else
{
LOG
(
WARNING
)
<<
"Expected a # in an update URI: "
<<
p
uri
;
LOG
(
WARNING
)
<<
"Expected a # in an update URI: "
<<
uri
;
return
null_json
;
}
...
...
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