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

vrpn_TypeDispatcher.h

This is the verbatim text of the vrpn_TypeDispatcher.h include file.
#ifndef VRPN_TYPE_DISPATCHER_H
#define VRPN_TYPE_DISPATCHER_H

#include "vrpn_Shared.h"
#include "vrpn_ConnectionTypes.h"


class vrpn_TypeDispatcher {

  public:

    vrpn_TypeDispatcher (void);
    ~vrpn_TypeDispatcher (void);


    // ACCESSORS


    int numTypes (void) const;
    const char * typeName (int which) const;

    vrpn_int32 getTypeID (const char * name);

    int numSenders (void) const;
    const char * senderName (int which) const;

    vrpn_int32 getSenderID (const char * name);


    // MANIPULATORS


    vrpn_int32 addType (const char * name);
    vrpn_int32 addSender (const char * name);

    vrpn_int32 registerType (const char * name);

    vrpn_int32 registerSender (const char * name);


    vrpn_int32 addHandler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
                           void * userdata, vrpn_int32 sender);
    vrpn_int32 removeHandler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler,
                              void * userdata, vrpn_int32 sender);
    void setSystemHandler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler);


    // It'd make a certain amount of sense to unify these next few, but
    // there are some places in the code that depend on the side effect of
    // do_callbacks_for() NOT dispatching system messages.

    int doCallbacksFor (vrpn_int32 type, vrpn_int32 sender,
                        timeval time, vrpn_uint32 len,
                        const char * buffer);
    int doSystemCallbacksFor
                       (vrpn_int32 type, vrpn_int32 sender,
                        timeval time, vrpn_uint32 len,
                        const char * buffer,
                        void * userdata);
    int doSystemCallbacksFor
                       (vrpn_HANDLERPARAM p,
                        void * userdata);

    void clear (void);

  protected:

    struct vrpnLocalMapping {
      char                      * name;         // Name of type
      vrpnMsgCallbackEntry      * who_cares;    // Callbacks
      vrpn_int32                cCares;         // TCH 28 Oct 97
    };

    int d_numTypes;
    vrpnLocalMapping d_types [vrpn_CONNECTION_MAX_TYPES];

    int d_numSenders;
    char * d_senders [vrpn_CONNECTION_MAX_SENDERS];

    vrpn_MESSAGEHANDLER d_systemMessages [vrpn_CONNECTION_MAX_TYPES];

    vrpnMsgCallbackEntry * d_genericCallbacks;
};



#endif  // VRPN_TYPE_DISPATCHER_H



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