Hi,
I am a little bit confused about the description of the use of itkEventMacroDeclaration and itkEventMacroDefinition:
// This macro duplicates some of the declaration and definition
// macro code. The purpose is to provide a backward compatibility API
// for ITK applications.
// NOTE: New applications should use itkEventMacroDeclaration (in a
// .h file) and itkEventMacroDefinition (in a compiled .cxx
// file). This new approach guarantees that only one copy of the
// implementation will be present.
from itk::EventObject.h, line 140-147.
in the past the usual way seemed to be just to put itkEventMacro
in the header file where you want to use the event.
The way I interpret the new approach is that all itkEventMacroDeclaration are put in an separate header file and the itkEventMacroDefinition are placed in a separate .cxx file. All classes that make use of an event are including the event header file.
What I tried so far:
itkRegistrationEvents.h
#ifndef itkRegistrationEvents_h
#define itkRegistrationEvents_h
#include "itkEventObject.h"
namespace itk
{
itkEventMacroDeclaration(BeforeEvaluationEvent, AnyEvent);
itkEventMacroDeclaration(AfterEvaluationEvent, AnyEvent);
}
#endif itkRegistrationEvents_h
itkRegistrationEvents.cxx
#include "itkRegistrationEvents.h";
namespace itk
{
itkEventMacroDefinition(BeforeEvaluationEvent, AnyEvent);
itkEventMacroDefinition(AfterEvaluationEvent, AnyEvent);
}
The itkRegistrationEvents are included in the file where I want to invoke the event.
Is this the intended use?
Thanks in advance,
Gordian