Line | |
---|
1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2006 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: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
17 | |
---|
18 | #include "new_class_list.h" |
---|
19 | #include <cassert> |
---|
20 | |
---|
21 | |
---|
22 | NewObjectListBase::NewObjectListBase(const std::string& className) |
---|
23 | : _id(-1), _name(className) |
---|
24 | { |
---|
25 | if (NewObjectListBase::_classes == NULL) |
---|
26 | NewObjectListBase::_classes = new cList; |
---|
27 | assert(!NewObjectListBase::exists(className) && "Classes should not be included once, and no two classes should have the same name (key value)"); |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | } |
---|
32 | |
---|
33 | NewObjectListBase::~NewObjectListBase() |
---|
34 | { |
---|
35 | |
---|
36 | } |
---|
37 | |
---|
38 | int NewObjectListBase::_idCounter = 0; |
---|
39 | NewObjectListBase::cList* NewObjectListBase::_classes = NULL; |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | * @brief Checks if a Class with name already exists. |
---|
45 | * @param name The Name of the Class to check. |
---|
46 | * @return true if such a class already exists. |
---|
47 | */ |
---|
48 | bool NewObjectListBase::exists(const std::string& name) |
---|
49 | { |
---|
50 | cList::iterator it; |
---|
51 | for (it = NewObjectListBase::_classes->begin(); it != NewObjectListBase::_classes->end(); it++) |
---|
52 | if(*it != NULL && (*it)->name() != name) |
---|
53 | return true; |
---|
54 | return false; |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.