Skip to content
Snippets Groups Projects
Commit fd732066 authored by Julien Malik's avatar Julien Malik
Browse files

ENH: remove Common dir

parent 4323caac
No related branches found
No related tags found
No related merge requests found
file(GLOB srcs "*.cxx")
add_library(OTBWrapperCommon ${srcs})
target_link_libraries(OTBWrapperCommon OTBCommon OTBIO)
install(TARGETS OTBWrapperCommon
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include/otbapp
FILES_MATCHING PATTERN "*.h")
\ No newline at end of file
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWrapperEvent_h
#define __otbWrapperEvent_h
namespace otb
{
namespace Wrapper
{
class ITK_EXPORT Event
{
public:
/** Constructor */
Event(): m_Type("Unknown"), m_InstanceId("Unknown") {}
Event(const std::string& type, const std::string& id): m_Type(type), m_InstanceId(id) {}
virtual ~Event(){}
void SetType(const std::string& type)
{
m_Type = type;
}
const std::string& GetType() const
{
return m_Type;
}
void SetInstanceId(const std::string& id)
{
m_InstanceId = id;
}
const std::string& GetInstanceId() const
{
return m_InstanceId;
}
private:
/// Type
std::string m_Type;
/// Instance Id
std::string m_InstanceId;
};
}
}
#endif
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWrapperEventsListener_h
#define __otbWrapperEventsListener_h
namespace otb
{
namespace Wrapper
{
/**
* \class WrapperEventsListener
*
* Vectorization view interface specification for the model
*
* \ingroup Visualization
*/
template <class TEvent> class EventsListener
{
public:
/** Standard class typedefs */
typedef EventsListener Self;
// Update the display
virtual void Notify(const TEvent& event) = 0;
protected:
/** Constructor */
EventsListener() {}
/** Destructor */
virtual ~EventsListener() {}
private:
EventsListener(const Self&); //purposely not implemented
void operator =(const Self&); //purposely not implemented
};
}
} // end namespace otb
#endif
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbWrapperEventsSender_h
#define __otbWrapperEventsSender_h
#include "itkObject.h"
#include "otbWrapperEventsListener.h"
#include <set>
namespace otb
{
namespace Wrapper
{
/** \class EventsSender
*
* Base class for events sending. Listener may register to this class
* to receive the events.
*/
template <class TEvent = void>
class EventsSender
// : public itk::Object
{
public:
/** Standard class typedefs */
typedef EventsSender Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
// Define the event type
typedef TEvent EventType;
// Define the listener type
typedef EventsListener<EventType> ListenerType;
/** PreprocessingViewInterface storage */
typedef std::set<ListenerType *> ListenersSetType;
/** Register a new listener */
virtual bool RegisterListener(ListenerType * listener)
{
return (m_RegisteredListeners.insert(listener).second);
}
/** Unregister a listener */
virtual void UnRegisterListener(ListenerType * listener)
{
m_RegisteredListeners.erase(listener);
}
virtual void UnRegisterAllListeners()
{
m_RegisteredListeners.clear();
}
/** Notify changes to all registered listeners */
virtual void NotifyAll(const EventType& event = NULL)
{
for (typename ListenersSetType::iterator it = m_RegisteredListeners.begin();
it != m_RegisteredListeners.end();
++it)
{
this->NotifyListener(*it, event);
}
}
/** Notify changes to a given listener */
virtual void NotifyListener(ListenerType * listener, const EventType& event = NULL)
{
listener->Notify(event);
}
protected:
/** Constructor */
EventsSender() {}
/** Destructor */
virtual ~EventsSender() {}
private:
EventsSender(const Self&); //purposely not implemented
void operator =(const Self&); //purposely not implemented
/** Registered listeners */
ListenersSetType m_RegisteredListeners;
};
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment