![]() |
|
|
Generated: 8 Jan 2009 |
#include <RndmEngine.h>


Description: Definition of a interface for a generic random number generator giving randomly distributed numbers in the range [0...1] number generators.
Dependencies:
History :
+---------+----------------------------------------------+--------+
| Date | Comment | Who |
+---------+----------------------------------------------+--------+
| 21/04/99| Initial version. | MF |
+---------+----------------------------------------------+--------+
Author: M.Frank Version: 1.0
Definition at line 46 of file RndmEngine.h.
Public Member Functions | |
| StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
| Query interface. | |
| virtual StatusCode | initialize () |
| Service override: initialisation. | |
| virtual StatusCode | finalize () |
| Service override: finalisation. | |
| virtual double | rndm () const |
| Single shot returning single random number. | |
| virtual StatusCode | rndmArray (std::vector< double > &array, long howmany, long start=0) const |
| Multiple shots returning vector with flat random numbers. | |
| virtual StreamBuffer & | serialize (StreamBuffer &str) |
| Input serialisation from stream buffer. | |
| virtual StreamBuffer & | serialize (StreamBuffer &str) const |
| Output serialisation to stream buffer. | |
| virtual void | handle (const Incident &inc) |
| Inform that a new incident has occured. | |
Protected Member Functions | |
| RndmEngine (const std::string &name, ISvcLocator *loc) | |
| Standard Constructor. | |
| virtual | ~RndmEngine () |
| Standard Destructor. | |
Protected Attributes | |
| IIncidentSvc * | m_pIncidentSvc |
| Reference to the incident service. | |
| RndmEngine::RndmEngine | ( | const std::string & | name, | |
| ISvcLocator * | loc | |||
| ) | [protected] |
Standard Constructor.
Standard Service constructor.
Definition at line 31 of file RndmEngine.cpp.
00032 : Service(name, loc), m_pIncidentSvc(0) 00033 { 00034 }
| RndmEngine::~RndmEngine | ( | ) | [protected, virtual] |
Standard Destructor.
Standard Service destructor.
Definition at line 37 of file RndmEngine.cpp.
00037 { 00038 if ( m_pIncidentSvc ) m_pIncidentSvc->release(); 00039 }
| StatusCode RndmEngine::queryInterface | ( | const InterfaceID & | riid, | |
| void ** | ppvInterface | |||
| ) | [virtual] |
Query interface.
Reimplemented from Service.
Definition at line 42 of file RndmEngine.cpp.
00042 { 00043 if ( IID_IRndmEngine == riid ) { 00044 *ppvInterface = (IRndmEngine*)this; 00045 } 00046 else if ( IID_ISerialize == riid ) { 00047 *ppvInterface = (ISerialize*)this; 00048 } 00049 else if ( IID_IIncidentListener == riid ) { 00050 *ppvInterface = (IIncidentListener*)this; 00051 } 00052 else { 00053 return Service::queryInterface(riid, ppvInterface); 00054 } 00055 addRef(); 00056 return StatusCode::SUCCESS; 00057 }
| StatusCode RndmEngine::initialize | ( | ) | [virtual] |
Service override: initialisation.
Reimplemented from Service.
Reimplemented in HepRndm::Engine< TYPE >.
Definition at line 60 of file RndmEngine.cpp.
00060 { 00061 StatusCode status = Service::initialize(); 00062 if ( status.isSuccess() ) { 00063 status = setProperties(); 00064 if ( status.isSuccess() ) { 00065 status = serviceLocator()->service( "IncidentSvc", m_pIncidentSvc, true ); 00066 } 00067 } 00068 return status; 00069 }
| StatusCode RndmEngine::finalize | ( | void | ) | [virtual] |
Service override: finalisation.
Reimplemented from Service.
Reimplemented in HepRndm::Engine< TYPE >.
Definition at line 72 of file RndmEngine.cpp.
00072 { 00073 StatusCode status = Service::finalize(); 00074 if ( m_pIncidentSvc ) { 00075 m_pIncidentSvc->release(); 00076 } 00077 m_pIncidentSvc = 0; 00078 return status; 00079 }
| double RndmEngine::rndm | ( | ) | const [virtual] |
Single shot returning single random number.
Implements IRndmEngine.
Reimplemented in HepRndm::Engine< TYPE >.
Definition at line 93 of file RndmEngine.cpp.
| StatusCode RndmEngine::rndmArray | ( | std::vector< double > & | array, | |
| long | howmany, | |||
| long | start = 0 | |||
| ) | const [virtual] |
Multiple shots returning vector with flat random numbers.
| array | Array containing random numbers | |
| howmany | fill 'howmany' random numbers into array | |
| start | ... starting at position start |
| array | Array containing random numbers | |
| howmany | fill 'howmany' random numbers into array | |
| start | ... starting at position start |
Implements IRndmEngine.
Definition at line 107 of file RndmEngine.cpp.
00107 { 00108 long cnt = start; 00109 array.resize(start+howmany); 00110 for ( long i = start, num = start+howmany; i < num; i++ ) { 00111 array[cnt++] = rndm(); 00112 } 00113 return StatusCode::SUCCESS; 00114 }
| StreamBuffer & RndmEngine::serialize | ( | StreamBuffer & | str | ) | [virtual] |
Input serialisation from stream buffer.
IRndmEngine interface implementation.
Restores the status of the object.
| str | Reference to Streambuffer to be filled |
Implements ISerialize.
Definition at line 83 of file RndmEngine.cpp.
| StreamBuffer & RndmEngine::serialize | ( | StreamBuffer & | str | ) | const [virtual] |
Output serialisation to stream buffer.
Output serialisation to stream buffer. Saves the status of the generator engine.
Saves the status of the object.
| str | Reference to Streambuffer to be read |
Implements ISerialize.
Definition at line 88 of file RndmEngine.cpp.
| void RndmEngine::handle | ( | const Incident & | inc | ) | [virtual] |
Inform that a new incident has occured.
Single shot returning single random number.
Implements IIncidentListener.
Definition at line 98 of file RndmEngine.cpp.
IIncidentSvc* RndmEngine::m_pIncidentSvc [protected] |