PIP 6.1.0
Platform-Independent Primitives
Loading...
Searching...
No Matches
PICout::Notifier Class Reference

Class for emit notifications of PICout. More...

#include <picout.h>

Static Public Member Functions

static Notifier * instance ()
 Singleton access to PICout::Notifier Returns the singleton instance of the Notifier class used for emitting PICout events.
static PIObject * object ()
 Object that emit events from PICout Returns the PIObject instance that emits events when PICout with external buffer is destroyed.

Detailed Description

Class for emit notifications of PICout.

Synopsis

This class used as PICout events emitter. When PICout constructs with external PIString* buffer and some ID, last copy of this PICout on delete emit event "finished()" on object Notifier::object(). Sample:

class A: public PIObject {
PIOBJECT(A)
public:
A() {}
EVENT_HANDLER2(void, pcf, int, id, PIString *, buff) { piCout << "PICout(" << id << ") finished:" << (*buff); }
};
int main() {
A a;
CONNECTU(PICout::Notifier::object(), finished, &a, pcf);
PIString buffer = "my buff:";
PICout::withExternalBufferAndID(&buffer, my_id) << "int 10 ->" << 10 << ", time ->" << PITime::current();
return 0;
}
// PICout( 1 ) finished: my buff:int 10 -> 10 , time -> PITime(14:07:09:000)