radarlib 1.4.6
copy_polar_volume_attributes.cpp
/*===========================================================================*/
/*
/* Questo programma apre un volume e ne crea una copia copiando solo
/* gli attributi dei gruppi what, where e how della radice
/*
/* Esempo di utilizzo:
/* main.exe volume.h5 copia.h5
/*
/*===========================================================================*/
#include <iostream>
using namespace std;
using namespace OdimH5v20;
/*===========================================================================*/
int main(int argc, char* argv[])
{
if (argc != 3)
{
cout << "Usage: " << argv[0] << " <odimh5filesorgente> <odimh5filedestinazione>" << endl;
return -1;
}
OdimFactory* factory = NULL;
PolarVolume* volume1 = NULL;
PolarVolume* volume2 = NULL;
try
{
factory = new OdimFactory();
/* apriamo il volume di origine */
volume1 = factory->openPolarVolume(argv[1]);
/* creiamo il volume di destinazione */
volume2 = factory->createPolarVolume(argv[2]);
/* copiamo ogni gruppo di attributi della radice */
volume2->getWhat()->import( volume1->getWhat() );
volume2->getWhere()->import( volume1->getWhere() );
volume2->getHow()->import( volume1->getHow() );
cout << "Copia eseguita!" << endl;
}
catch (std::exception& stde)
{
cerr << "Errore di esecuzione: " << stde.what() << endl;
}
catch (...)
{
cerr << "Errore di esecuzione sconosciuto" << endl;
}
delete volume1;
delete volume2;
delete factory;
return 0;
}
void import(MetadataGroup *group)
Copy/write all attributes from the given group to this group.
Definition: odimh5v20_metadata.cpp:386
OdimH5 objects factory.
Definition: odimh5v20_factory.hpp:50
virtual PolarVolume * openPolarVolume(const std::string &path)
Get a OdimH5 PVOL object from an existing file.
Definition: odimh5v20_factory.cpp:260
virtual PolarVolume * createPolarVolume(const std::string &path)
Create a new OdimH5 PVOL object and the associated file.
Definition: odimh5v20_factory.cpp:165
virtual MetadataGroup * getWhere()
Get the WHERE attributes group.
Definition: odimh5v20_classes.cpp:179
virtual MetadataGroup * getWhat()
Get the WHAT attributes group.
Definition: odimh5v20_classes.cpp:172
virtual MetadataGroup * getHow()
Get the HOW attributes group.
Definition: odimh5v20_classes.cpp:186
OdimH5 v2.0 Polar Volume.
Definition: odimh5v20_classes.hpp:846
Namespace related to ODIMH5 version 2.0.
Definition: odimh5v20.hpp:46
Main header file of the library.