Event Class Reference

Represents a single event which was sampled from a Sampler. The internal value of this event is stored as a variant using boost::any, where the concrete value of type T can be extracted using Event<T>::getValue(). More...

#include <Event.h>

Inheritance diagram for Event:

JointEvent

List of all members.

Public Member Functions

Constructors
 Event (const boost::any &x, Sampler *randomVar=NULL, const boost::any &metadata=boost::any(), real_t p=-1)
 Event (const boost::any &x, const Event &event)
 Event (Sampler *randomVar=NULL, const boost::any &metadata=boost::any())
virtual ~Event ()
Main usage interface
template<typename T>
getValue () const
template<typename T>
getMetadata () const
real_t getPdf ()
Accessors/Mutators
boost::any getValue () const
void setValue (const boost::any &x)
bool hasValue () const
SamplergetParent ()
void setParent (Sampler *randomVar)
boost::any getMetadata () const
void setMetadata (const boost::any &metadata)
bool hasMetadata () const
Convenience implicit conversions for common Event types
 operator real_t () const
 operator int () const
 operator Vector3 () const
 operator SpectralSampleSet () const

Protected Attributes

boost::any m_x
 internal value variant
boost::any m_metadata
Samplerm_sampler
 parent random distribution from which this event was sampled
real_t m_p


Detailed Description

Represents a single event which was sampled from a Sampler. The internal value of this event is stored as a variant using boost::any, where the concrete value of type T can be extracted using Event<T>::getValue().

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008
This makes it esay to have all Samplers conform to the same sampling interface, which facilitates the implementation of more abstract sampling algorithms without respect to specific Sampler implementations. One example of this generic Sampling interface being useful is generic multiple importance sampling (see MultipleImportanceSampler)

Definition at line 30 of file Event.h.


Constructor & Destructor Documentation

Event::Event ( const boost::any &  x,
Sampler randomVar = NULL,
const boost::any &  metadata = boost::any(),
real_t  p = -1 
) [inline]

Parameters:
x is the value of this random event
randomVar is the sampler from which this random event was generated
metadata is optional sampler-specific metadata associated with this event
p is the probability with which this event occurred

Definition at line 44 of file Event.h.

Event::Event ( const boost::any &  x,
const Event event 
) [inline]

Definition at line 50 of file Event.h.

Event::Event ( Sampler randomVar = NULL,
const boost::any &  metadata = boost::any() 
) [inline]

Definition at line 55 of file Event.h.

virtual Event::~Event (  )  [inline, virtual]

Definition at line 60 of file Event.h.


Member Function Documentation

template<typename T>
T Event::getValue (  )  const [inline]

Definition at line 69 of file Event.h.

template<typename T>
T Event::getMetadata (  )  const [inline]

Definition at line 76 of file Event.h.

real_t Event::getPdf (  ) 

Returns:
a cache of the probability with which this event occurred (initializes the cache of it hasn't been computed yet)

Definition at line 23 of file Event.cpp.

boost::any Event::getValue (  )  const [inline]

Definition at line 93 of file Event.h.

void Event::setValue ( const boost::any &  x  )  [inline]

Definition at line 97 of file Event.h.

bool Event::hasValue (  )  const [inline]

Definition at line 101 of file Event.h.

Sampler* Event::getParent (  )  [inline]

Definition at line 105 of file Event.h.

void Event::setParent ( Sampler randomVar  )  [inline]

Definition at line 109 of file Event.h.

boost::any Event::getMetadata (  )  const [inline]

Definition at line 113 of file Event.h.

void Event::setMetadata ( const boost::any &  metadata  )  [inline]

Definition at line 117 of file Event.h.

bool Event::hasMetadata (  )  const [inline]

Definition at line 121 of file Event.h.

Event::operator real_t (  )  const [inline]

Returns:
this Event as a real_t (implicit conversion) for convenience purposes

Definition at line 132 of file Event.h.

Event::operator int (  )  const [inline]

Returns:
this Event as an int (implicit conversion) for convenience purposes

Definition at line 138 of file Event.h.

Event::operator Vector3 (  )  const [inline]

Returns:
this Event as a Vector3 (implicit conversion) for convenience purposes

Definition at line 144 of file Event.h.

Event::operator SpectralSampleSet (  )  const [inline]

Returns:
this Event as a SpectralSampleSet (implicit conversion) for convenience purposes

Definition at line 150 of file Event.h.


Member Data Documentation

boost::any Event::m_x [protected]

internal value variant

Definition at line 158 of file Event.h.

boost::any Event::m_metadata [protected]

internal sampler-specific metadata associated with this event note: may store information about how this event was generated for determining the probability of the event

Definition at line 163 of file Event.h.

Sampler* Event::m_sampler [protected]

parent random distribution from which this event was sampled

Definition at line 166 of file Event.h.

real_t Event::m_p [protected]

probability with which this event occurred with respect to parent sampling distribution

Definition at line 170 of file Event.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6