From e54758a2008aa21844f649b1379360bf1a1ee61c Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 19 Apr 2016 08:35:10 +0200 Subject: [PATCH] Make the vtkMEDReader::META_DATA info key accessible from the outside without dependancies. --- src/Plugins/MEDReader/IO/vtkMEDReader.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 4169733c..7c4b308c 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -197,7 +197,24 @@ private: }; vtkStandardNewMacro(vtkMEDReader); -vtkInformationKeyMacro(vtkMEDReader, META_DATA, DataObjectMetaData); + +// vtkInformationKeyMacro(vtkMEDReader, META_DATA, DataObjectMetaData); // Here we need to customize vtkMEDReader::META_DATA method +// start of overload of vtkInformationKeyMacro +static vtkInformationDataObjectMetaDataKey *vtkMEDReader_META_DATA=new vtkInformationDataObjectMetaDataKey("META_DATA","vtkMEDReader"); + +vtkInformationDataObjectMetaDataKey *vtkMEDReader::META_DATA() +{ + static const char ZE_KEY[]="vtkMEDReader::META_DATA"; + vtkInformationDataObjectMetaDataKey *ret(vtkMEDReader_META_DATA); + ParaMEDMEM::GlobalDict *gd(ParaMEDMEM::GlobalDict::GetInstance()); + if(!gd->hasKey(ZE_KEY)) + {// here META_DATA is put on global var to be exchanged with other filters without dependancy of MEDReader. Please do not change ZE_KEY ! + std::ostringstream oss; oss << ret; + gd->setKeyValue(ZE_KEY,oss.str()); + } + return ret; +} +// end of overload of vtkInformationKeyMacro vtkMEDReader::vtkMEDReader():Internal(new vtkMEDReaderInternal(this)) { -- 2.39.2