SimObjectArrayFactory.cpp

Go to the documentation of this file.
00001 #include "SimObjectArrayFactory.h"
00002 
00003         
00004 SimObjectArrayFactory::SimObjectArrayFactory( vector< SimObjectFactory* > const & objectList)
00005 {
00006         simObjectList.resize( objectList.size() );
00007         vector< SimObjectFactory *>::const_iterator it;
00008         vector< SimObject *>::iterator dest_it;
00009         for (dest_it = simObjectList.begin(), it = objectList.begin() ; 
00010             it != objectList.end() ; ++it, ++dest_it) {
00011                 *dest_it = (*it)->create();
00012         }
00013 }
00014 
00015 SimObjectArrayFactory::SimObjectArrayFactory( size_t size )
00016 {
00017         simObjectList.reserve(size);    
00018 }
00019 
00020 void SimObjectArrayFactory::add(SimObjectFactory const * const factory)
00021 {
00022         simObjectList.push_back(factory->create());     
00023 }
00024 
00025         
00026 SimObjectArrayFactory::~SimObjectArrayFactory()
00027 {
00028         
00029 }
00030 
00031 void SimObjectArrayFactory::reset() 
00032 {
00033         cursor = 0;
00034 }
00035 
00036 SimObject* SimObjectArrayFactory::create( RandomEngine *eng ) 
00037 {
00038     return create();
00039 }
00040 
00041 SimObject* SimObjectArrayFactory::create(void) 
00042 {
00043     SimObject *obj = simObjectList[cursor];
00044     cursor++;
00045     return obj;
00046 }
00047 
00048 object_type_t SimObjectArrayFactory::getObjectTypeID() const
00049 {
00050     return (simObjectList[cursor])->getObjectTypeID();
00051 }

Generated on Wed Jul 9 16:34:37 2008 for PCSIM by  doxygen 1.5.5