Next: C++ Throttle Setup Up: C++ API Previous: APIs

C++ Filter Creation & Installation




There are three types of cmlogFilters: Null, JLAB, and SLAC. You can declare a new filter in C++ by using the following format:
  cmlogFilterNull* filter = new cmlogFilterNull();

  cmlogFilterJLAB* filter = new cmlogFilterJLAB();

  cmlogFilterSLAC* filter = new cmlogFilterSLAC();

These calls create a new filter of the specified type: Null, JLAB, or SLAC. A pointer to the filter object is returned; this pointer should be passed to the "setFilter()" function described below, and should be saved by the application for making later calls to throttle functions.
----------------------------------------------------------------
  cmlogFilter* cmlogClient::setFilter(cmlogFilter *filter)
This function takes a pointer obtained from one of the filter-creation calls described above and installs the filter in the cmlog client. All subsequent cmlog messages will be run through this filter. Any previous filter is removed from the system. If no call to setFilter() is made, the cmlog client will use the default JLAB filter.
Although cmlogClient::setFilter() is declared to take an argument of type "cmlogFilter*", pointers to any of the above filters will be accepted, as they are all derived from cmlogFilter.
This function returns its argument, thus filter creation & installation may be combined into one statement:
	cmlogFilterSLAC* filter = client -> setFilter (new cmlogFilterSLAC());

James Silva
2002-10-28