aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-05-15 17:14:12 +0200
committerThomas White <taw@physics.org>2023-07-28 13:22:05 +0200
commit47889fc9df2e5ff016369af6dbf55e7472496c08 (patch)
tree6b23ac1221e349be1d732790878735e56a402c3f /libcrystfel/src
parent6f774aaa68507d9dd0d1f8916d773a9bdb89f03b (diff)
Add data_template_show_hierarchy()
Diffstat (limited to 'libcrystfel/src')
-rw-r--r--libcrystfel/src/datatemplate.c26
-rw-r--r--libcrystfel/src/datatemplate.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c
index fc63b93c..1cde78f9 100644
--- a/libcrystfel/src/datatemplate.c
+++ b/libcrystfel/src/datatemplate.c
@@ -953,6 +953,32 @@ static int try_guess_panel(struct dt_badregion *bad, DataTemplate *dt)
}
+static void show_group(const struct panel_group_template *gt, int level)
+{
+ int i;
+
+ for ( i=0; i<level; i++ ) STATUS(" ");
+
+ if ( gt == NULL ) {
+ STATUS("!!!\n");
+ return;
+ }
+
+ STATUS("%s\n", gt->name);
+
+ for ( i=0; i<gt->n_children; i++ ) {
+ show_group(gt->children[i], level+1);
+ }
+}
+
+
+void data_template_show_hierarchy(const DataTemplate *dtempl)
+{
+ STATUS("Hierarchy:\n");
+ show_group(find_group(dtempl, "top"), 0);
+}
+
+
DataTemplate *data_template_new_from_string(const char *string_in)
{
DataTemplate *dt;
diff --git a/libcrystfel/src/datatemplate.h b/libcrystfel/src/datatemplate.h
index 68e8f0bc..255b0c1d 100644
--- a/libcrystfel/src/datatemplate.h
+++ b/libcrystfel/src/datatemplate.h
@@ -81,6 +81,8 @@ extern double data_template_get_clen_if_possible(const DataTemplate *dt);
extern struct detgeom *data_template_get_2d_detgeom_if_possible(const DataTemplate *dt);
+extern void data_template_show_hierarchy(const DataTemplate *dtempl);
+
#ifdef __cplusplus
}
#endif