NAME

OTC_BaseActions - Default actions for an item contained in a bucket.

SYNOPSIS


#include <OTC/collctn/baseactn.hh>

template<class T>
class OTC_BaseActions
{
  public:
    inline static T const& add(T const& theItem);
    inline static void remove(T&);
    static T const& add(T const& theItem);
    static void remove(T&);
};

CLASS TYPE

Static

DESCRIPTION

This class encapsulates the default actions which are executed when an item is placed into a bucket and when a bucket is deleted. These may be overridden for a particular type, to produce type specific behaviour. For example, if T is a pointer to a class derived from OTC_Resource the actions may increment and decrement the reference count.

EXAMPLE

Example of a class specific version, where EX_Foo is derived from OTC_Resource. If the type is a pointer, you may simplify the arguments and return type to that shown above. If T is a class object, the prototype of your add() and remove() functions must match exactly, those shown in the class definition below. If you need to prevent a null pointer being placed into a collection, you should include a condition check in the add() function.

ACTIONS

inline static T const& add(T const& theItem);
inline static void remove(T&);

SEE ALSO

OTC_Bucket

LIBRARY

OTC

AUTHOR(S)

Graham Dumpleton

COPYRIGHT

Copyright 1991 1992 1993 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED