Main Page   Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

vrpn_Text.h

This is the verbatim text of the vrpn_Text.h include file.
/* vrpn_Text.h
    Definition of user-level access to the text sending and retrieving
    functions within VRPN. These are wrappers around the vrpn_BaseClass
    routines, since basic text functions have been pulled into these
    classes.
*/

#ifndef VRPN_TEXT_H

#ifndef _WIN32
#include <sys/time.h>
#endif

#include "vrpn_Connection.h"
#include "vrpn_BaseClass.h"

typedef struct {
        struct timeval  msg_time;       // Time of the message
        char            message[vrpn_MAX_TEXT_LEN];     // The message
        vrpn_TEXT_SEVERITY      type;
        vrpn_uint32             level;
} vrpn_TEXTCB;

typedef void (*vrpn_TEXTHANDLER)(void *userdata, const vrpn_TEXTCB info);

//----------------------------------------------------------
//************** Users deal with the following *************

// the send_text_message() function is protected).  It provides
// the needed function definitions for vrpn_BaseClass.

class vrpn_Text_Sender: public vrpn_BaseClass {
  public:
        vrpn_Text_Sender(const char *name, vrpn_Connection *c = NULL) :
                vrpn_BaseClass(name, c) { init(); };

        void mainloop(void) { server_mainloop(); if (d_connection) d_connection->mainloop(); };

        int send_message(const char *msg, vrpn_TEXT_SEVERITY type = vrpn_TEXT_NORMAL,
                         vrpn_uint32 level = 0);

  protected:
      virtual int register_types(void) { return 0; };
};

// standard VRPN printing functions handle them.

class vrpn_Text_Receiver: public vrpn_BaseClass {
  public:
        vrpn_Text_Receiver (const char * name, vrpn_Connection * c = NULL);
        virtual ~vrpn_Text_Receiver (void);
        virtual int register_message_handler(void *userdata,
                vrpn_TEXTHANDLER handler);
        virtual int unregister_message_handler(void *userdata,
                vrpn_TEXTHANDLER handler);

        virtual void mainloop(void) { if (d_connection) { d_connection->mainloop(); }; client_mainloop(); };

  protected:
        static int handle_message (void * userdata, vrpn_HANDLERPARAM p);
        typedef struct vrpn_TCS {
                void                    *userdata;
                vrpn_TEXTHANDLER        handler;
                struct vrpn_TCS         *next;
        } vrpn_TEXTMESSAGELIST;

        vrpn_TEXTMESSAGELIST            *change_list;

        virtual int register_types(void) { return 0; };
};

#define VRPN_TEXT_H
#endif

Generated at Fri Sep 13 15:04:45 2002 for vrpn by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999