Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/lang/base_object.cc @ 4435

Last change on this file since 4435 was 4435, checked in by bensch, 19 years ago

orxonox/trunk: objectName is now a property of BaseObject, because pNode has nothing to do with a name

File size: 2.1 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer: ...
16*/
17
18
19#include "base_object.h"
20#include "stdincl.h"
21
22
23using namespace std;
24
25
26/**
27   \brief standard constructor
28*/
29BaseObject::BaseObject () 
30{
31  this->className = NULL;
32  this->id = -1;
33  this->finalized = false;
34
35  this->objectName = NULL;
36}
37
38
39/**
40   \brief standard deconstructor
41*/
42BaseObject::~BaseObject () 
43{
44  //  delete []this->className;
45  if (this->objectName)
46    delete []this->objectName;
47}
48
49
50/**
51   \brief sets the class identifiers
52   \param a number for the class from class_list.h enumeration
53   \param the class name
54*/
55void BaseObject::setClassID(int id, const char* className)
56{
57  this->id = id;
58  this->className = className;
59}
60
61
62/**
63   \brief sets the class identifier
64   \param a number for the class from class_list.h enumeration
65*/
66void BaseObject::setClassID (int id)
67{
68  this->id = id;
69}
70
71
72/**
73   \brief sets the class identifiers
74   \param the class name
75*/
76void BaseObject::setClassName(const char* className)
77{
78  this->className = className;
79}
80
81
82/**
83   \brief sets the class identifiers
84   \param a number for the class from class_list.h enumeration
85   \param the class name
86*/
87bool BaseObject::isA (char* className)
88{
89  if( this->className == className)
90    return false;
91  return true;
92}
93
94
95/*
96  \brief this finalizes an object and makes it ready to be garbage collected
97*/
98void BaseObject::finalize()
99{
100  this->finalized = true;
101}
102
103
104/**
105  \brief set the name of the node
106
107  for debug purposes realy usefull, not used to work properly
108*/
109void BaseObject::setName (const char* newName)
110{
111  if (this->objectName)
112    delete []this->objectName;
113  if (newName)
114    {
115      this->objectName = new char[strlen(newName)+1];
116      strcpy(this->objectName, newName);
117    }
118  else 
119    this->objectName = NULL;
120}
Note: See TracBrowser for help on using the repository browser.