RandObjLinker.h

Go to the documentation of this file.
00001 
00013 /**********************************************************************
00014  *<
00015     CREATED BY: Oleg Bayborodin
00016 
00017     HISTORY:    created 12-04-2001
00018 
00019  *> Copyright (c) 2001, All Rights Reserved.
00020  **********************************************************************/
00021 
00022 #pragma once
00023 
00024 #include "PFExport.h"
00025 #include "..\RandGenerator.h"
00026 #include "..\maxheap.h"
00027 #include "..\tab.h"
00028 // forward declarations
00029 class IObject;
00030 
00031 
00032 class RandObjLinker: public MaxHeapOperators {
00033 public:
00034 
00035     PFExport RandObjLinker();
00036     PFExport ~RandObjLinker();
00037 
00038     // to initialize random generator for a particle container "pCont"
00039     PFExport bool Init(IObject* pCont, int randomSeed);
00040     // to release random generator for a particle container "pCont"
00041     PFExport void Release(IObject* pCont);
00042     // to get a random generator associated with a particle container "pCont"
00043     PFExport RandGenerator* GetRandGenerator(IObject* pCont) const;
00044     // to deallocate all random generators and all data
00045     PFExport void FreeAll();
00046 
00047 private:
00048     bool HasPContainer(IObject* pCont) const;
00049     bool AddPContainer(IObject* pCont, int randomSeed);
00050 
00051     // const access to class members
00052     int                         num()                           const { return m_num; }
00053     const Tab<IObject*>&        particleContainers()            const { return m_particleContainers; }
00054     IObject*                    particleContainer(int index)    const { return m_particleContainers[index]; }
00055     const Tab<RandGenerator*>&  randGenerators()                const { return m_randGenerators; }
00056     RandGenerator*              randGenerator(int index)        const { return m_randGenerators[index]; }
00057 
00058     // access to class members
00059     int&                    _num()                          { return m_num; }
00060     Tab<IObject*>&          _particleContainers()           { return m_particleContainers; }
00061     IObject*&               _particleContainer(int index)   { return m_particleContainers[index]; }
00062     Tab<RandGenerator*>&    _randGenerators()               { return m_randGenerators; }
00063     RandGenerator*&         _randGenerator(int index)       { return m_randGenerators[index]; }
00064 
00065 protected:
00066     int m_num;
00067     Tab<IObject*> m_particleContainers;
00068     Tab<RandGenerator*> m_randGenerators;
00069 };
00070 
00071 
00072