From fce86b22a2367f1be1f9aae5e1ba3d18d1371b74 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Tue, 8 Dec 2020 22:26:17 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro --- arts/modules/common/env_item_impl.cpp | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 arts/modules/common/env_item_impl.cpp (limited to 'arts/modules/common/env_item_impl.cpp') diff --git a/arts/modules/common/env_item_impl.cpp b/arts/modules/common/env_item_impl.cpp new file mode 100644 index 00000000..6bc960d8 --- /dev/null +++ b/arts/modules/common/env_item_impl.cpp @@ -0,0 +1,48 @@ +#include "artsmodulescommon.h" +#include "debug.h" +#include "env_item_impl.h" + +using namespace Arts; +using namespace std; + +Environment::Item_impl::Item_impl() + : _active(false) +{ +} + +Environment::Item_impl::~Item_impl() +{ + // Items can't be deleted while they are still inside a Container + arts_assert(_active == false); +} + +Environment::Container Environment::Item_impl::parent() +{ + Container p = _parent; + return p; +} + +void Environment::Item_impl::setContainer(Environment::Container container) +{ + if(container.isNull()) // remove from container + { + arts_return_if_fail(_active == true); + + _parent = container; + _active = false; + } + else // add to container + { + Container p = _parent; + arts_return_if_fail(p.isNull() && _active == false); + + _parent = container; + _active = true; + } + active_changed(_active); +} + +bool Environment::Item_impl::active() +{ + return _active; +} -- cgit v1.2.3