01 solution
This commit is contained in:
parent
98c6e66b30
commit
96106f096c
12
main.cpp
12
main.cpp
@ -1,13 +1,12 @@
|
||||
#include <iostream>
|
||||
#include "fsfw/objectmanager.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MySystemObject: public SystemObject {
|
||||
public:
|
||||
MySystemObject(): SystemObject(0x10101010, false) {}
|
||||
MySystemObject(): SystemObject(0x10101010) {}
|
||||
ReturnValue_t initialize() override {
|
||||
cout << "MySystemObject::initialize: Custom init" << endl;
|
||||
}
|
||||
@ -15,8 +14,9 @@ public:
|
||||
|
||||
int main() {
|
||||
auto* mySysObj = new MySystemObject();
|
||||
cout << "Object ID: " << setfill('0') << setw(8) << hex << "0x" <<
|
||||
auto* objManager = ObjectManager::instance();
|
||||
cout << "Object ID: " << setfill('0') << hex << "0x" << setw(8) <<
|
||||
mySysObj->getObjectId() << endl;
|
||||
mySysObj->initialize();
|
||||
delete mySysObj;
|
||||
objManager->initialize();
|
||||
return 0;
|
||||
}
|
||||
|
@ -72,3 +72,9 @@ all its registered objects.
|
||||
|
||||
## Subtasks
|
||||
|
||||
1. Register the `MySystemObject` class into the global object manager. You can do this with a
|
||||
simple tweak of the base class constructor.
|
||||
2. Remove the `delete` call. The object manager will delete all of its contained objects
|
||||
automatically in its own destructor
|
||||
3. Retrieve the global instance of the object manager using its static `instance` method
|
||||
and use it to initialize all system objects including your custom system object.
|
||||
|
22
ws-objects-tmtc/objects-tmtc-solutions/main-01.cpp
Normal file
22
ws-objects-tmtc/objects-tmtc-solutions/main-01.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "fsfw/objectmanager.h"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MySystemObject: public SystemObject {
|
||||
public:
|
||||
MySystemObject(): SystemObject(0x10101010, false) {}
|
||||
ReturnValue_t initialize() override {
|
||||
cout << "MySystemObject::initialize: Custom init" << endl;
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
auto* mySysObj = new MySystemObject();
|
||||
cout << "Object ID: " << setfill('0') << hex << "0x" << setw(8) <<
|
||||
mySysObj->getObjectId() << endl;
|
||||
mySysObj->initialize();
|
||||
delete mySysObj;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user