XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


dsstruct (daltools-1.11.1) [xmmsas_20230412_1735-21.0.0]


Description

Get the structure of a list of datasets

This task outputs a high level (syntax orientated) description of the given dataset. The syntax of the output is essentially the same as that expected by dsvalidate and dsverify.

The output has the form:

dataset < <dataset items> >

where,

<dataset items> is a list of one or more of

<name> <attribute> <block>

where <block> has the form

block < <block items> >

<block items > is a list of one or more of

<attribute> <array> <table>

where <array> has the form

array < <array items> >

where array is a list of one or more or

<attrribute>

For example, if a dataset is created with the following code

// ESA (C) 2000-2018 
//
// This file is part of ESA's XMM-Newton Scientific Analysis System (SAS).
//
//    SAS is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    SAS is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with SAS.  If not, see <http://www.gnu.org/licenses/>.


#include <Dal.h>

int
main()
{
	DataSet*	set = dataSetServer -> open( "test.dat", Dal::Create );
	Attribute*	att = set -> addAttribute( "att1", "an attribute", "mm" );
	*att = 123;

	Table*		tab = set -> addTable( "table1", 10, "a table" );
	Column*		col = tab -> addColumn( "col1", Column::Int32, "a column" );
	att = col -> addAttribute( "TLMAX", "std attribute", "Nm" );
	*att = 1000;

	dataSetServer -> close( set );

}

i.e. creates a dataset with name "test.dat" containing a dataset attribute called att1, ...

then the command dsstruct –set=test.dat produces the following output:

dataset
<
	name	"test.dat"
	attribute
	<
		name	"ATT1"
		type	Int
		value	"123"
	>
	table
	<
		name	"table1"
		rows	10
		column
		<
			name	"col1"
			type	Int32
			attribute
			<
				name	"TLMAX"
				type	Int
				value	"1000"
			>
		>
	>
>

If the output is redirected to the file check.ds (easily achieved e.g. use the command dsstruct –set=test.dat > check.ds )

then the command dsverify –file=check.ds or dsvalidate –sets=test.dat –template=check.sc

can be used to check the validity of the dataset test.dat.

XMM-Newton SOC -- 2023-04-16