Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2008, 4:32:31 AM (16 years ago)
Author:
landauf
Message:
  • packed all super-function-related code into a bunch of macros and commented the code.
  • added tick, XMLPort, changedActivity and changedVisibility as super-functions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/orxonox/objects/ParticleProjectile.cc

    r1676 r1684  
    3333#include "core/CoreIncludes.h"
    3434#include "core/ConfigValueIncludes.h"
    35 //#include "util/FastDelegate.h"
    36 //using namespace fastdelegate;
    3735
    3836namespace orxonox
    3937{
    4038    CreateFactory(ParticleProjectile);
    41 
    42     struct FunctionPointerViewer
    43     {
    44         void* ptr1_;
    45         void* ptr2_;
    46 
    47         void view()
    48         {
    49             std::cout << ptr1_ << "." << ptr2_ << std::endl;
    50         }
    51     };
    52 
    53     union FunctionPointerViewer1
    54     {
    55         FunctionPointerViewer viewer_;
    56         void (Projectile::*function_) ();
    57     };
    58 
    59     union FunctionPointerViewer2
    60     {
    61         FunctionPointerViewer viewer_;
    62         void (BillboardProjectile::*function_) ();
    63     };
    64 
    65     union FunctionPointerViewer3
    66     {
    67         FunctionPointerViewer viewer_;
    68         void (ParticleProjectile::*function_) ();
    69     };
    7039
    7140    ParticleProjectile::ParticleProjectile(SpaceShip* owner) : BillboardProjectile(owner)
     
    8655
    8756        this->setConfigValues();
    88 /*
    89         FunctionPointerViewer1 fpw1;
    90         fpw1.function_ = &Projectile::testfunction;
    91         FunctionPointerViewer2 fpw2;
    92         fpw2.function_ = &BillboardProjectile::testfunction;
    93         FunctionPointerViewer3 fpw3;
    94         fpw3.function_ = &ParticleProjectile::testfunction;
    9557
    96         std::cout << sizeof(void (Projectile::*) ()) << std::endl;
    97         fpw1.viewer_.view();
    98         fpw2.viewer_.view();
    99         fpw3.viewer_.view();
    100 
    101         {
    102             std::cout << "1:" << std::endl;
    103             FastDelegate0<> delegate1(this, &ParticleProjectile::testfunction);
    104             delegate1();
    105             FastDelegate0<> delegate2((BillboardProjectile*)this, &BillboardProjectile::testfunction);
    106             delegate2();
    107             FastDelegate0<> delegate3(this, &Projectile::testfunction);
    108             delegate3();
    109         }
    110         {
    111             std::cout << "2:" << std::endl;
    112             BillboardProjectile temp;
    113 //            FastDelegate0<> delegate1(&temp, &ParticleProjectile::testfunction);
    114 //            delegate1();
    115             FastDelegate0<> delegate2(&temp, &BillboardProjectile::testfunction);
    116             delegate2();
    117             FastDelegate0<> delegate3(&temp, &Projectile::testfunction);
    118             delegate3();
    119         }
    120         std::cout << "done" << std::endl;
    121 
    122         std::cout << "0:" << std::endl;
    123         this->Projectile::testfunction();
    124         this->BillboardProjectile::testfunction();
    125         this->ParticleProjectile::testfunction();
    126         this->testfunction();
    127 
    128         std::cout << "1:" << std::endl;
    129         (this->*fpw1.function_)();
    130         std::cout << "2:" << std::endl;
    131         (this->*fpw2.function_)();
    132         std::cout << "3:" << std::endl;
    133         (this->*fpw3.function_)();
    134         std::cout << "done" << std::endl;
    135 */
    13658        std::cout << "c:\n";
    13759        SUPER(ParticleProjectile, testfunction);
     
    14163        this->testfunction();
    14264        std::cout << "f:\n";
    143 
    144 //        (*((ClassIdentifier<SuperDummy>*)this->getIdentifier())->superFunctionCaller_testfunction_)(this);
    14565    }
    14666
     
    15878    void ParticleProjectile::changedVisibility()
    15979    {
    160         BillboardProjectile::changedVisibility();
     80//        BillboardProjectile::changedVisibility();
     81        SUPER(ParticleProjectile, changedVisibility);
    16182        this->particles_->setEnabled(this->isVisible());
    16283    }
Note: See TracChangeset for help on using the changeset viewer.