E
E
Evgeny Yakushov2020-10-20 19:23:11
C++ / C#
Evgeny Yakushov, 2020-10-20 19:23:11

How to pass this from a class method to another method of another class?

The bottom line is this, there is an object that came here by reference, it calls the Move method

class StreamFly : public QRunnable
{
private:
    FlyObj * flyObjVector; // Вот он в классе
    ModuleRls * RLS;
    QMutex * mutex;
protected:
    void run();
public:
    StreamFly(FlyObj&, ModuleRls&, QMutex&);
};


StreamFly::StreamFly(FlyObj &init_ObjList, ModuleRls &init_RLS, QMutex &init_Mutex)
{
    flyObjVector    = &init_ObjList; // Вот он пришел объект
    RLS                 = &init_RLS;
    mutex             = &init_Mutex;
}


void StreamFly::run()
{
    if (flyObjVector->state.v > 0)
    {
        mutex->lock();
        RLS->Peleng(flyObjVector->typeObj, flyObjVector->objID, flyObjVector->state.x, flyObjVector->state.y);
        mutex->unlock();
        flyObjVector->Move(); // Вот этот метод
    }
}


We go into this method and there is a method of another class here

FilterKalmana filterData; // Объект другого класса в который нужно отправить this


void FlyObj::Move()
{
    filterData.approximationFK(this);
}


And here is the class itself that accepts a class object

#include "FlyObj.h"

class FilterKalmana
{
private:

    double sigmaPsi = 5.0;
    double sigmaEta = 40.0;

    /* ------------------- Function ------------------- */

    void CorrectX(FlyObj &ObjFilter)
    {
        //...
    }

    void CorrectY(FlyObj &ObjFilter)
    {
        //...
    }

public:

    void approximationFK(FlyObj &ObjFilter){
        CorrectX(ObjFilter);
        CorrectY(ObjFilter);
    };
};


And I don't understand how to make it work, it pops up a bunch of errors
5f8f0ed55fdf0764475208.png
Help please, what's wrong??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Yakushov, 2020-10-20
@yevgenyyakushov

See comments

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question