NetLogger summarizer internal functions
From NetLogger
Overview
Functions
NL_subject_T NL_get_new_record_subject (NL_log_T self) NL_subject_T NL_get_flush_subject (NL_log_T self) int NL_summ_new_record (void *self, void *record) int NL_summ_write_record (void *self, void *rl) unsigned NL_summstate_first_access (NL_summstate_T self, unsigned pos) int NL_summstate_set_num_values (NL_summstate_T self, unsigned n) int NL_summstate_write_record (NL_summstate_T self, void *rec, NL_level_t level)
Function Documentation
NL_subject_T NL_get_flush_subject (NL_log_T self)
Return subject for observers of "flush" events. See NL_get_new_record_subject() for details.
- Parameters: self Log object.
- Returns: Subject whose observers are notified on NL_flush().
NL_subject_T NL_get_new_record_subject (NL_log_T self)
Return subject for observers of new records. The observer pattern is used to keep the summarizer and 'main' NetLogger API decoupled. This function and NL_get_flush_subject() are used to get a subject to which summarizer observers are added.
- Parameters: self Log object
- Returns: Subject whose observers are notified when a new record is detected during execution of NL_write().
int NL_summ_new_record (void *self, void *record)
Inform summarizer of a new NL_rec_t record. This is called by the observer of the subject associated with new records that are detected during NL_write().
- Parameters:
- self Summarizer object
- record Pointer to initialized NetLogger record (NL_rec_t*)
- Returns: Success (0) or failure (-1). If failure, this record will not be summarized in this or subsequent calls to NL_write().
int NL_summ_write_record (void *self, void *rl)
Write record to output. This will be called whenever one of the summarizer routines associated with the sequences added by NL_summ_add_sequence() performs output. They all share the same output log.
- Parameters:
- self Summarizer object
- rl Pointer to a structure combining a NetLogger record and the logging level at which it should be written to the output log.
- Precondition: The 'rl' parameter contains a valid and non-NULL record
- Postcondition: memory pointed to by rl is freed
unsigned NL_summstate_first_access (NL_summstate_T self, unsigned pos)
Is this the first time we accessed this position? Post: next call will return False (0)
int NL_summstate_set_num_values (NL_summstate_T self, unsigned n)
Set number of values to store. If new value is greater than current, will expand to max of all values given. Does reallocation if necessary, so returns 0 on success, -1 on failure of the realloc().
int NL_summstate_write_record (NL_summstate_T self, void *rec, NL_level_t level)
Convenience method to write a record.
