Public Member Functions | Static Public Member Functions

mitk::InteractionDebug Class Reference

#include <mitkInteractionDebug.h>

Collaboration diagram for mitk::InteractionDebug:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void OpenConection ()
bool NewStateMachine (const char *name, const StateMachine *stateMachine)
bool Event (const StateMachine *stateMachine, unsigned int EventId)
bool Transition (const StateMachine *stateMachine, const char *transitionName)
bool Action (const StateMachine *stateMachine, const char *transitionName, unsigned int action)
bool DeleteStateMachine (const StateMachine *stateMachine)
void setMaxConnectionAdvance (int maxConectionAdvance)
void sendCounter ()

Static Public Member Functions

static InteractionDebugGetInstance ()
static void SetXMLFileName (const char *fileName)

Detailed Description

Definition at line 26 of file mitkInteractionDebug.h.


Member Function Documentation

bool mitk::InteractionDebug::Action ( const StateMachine stateMachine,
const char *  transitionName,
unsigned int  action 
)

Definition at line 156 of file mitkInteractionDebug.cpp.

  {
    if ( stateMachine == NULL || stateMachine->GetType().empty() )
      return false;

    // Instance Address
    char* wb = m_Buffer;
    *((unsigned long*) wb) = (unsigned long) stateMachine;
    wb += sizeof(long);

    // transitionName
    unsigned long size = static_cast<unsigned long>(strlen( transitionName ));
    *((unsigned long*) wb) = size;

    wb += sizeof(long);

    for ( unsigned long i=0; i<size; i++, wb++ )
      *wb = transitionName[i];

    wb += sizeof(long);

    *((unsigned long*) wb) = action;

    size += 3*sizeof(long);

    sendCounter();
bool mitk::InteractionDebug::DeleteStateMachine ( const StateMachine stateMachine )

Definition at line 189 of file mitkInteractionDebug.cpp.

  {
    if ( stateMachine == NULL || stateMachine->GetType().empty() )
      return false;

    // Instance Address
    char* wb = m_Buffer;
    *((unsigned long*) wb) = (unsigned long) stateMachine;

    sendCounter();
bool mitk::InteractionDebug::Event ( const StateMachine stateMachine,
unsigned int  EventId 
)

Definition at line 102 of file mitkInteractionDebug.cpp.

  {
    if ( EventId != 520)
    {
      if ( stateMachine == NULL || stateMachine->GetType().empty() )
        return false;

      // Instance Address
      char* wb = m_Buffer;
      *((unsigned long*) wb) = (unsigned long) stateMachine;
      wb += sizeof(long);

      // eventID
      *((unsigned long*) wb) = EventId;
      
      sendCounter();
      // MITK_INFO << "EVENT: instance: " << (unsigned int) stateMachine << " EventId: " << EventId << std::endl;
      return SocketClient::GetInstance()->send( EVENT, 2*sizeof(long), m_Buffer );
InteractionDebug * mitk::InteractionDebug::GetInstance (  ) [static]

Definition at line 206 of file mitkInteractionDebug.cpp.

  {
    if (m_Instance==NULL)
      m_Instance = new InteractionDebug();
bool mitk::InteractionDebug::NewStateMachine ( const char *  name,
const StateMachine stateMachine 
)

Definition at line 73 of file mitkInteractionDebug.cpp.

  {
    if ( name == NULL )
      return false;  

    // Instance Address
    char* wb = m_Buffer;
    *((unsigned long*) wb) = (unsigned long) stateMachine;
    wb += sizeof(long);

    // Length of the name
    size_t size = strlen(name);

    *((unsigned long*) wb) = (unsigned long) size;
    wb += sizeof(long);

    // name
    strcpy(wb,name);

    size += 2*sizeof(long);

    sendCounter();
void mitk::InteractionDebug::OpenConection (  )

Definition at line 51 of file mitkInteractionDebug.cpp.

  {
    char* wb = m_Buffer;
    *((unsigned long*) wb) = (unsigned long) GetHashValue();
    wb += sizeof(long);
    
    size_t size = strlen( m_FileName );

    *((unsigned long*) wb) = (unsigned long) size;
    wb += sizeof(long);

    strcpy( wb, m_FileName );
    size += 2*sizeof(long);

    sendCounter();
void mitk::InteractionDebug::sendCounter (  )

Definition at line 224 of file mitkInteractionDebug.cpp.

  {
    static unsigned long m_Counter = 0;
    static char my_Buffer[sizeof(long)];
    m_Counter++;

    char* wb = my_Buffer;
    *((unsigned long*) wb) = (unsigned long) m_Counter;

    bool success = SocketClient::GetInstance()->send( 7, sizeof(long), wb );
    if (success)
    {
void mitk::InteractionDebug::setMaxConnectionAdvance ( int  maxConectionAdvance )

Definition at line 240 of file mitkInteractionDebug.cpp.

  {
void mitk::InteractionDebug::SetXMLFileName ( const char *  fileName ) [static]

Definition at line 217 of file mitkInteractionDebug.cpp.

  {
    size_t size = strlen(fileName) + 1;
bool mitk::InteractionDebug::Transition ( const StateMachine stateMachine,
const char *  transitionName 
)

Definition at line 127 of file mitkInteractionDebug.cpp.

  {
    if ( stateMachine == NULL || stateMachine->GetType().empty() )
      return false;

    // Instance Address
    char* wb = m_Buffer;
    *((unsigned long*) wb) = (unsigned long) stateMachine;
    wb += sizeof(long);

    // transitionName
    unsigned long size = static_cast<unsigned long>(strlen( transitionName ));
    *((unsigned long*) wb) = size;

    wb += sizeof(long);

    for ( unsigned long i=0; i<size; i++, wb++ )
      *wb = transitionName[i];

    size += 2*sizeof(long);
    
    //sendCounter();

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines