/usr/include/IGSTK/igstkObject.h is in libigstk4-dev 4.4.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | /*=========================================================================
Program: Image Guided Surgery Software Toolkit
Module: $RCSfile: igstkObject.h,v $
Language: C++
Date: $Date: 2011-01-18 21:40:17 $
Version: $Revision: 1.9 $
Copyright (c) ISC Insight Software Consortium. All rights reserved.
See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm 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 __igstkObject_h
#define __igstkObject_h
#include "itkObject.h"
#include "itkLogger.h"
#include "igstkLogger.h"
#include "igstkMacros.h"
namespace igstk
{
/** \class Object
*
* \brief Base class for all the IGSTK classes
*
* This class derives from the ITK Object and it is used for
* introducion additional elemets that are common to IGSTK
* Objects.
*
*/
class Object : public ::itk::Object
{
public:
/** General Typedefs. Note that the igstkStandardClassTraitsMacro() cannot be
* used here because that macro invokes calls in the superclass, for example
* SetLogger, that will not be available in the ITK Object class. */
typedef Object Self;
typedef ::itk::Object Superclass;
typedef ::itk::SmartPointer< Self > Pointer;
typedef ::itk::SmartPointer< const Self > ConstPointer;
igstkTypeMacro( Object, ::itk::Object );
igstkNewMacro( Self );
typedef igstk::Logger LoggerType;
/** Connect the Logger for this class */
void SetLogger( LoggerType * logger );
void RemoveObserver(unsigned long tag) const;
protected:
LoggerType * GetLogger() const;
protected:
/** Constructor is protected in order to enforce
* the use of the New() operator */
Object(void);
virtual ~Object(void);
/** Print the object information. */
virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
/** Register observed objects in an internal array so that they
* can be disconnected upon destruction */
void RegisterObservedObject(
const ::igstk::Object * object, unsigned long tag );
/** Remove observers that this object may have connected to other objects */
void RemoveFromObservedObjects();
private:
typedef ::igstk::Object ObservedObjectType;
typedef std::pair< const ObservedObjectType *,
unsigned long> ObservedObjectTagPair;
typedef std::list< ObservedObjectTagPair > ObservedObjectPairContainer;
typedef ::itk::MemberCommand< Self > DeleteEventCommandType;
typedef ::itk::EventObject EventType;
mutable LoggerType::Pointer m_Logger;
ObservedObjectPairContainer m_ObservedObjectPairContainer;
DeleteEventCommandType::Pointer m_ObservedObjectDeleteReceptor;
/** This method is called when an object we are observing is deleted.
* It removes the object being deleted (caller) from our internal list
* of observed objects. We use the internal list to remove our observers
* when we are deleted.
*/
void ObservedObjectDeleteProcessing(const itk::Object* caller,
const EventType& event );
// Put this here so we can share typedefs.
class ObservedObjectTagPairObjectMatchPredicate
{
public:
ObservedObjectTagPairObjectMatchPredicate( const itk::Object* obj )
: m_TargetObject( obj )
{
}
bool operator()( const igstk::Object::ObservedObjectTagPair& objTagPair )
{
if (objTagPair.first == m_TargetObject)
{
return true;
}
else
{
return false;
}
}
private:
const itk::Object* m_TargetObject;
};
};
} // end of namespace igstk
#endif //__igstk_Object_h_
|