|
@@ -24,6 +24,10 @@ class HdfObject {
|
|
|
: endFunction(endFunction)
|
|
|
, id(id) {
|
|
|
}
|
|
|
+ HdfDestroyer(const HdfDestroyer& other)
|
|
|
+ : endFunction(other.endFunction)
|
|
|
+ , id(other.id) {
|
|
|
+ }
|
|
|
~HdfDestroyer() {
|
|
|
endFunction(id);
|
|
|
}
|
|
@@ -38,11 +42,21 @@ class HdfObject {
|
|
|
/// then the destructor of the destroyer will call the end access function.
|
|
|
class HdfDestroyerChain {
|
|
|
public:
|
|
|
- HdfDestroyerChain() {
|
|
|
- }
|
|
|
- HdfDestroyerChain(const HdfDestroyerChain &other)
|
|
|
+ HdfDestroyerChain() = default;
|
|
|
+ HdfDestroyerChain(const HdfDestroyerChain &other) noexcept
|
|
|
: chain(other.chain) {
|
|
|
}
|
|
|
+ HdfDestroyerChain(HdfDestroyerChain &&other) noexcept
|
|
|
+ : chain(std::move(other.chain)) {
|
|
|
+ }
|
|
|
+ HdfDestroyerChain &operator=(const HdfDestroyerChain &other) noexcept {
|
|
|
+ chain = other.chain; // copy
|
|
|
+ return *this;
|
|
|
+ }
|
|
|
+ HdfDestroyerChain &operator=(HdfDestroyerChain &&other) noexcept {
|
|
|
+ chain = std::move(other.chain);
|
|
|
+ return *this;
|
|
|
+ }
|
|
|
|
|
|
void emplaceBack(const std::function<int32(int32)> &endFunction, int32 id) {
|
|
|
chain.emplace_back(new HdfDestroyer(endFunction, id));
|
|
@@ -69,6 +83,11 @@ class HdfObject {
|
|
|
, classType(classType)
|
|
|
, chain(chain) {
|
|
|
}
|
|
|
+ HdfObject(const Type &type, const ClassType &classType, HdfDestroyerChain &&chain)
|
|
|
+ : type(type)
|
|
|
+ , classType(classType)
|
|
|
+ , chain(std::move(chain)) {
|
|
|
+ }
|
|
|
HdfObject(const HdfObject *object)
|
|
|
: type(object->getType())
|
|
|
, classType(object->getClassType())
|