HomePhorge

adapded to Benedikts Linear Function s

Description

adapded to Benedikts Linear Function s

todo:

  • clear up how much of SA[...]0.3.27/src/Agent.cpp: 1014 falls into my domain
  • adapt once "Reliableagents" exist
  • cleanup

Details

Auditors
btutzer
Provenance
danielAuthored on Apr 29 2019, 12:21 PM
dschnoellPushed on Apr 29 2019, 12:24 PM
Parents
R20:c9c6a237f815: Merge branch 'feature/linear_functions' into CrossRel-Conf
Branches
Unknown
Tags
Unknown

Event Timeline

daniel <daniel.s13@live.de> committed R20:43f9eab48272: adapded to Benedikts Linear Function s (authored by daniel <daniel.s13@live.de>).Apr 29 2019, 12:24 PM
btutzer added subscribers: juhasz, btutzer.

I see that you are accepting raw pointers as input to addCrossReliabilityProfile and expect them to be uniquely owned by the module. I made the same mistake (actually mine was a lot worse since I did not delete them in the destructor), but agree with @juhasz that it is bad practice. Can you move to std::uniqe_ptr's/std::shared_ptr's?

This commit now has outstanding concerns.Apr 30 2019, 3:25 PM

Moved it to std::unique_ptr .
Internally it still uses the raw pointers by using std::unique_ptr::release() to get the pointer and removing it from the unique_ptr .

It is updatet in Functionality_Reliability Branch

Moved it to std::unique_ptr .
Internally it still uses the raw pointers by using std::unique_ptr::release() to get the pointer and removing it from the unique_ptr .

It is updatet in Functionality_Reliability Branch

Any reason why you are opposed to use smart pointers? As they are used throughout the library, I would suggest to use them everywhere.
@juhasz what do you think?

Any reason why you are opposed to use smart pointers? As they are used throughout the library, I would suggest to use them everywhere.
@juhasz what do you think?

Agree. Also, R20:4f72bb7aa735#inline-105.

I'm normally against using shared pointers when the resources aren't explicitly meant to be shared
, but I don't mind.

done

I'm normally against using shared pointers when the resources aren't explicitly meant to be shared

I agree with that! :)
Don't use shared pointer if something is not shared. Use a unique pointer in that case.

I already changed it to shared pointers to hold the lib consistent. Or did I misunderstand something and abstractions are meant to be shared ?

So David you decide shared or unique pointers ? [Concerning the consistency]

I already changed it to shared pointers to hold the lib consistent. Or did I misunderstand something and abstractions are meant to be shared ?

So David you decide shared or unique pointers ? [Concerning the consistency]

About consistency: we should use smart pointers.

Whether to use shared or unique pointer is to be decided for each usage separately. If one object is shared and needs to be referenced from multiple places at the same time, then shared pointer must be used; unique pointer otherwise.

Abstractions in this case are uniquely owned and not shared -- as far as I remember. So std::unique_ptr should be used here.

@btutzer, how do you see this?

I already changed it to shared pointers to hold the lib consistent. Or did I misunderstand something and abstractions are meant to be shared ?

So David you decide shared or unique pointers ? [Concerning the consistency]

About consistency: we should use smart pointers.

Whether to use shared or unique pointer is to be decided for each usage separately. If one object is shared and needs to be referenced from multiple places at the same time, then shared pointer must be used; unique pointer otherwise.

Abstractions in this case are uniquely owned and not shared -- as far as I remember. So std::unique_ptr should be used here.

@btutzer, how do you see this?

Sounds good to me, although I did not think about unique/shared in this case. I agree that unique_ptr would be the way to go, unless, @dschnoell can think about a case where the abstractions may be passed around and not solely owned by a ReliableAgent object.
E.g. for the *StateDetector classes, shared_ptrs to abstractions are passed to the constructor so that the abstractions can be changed from outside, because at some point we are going to change them during runtime. If that applies to your classes as well, I think you should stick with the shared_ptrs, since overhead is not much more compared to unique_ptrs (I think).

As discussed with @btutzer currently there isn't a case, but at some point it could be beneficial to be able to adapt the the abstractions during run time.

So it will stay a shared pointer.

Moved it to std::unique_ptr .
Internally it still uses the raw pointers by using std::unique_ptr::release() to get the pointer and removing it from the unique_ptr .

It is updatet in Functionality_Reliability Branch

Any reason why you are opposed to use smart pointers? As they are used throughout the library, I would suggest to use them everywhere.
@juhasz what do you think?

Resolved in b844a8fa9d69

All concerns with this commit have now been addressed.Jul 9 2019, 11:09 AM