This file is indexed.

/usr/include/openigtlink/igtlMessageHandlerMacro.h is in libopenigtlink-dev 1.11.0-4.

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
/*=========================================================================

  Program:   OpenIGTLink Library
  Module:    git@github.com:openigtlink/OpenIGTLink.git
  Language:  C++

  Copyright (c) Insight Software Consortium. All rights reserved.

  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 __igtlMessageHandlerMacro_h
#define __igtlMessageHandlerMacro_h

#include "igtlMessageHandler.h"

// Description:
// The igtlMessageHandlerClassMacro() macro is to help developers to
// define message handler class. It generates a chlid class of igtl::MessageHandler. 
// The developer only needs to implement ProcessMessage() after calling this macro.
// The following code shows how to define a handler that processes IMAGE message:
//
//   igtlMessageHandlerClassMacro(igtl::ImageMessage, TestImageMessageHandler);
//   void TestImageMessageHandler::Process(igtl::ImageMessage * message)
//   {
//     // do something
//   }

//#define igtlMessageHandlerClassMacro(messagetype, classname)      \
//  template <typename messagetype>                                 \
//  class classname : public MessageHandler<messagetype>            \
//  {                                                               \
//    typedef classname                      Self;                  \
//    typedef MessageHandler<messagetype>    Superclass;            \
//    typedef SmartPointer<Self>             Pointer;               \
//    typedef SmartPointer<const Self>       ConstPointer;          \
//    igtlTypeMacro(classname, MessageHandler<messagetype>);        \
//    igtlNewMacro(classname);                                      \
//  public:                                                         \
//    virtual void Process(messagetype*);                           \
//  }; 

#define igtlMessageHandlerClassMacro(messagetype, classname, datatype)     \
  class classname : public ::igtl::MessageHandler                 \
  {                                                               \
  public:                                                         \
    typedef classname                      Self;                  \
    typedef ::igtl::MessageHandler    Superclass;                 \
    typedef igtl::SmartPointer<Self>             Pointer;         \
    typedef igtl::SmartPointer<const Self>       ConstPointer;    \
    igtlTypeMacro(classname, ::igtl::MessageHandler);             \
    igtlNewMacro(classname);                                      \
  public:                                                         \
    virtual const char* GetMessageType()                          \
    {                                                             \
      return this->m_Message->GetDeviceType();                    \
    }                                                             \
    virtual int Process(messagetype*, datatype*);                 \
    int ReceiveMessage(::igtl::Socket* socket, ::igtl::MessageBase* header, int pos) \
    {                                                                   \
      if (pos == 0) /* New body */                                      \
        {                                                               \
        this->m_Message->SetMessageHeader(header);                      \
        this->m_Message->AllocatePack();                                \
        }                                                               \
      int s = socket->Receive((void*)((char*)this->m_Message->GetPackBodyPointer()+pos), \
                              this->m_Message->GetPackBodySize()-pos);  \
      if (s < 0) /* Time out */                                         \
        {                                                               \
        return pos;                                                     \
        }                                                               \
      if (s+pos >= this->m_Message->GetPackBodySize())                  \
        {                                                               \
        int r = this->m_Message->Unpack(this->m_CheckCRC);              \
        if (r)                                                          \
          {                                                             \
          Process(this->m_Message, this->m_Data);                       \
          }                                                             \
        else                                                            \
          {                                                             \
          return -1;                                                    \
          }                                                             \
        }                                                               \
      return s + pos;  /* return current position in the body */        \
    }                                                                   \
    virtual void CheckCRC(int i)                                  \
    {                                                             \
      if (i == 0)                                                 \
        {                                                         \
        this->m_CheckCRC = 0;                                     \
        }                                                         \
      else                                                        \
        {                                                         \
        this->m_CheckCRC = 1;                                     \
        }                                                         \
    }                                                             \
    void SetData(datatype* p)                                     \
    {                                                             \
      this->m_Data = p;                                           \
    }                                                             \
    datatype* GetData()                                           \
    {                                                             \
      return this->m_Data;                                        \
    }                                                             \
  protected:                                                      \
    classname()                                                   \
    {                                                             \
      this->m_Message  = messagetype::New();                      \
      this->m_CheckCRC = 1;                                       \
      this->m_Data = NULL;                                        \
    }                                                             \
    ~classname() {}                                               \
  protected:                                                      \
    int         m_CheckCRC;                                       \
    messagetype::Pointer m_Message;                               \
    datatype*   m_Data;                                           \
  }; 

#endif // __igtlMessageHandlerMacro_h