next up previous contents index
Next: An Example of a Up: The Glish Client Library Previous: An Overview of the

The GlishEvent Class


  A GlishEvent object encapsulates a single Glish event: a name and an associated value, represented by a pointer to a Value object. Usually you will not need to create GlishEvent objects yourself, but only deal with those returned by Client's NextEvent member function.

GlishEvent objects have two fields that are directly accessible:     name is a const char* pointer to the name of the event, and value is a (not const) Value* pointer to the event's associated value. It is preferred, though, to access these using the member functions const char* Name() and         Value* Val() instead.

GlishEvent objects associate a set of flags with each event. At present, the only flag of interest to the class user is whether the event corresponds to a request (§ 7.4, page gif). You can determine this by testing whether int IsRequest() const returns     true or false.

  GlishEvent objects are reference-counted, like Value and Client objects, so you should always use Unref() to dispose of one rather than delete. However, typically you should not need to Unref() GlishEvents because the Client class automatically Unref()s the events returned by NextEvent().

  If you wish to construct a GlishEvent object, you do so using one of:

    GlishEvent( const char* name, const Value* value )
    GlishEvent( const char* name, Value* value )
    GlishEvent( char* name, Value* value )
  The GlishEvent object notes which form you use and, when the object is destructed, it will delete the corresponding name pointer and/or Unref() the value pointer if and only if they were passed in non-const.  

Thu Nov 13 16:44:05 EST 1997