Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3529 in orxonox.OLD for orxonox/trunk/src/lib/coord


Ignore:
Timestamp:
Mar 13, 2005, 10:39:28 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: zero-loop problem in pnode, dynamic pnode realocation. unstable, segfault when changing level.

Location:
orxonox/trunk/src/lib/coord
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/null_parent.cc

    r3488 r3529  
    3636   \todo this constructor is not jet implemented - do it
    3737*/
    38 NullParent::NullParent ()
     38NullParent::NullParent () : PNode("NullParent")
    3939{
     40  printf("NullParent::NullParent() - making new NullParent, there can only be one..\n");
    4041  this->parent = this;
    4142  this->mode = ALL;
     43  this->setName("NullParent");
    4244}
    4345
    4446
    45 NullParent::NullParent (Vector* absCoordinate)
     47NullParent::NullParent (Vector* absCoordinate) : PNode("NullParent")
    4648{
    4749  this->parent = this;
    4850  this->mode = ALL;
    4951  this->absCoordinate = *absCoordinate;
     52  this->setName("NullParent");
    5053}
    5154
     
    5861NullParent::~NullParent ()
    5962{
    60   delete singletonRef;
     63  //delete singletonRef;
    6164  singletonRef = NULL;
    6265}
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3521 r3529  
    4040  this->bAbsDirChanged = false;
    4141  this->parent = NULL;
     42
     43  printf("PNode::PNode() - constructor, now adding\n");
     44  NullParent* np = NullParent::getInstance();
     45  np->addChild(this);
     46  printf("PNode::PNode() - finished adding\n");
    4247}
    4348
     
    6368}
    6469
     70
     71/**
     72   \brief this constructor is very special.
     73   \param with the name of the class
     74
     75   this constuctor exists, because there was a little issue with a
     76   PNode<->NullPointer relation. It is crutial, that this construcor
     77   exists, and is never used except from the NullParent itself. If you
     78   delete it, there will probably be a endless loop, because in the
     79   default constcutor of PNode NullPointer is generated, and NullPointer
     80   gerenates itself again and again...
     81   dont't think about it...
     82   \todo patrick think about this one here...
     83*/
     84PNode::PNode(char* name)
     85{
     86  printf("PNode::PNode(char*) - start\n");
     87  this->children = new tList<PNode>();
     88  this->bRelCoorChanged = true;
     89  this->bAbsCoorChanged = false;
     90  this->bRelDirChanged = true;
     91  this->bAbsDirChanged = false;
     92  this->parent = NULL;
     93  printf("PNode::PNode(char*) - end\n");
     94}
    6595
    6696/**
     
    96126      pn = this->children->nextElement();
    97127    }
     128  /* this deletes all children in the list */
    98129  this->children->destroy ();
    99130}
     
    280311void PNode::addChild (PNode* pNode, parentingMode mode)
    281312{
    282   if( pNode->parent == NULL )
     313  if( pNode->parent != NULL )
    283314    {
    284       pNode->mode = mode;
    285       pNode->parent = this;
    286       this->children->add (pNode);
     315      printf("PNode::addChild() - removing child from old parent \n");
     316      PRINTF(2)("PNode::addChild() - reparenting node: removing it and adding it again\n");
     317      pNode->parent->removeChild(pNode);
    287318    }
    288   else
    289     {
    290       PRINTF(1)("PNode::addChild() - this node has already been added - closed Loop MARK \n");
    291     }
     319  pNode->mode = mode;
     320  pNode->parent = this;
     321  this->children->add(pNode);
     322  printf("PNode::addChild() - Parent added\n");
    292323}
    293324
     
    358389void PNode::update (float timeStamp)
    359390{
    360   printf ("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
     391  //printf ("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
     392  // printf("%s", this->objectName);
    361393
    362394      if( this->mode == MOVEMENT || this->mode == ALL)
  • orxonox/trunk/src/lib/coord/p_node.h

    r3521 r3529  
    2323
    2424#include "stdincl.h"
     25
    2526
    2627class PNode; /* forward decleration, so that parentEntry has access to PNode */
     
    8081
    8182 protected:
     83  PNode(char*);
     84
    8285  float timeStamp;         //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated
    8386  char* objectName;        //!< The name of the Object
     
    9598
    9699#endif /* _P_NODE_H */
     100 
Note: See TracChangeset for help on using the changeset viewer.