Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3554 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Mar 15, 2005, 12:21:28 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: nicer constructor

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

Legend:

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

    r3551 r3554  
    3636   \todo this constructor is not jet implemented - do it
    3737*/
    38 NullParent::NullParent () : PNode("NullParent")
     38NullParent::NullParent () : PNode (new Vector(0,0,0), NULL)
    3939{
    4040  printf("NullParent::NullParent() - making new NullParent, there can only be one..\n");
     
    4545
    4646
    47 NullParent::NullParent (Vector* absCoordinate) : PNode("NullParent")
     47NullParent::NullParent (Vector* absCoordinate) : PNode (new Vector(0,0,0), NULL)
    4848{
     49  singletonRef = this;
    4950  this->parent = this;
    5051  this->mode = ALL;
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3552 r3554  
    4848PNode::PNode (Vector* absCoordinate, PNode* parent )
    4949{
     50  this->init(parent);
     51
    5052  this->absCoordinate = *absCoordinate;
    51   this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
    52  
    53   this->init(parent);
    54 
    55   parent->addChild (this);
    56 }
    57 
    58 
    59 /**
    60    \brief this constructor is very special.
    61    \param with the name of the class
    62 
    63    this constuctor exists, because there was a little issue with a
    64    PNode<->NullPointer relation. It is crutial, that this construcor
    65    exists, and is never used except from the NullParent itself. If you
    66    delete it, there will probably be a endless loop, because in the
    67    default constcutor of PNode NullPointer is generated, and NullPointer
    68    gerenates itself again and again...
    69    dont't think about it...
    70    \todo patrick think about this one here...
    71 */
    72 PNode::PNode(char* name)
    73 {
    74   this->init(NULL);
     53  if (parent != NULL)
     54    {
     55      this->relCoordinate = this->absCoordinate - parent->getAbsCoor ();
     56      parent->addChild (this);
     57    }
     58  else
     59    this->relCoordinate = Vector(0,0,0);
    7560}
    7661
  • orxonox/trunk/src/lib/coord/p_node.h

    r3552 r3554  
    8787
    8888 protected:
    89   PNode(char*);
    90 
    9189  float timeStamp;         //!< this the timeStamp of when the abs{Coordinat, Direction} has been calculated
    9290  char* objectName;        //!< The name of the Object
Note: See TracChangeset for help on using the changeset viewer.