- read from a file descriptor in ECS::mainloop
#include <ECS/Reader.hh>
class ECS_Reader
{
public:
_ECSAIO_PRIVAPI ECS_Reader();
_ECSAIO_PRIVAPI virtual ~ECS_Reader();
virtual ostream& print(ostream& os) const;
_ECSAIO_PRIVAPI void monitorFd(int fd);
_ECSAIO_PRIVAPI void ceaseMonitoringFd(int fd);
_ECSAIO_PRIVAPI virtual void handleException(int fd);
_ECSAIO_PRIVAPI virtual void handleReadable(int fd) = 0;
};
Abstract Base
ECS Application Developers
This class exists so that the interface developer can register a file descriptor to be monitored in ECS::mainloop().
This is intended to support a single process which performs both input and output from the correlation engine. This configuration is not recommended and should only be used where the application demands it.
It is expected that the developer will create an application specific subclass of this class. The class will set up a socket or other input stream and will call monitorFd with the file descriptor of the input source. When ECS::mainloop() detects that the file is readable it will make a callback to the virtual handleReadable() method.
It is anticipated that the developer will provide an implementation of handleEvent which will read event data from the file descriptor, construct and ECS_Event and forward it to an engine.
This class could also be used to monitor a stream of control input to an output process or annotation server.
_ECSAIO_PRIVAPI ECS_Reader();
_ECSAIO_PRIVAPI virtual ~ECS_Reader();
virtual ostream& print(ostream& os) const;
os.
_ECSAIO_PRIVAPI void monitorFd(int fd);
ECS::mainloop(). If the file descriptor becomes readable, or has a exception mainloop will perform a callback to handleReadable() and handleException() respectively.
_ECSAIO_PRIVAPI void ceaseMonitoringFd(int fd);
ECS::mainloop() invocation from monitoring the specific file descriptor. Only has an effect if the file descriptor was previously specified to be monitored by this class.
_ECSAIO_PRIVAPI virtual void handleException(int fd);
fd and remove it from future monitoring. It is expected that subclasses will provide an implementation better suited to the individual case.
_ECSAIO_PRIVAPI virtual void handleReadable(int fd) = 0;
fd selects readable.
None
None
ECS
1.6
1998/02/25
Hewlett-Packard Company
Copyright (c) 1997 Hewlett-Packard Company. All Rights Reserved.