Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/util/object_manager.cc @ 4286

Last change on this file since 4286 was 4286, checked in by patrick, 19 years ago

orxonox/trunk: implemented the objectmanager cache function

File size: 1.7 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Patrick Boenzli
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_OBJECT_MANAGER
17
18#include "object_manager.h"
19#include "list.h"
20#include "world_entity.h"
21
22using namespace std;
23
24
25/**
26   \brief standard constructor
27*/
28ObjectManager::ObjectManager () 
29{
30  this->setClassName ("ObjectManager");
31 
32  //this->managedObjectList = new BaseObject*[CL_NUMBER];
33  this->managedObjectList = new tList<BaseObject>*[CL_NUMBER];
34}
35
36/**
37   \brief the singleton reference to this class
38*/
39ObjectManager* ObjectManager::singletonRef = NULL;
40
41/**
42   \returns a Pointer to this Class
43*/
44ObjectManager* ObjectManager::getInstance(void)
45{
46  if (!ObjectManager::singletonRef)
47    ObjectManager::singletonRef = new ObjectManager();
48  return ObjectManager::singletonRef;
49}
50
51
52/**
53   \brief standard deconstructor
54
55*/
56ObjectManager::~ObjectManager () 
57{
58  ObjectManager::singletonRef = NULL;
59}
60
61
62void ObjectManager::cache(classList index, int number, const BaseObject &copyObject)
63{
64  //this->managedObjectList[index] = new BaseObject[number];
65  this->managedObjectList[index] = new tList<BaseObject>();
66  for(int i = 0; i < number; ++i)
67    {
68      this->managedObjectList[index]->add(new BaseObject(copyObject));
69    }
70}
71
72
73void ObjectManager::addToDeadList(const char* className, BaseObject* object)
74{}
75
76
77BaseObject* ObjectManager::getFromDeadList(const char* className, int number)
78{}
Note: See TracBrowser for help on using the repository browser.