The Assimilation Project  based on Assimilation version 1.1.7.1474836767
cma.assimeventobserver.AssimEventObserver Class Reference
Inheritance diagram for cma.assimeventobserver.AssimEventObserver:
Collaboration diagram for cma.assimeventobserver.AssimEventObserver:

Public Member Functions

def __init__ (self, constraints)
 
def notifynewevent (self, event)
 
def is_interesting (self, event)
 

Static Public Member Functions

def getvalue (event, attr)
 

Data Fields

 constraints
 

Detailed Description

This class is an abstract base class which is all about observing AssimEvents.
Our subclasses presumably know what to do with these events.

Definition at line 42 of file assimeventobserver.py.

Constructor & Destructor Documentation

def cma.assimeventobserver.AssimEventObserver.__init__ (   self,
  constraints 
)
Initializer for AssimEventObserver class.

Parameters:
-----------
constraints: dict-like *or* callable() returning bool
    A dict describing our desired events. The constraints in the dict are
    effectively ANDed together.  Each key is an attribute name in either
    the event itself or its associated object.  The value associated with
    each attribute is either a list or a scalar value or something
    implementing __contains__.  A scalar value implies that it *must* have exactly
    that value, otherwise it must be *in* the associated list/tuple/etc.

    This should be able to constrain the type of event we're looking at, the
    type of event-object we're looking at, and the domain of the event-object -
    and lots of other potentially useful things.

    See the "is_interesting" method below for implementation details...

    If 'constraints' is a callable (that is, callable(constraints) is True), then
    we will just call constraints(event) to see if the event is interesting to
    this observer. Whatever 'constraints' returns will be interpreted in a
    boolean context - so returning a bool would be a good idea...

Definition at line 47 of file assimeventobserver.py.

Member Function Documentation

def cma.assimeventobserver.AssimEventObserver.getvalue (   event,
  attr 
)
static

Definition at line 122 of file assimeventobserver.py.

def cma.assimeventobserver.AssimEventObserver.is_interesting (   self,
  event 
)
Return True if the given event conforms to our constraints.  That is, would it
be interesting to our observers?

Parameters:
-----------
event: AssimEvent
    The event we're evaluating to see if our listeners want to hear about it.

Definition at line 83 of file assimeventobserver.py.

References cma.assimeventobserver.AssimEventObserver.constraints.

Referenced by cma.assimeventobserver.FIFOEventObserver.notifynewevent().

Here is the caller graph for this function:

def cma.assimeventobserver.AssimEventObserver.notifynewevent (   self,
  event 
)
We get called when a new AssimEvent has occured that we might want to observe.
But we are an abstract base class so we error out with NotImplementedError every time!

Definition at line 74 of file assimeventobserver.py.

Field Documentation

cma.assimeventobserver.AssimEventObserver.constraints

The documentation for this class was generated from the following file: