<commit_before>/*
 * Copyright (c) 2007 Digital Bazaar, Inc.  All rights reserved.
 */
#ifndef db_event_Observable_H
#define db_event_Observable_H

#include "db/modest/OperationList.h"
#include "db/modest/OperationRunner.h"
#include "db/event/Observer.h"

#include <list>
#include <map>

namespace db
{
namespace event
{

/**
 * An Observable is an object that produces events that can be observed by
 * an Observer. It makes use of a Modest OperationRunner to dispatch its
 * events to all registered Observers.
 * 
 * FIXME: When adding the parallel event processing feature, update
 * documentation below as only serial events will be processed as described.
 * 
 * Observers will receive events in the same order that they were generated.
 * The events are also dispatched "semi-simultaneously," meaning that multiple
 * threads are used to dispatch the events to the Observers.
 * 
 * Events and Observers are associated with EventIds such that when an Event
 * is sent out, it will be sent out to all Observers that are registered with
 * the EventId it was sent out along with. EventIds can also be associated
 * with one another by creating "taps" such that, when an Event is scheduled
 * with one EventId, the Observers of another EventId will "tap" into its
 * distribution and receive it as well.
 * 
 * For instance, two Observers could register for Events. The first could
 * register for Events with EventId 1 and the second could register for
 * Events with EventId 2. Then EventId 2 could be added as a "tap" for
 * EventId 1 such that when Events with EventId 1 are sent, they are also sent
 * to the Observers of EventId 2. Then the first Observer will only get
 * Events sent with EventId 1, but the second will receive events sent with
 * EventId 1 or EventId 2.
 * 
 * Multiple taps may be added for any EventId. No checking is made to ensure
 * that Observers do not receive "double" events due to a poorly created
 * system of taps or due to registration under both a tap and its tapee.<commit_msg>Updated documentation.<commit_after>/*
 * Copyright (c) 2007-2008 Digital Bazaar, Inc.  All rights reserved.
 */
#ifndef db_event_Observable_H
#define db_event_Observable_H

#include "db/modest/OperationList.h"
#include "db/modest/OperationRunner.h"
#include "db/event/Observer.h"

#include <list>
#include <map>

namespace db
{
namespace event
{

/**
 * An Observable is an object that produces events that can be observed by
 * an Observer. It makes use of a Modest OperationRunner to dispatch its
 * events to all registered Observers.
 * 
 * Observers will receive events in the same order that they were generated,
 * unless the events are marked as "parallel", at which point they might
 * arrive at any time. The events are also dispatched "semi-simultaneously,"
 * meaning that multiple threads are used to dispatch the events to the
 * Observers.
 * 
 * Events and Observers are associated with EventIds such that when an Event
 * is sent out, it will be sent out to all Observers that are registered with
 * the EventId it was sent out along with. EventIds can also be associated
 * with one another by creating "taps" such that, when an Event is scheduled
 * with one EventId, the Observers of another EventId will "tap" into its
 * distribution and receive it as well.
 * 
 * For instance, two Observers could register for Events. The first could
 * register for Events with EventId 1 and the second could register for
 * Events with EventId 2. Then EventId 2 could be added as a "tap" for
 * EventId 1 such that when Events with EventId 1 are sent, they are also sent
 * to the Observers of EventId 2. Then the first Observer will only get
 * Events sent with EventId 1, but the second will receive events sent with
 * EventId 1 or EventId 2.
 * 
 * Multiple taps may be added for any EventId. No checking is made to ensure
 * that Observers do not receive "double" events due to a poorly created
 * system of taps or due to registration under both a tap and its tapee.
{'fraction_non_alphanumeric': 0.0534599050711966, 'fraction_numerical': 0.007494379215588309, 'mean_word_length': 3.967741935483871, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1661996', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1049, 'n_words': 602}