From a90b9e5f1644e8775c3dacc9051a966a7446f0d6 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 16 Mar 2024 02:04:47 +0100 Subject: [PATCH] Library: uniform definition scheme for error-IDs In the Lumiera code base, we use C-String constants as unique error-IDs. Basically this allows to create new unique error IDs anywhere in the code. However, definition of such IDs in arbitrary namespaces tends to create slight confusion and ambiguities, while maintaining the proper use statements requires some manual work. Thus I introduce a new **standard scheme** * Error-IDs for widespread use shall be defined _exclusively_ into `namespace lumiera::error` * The shorthand-Macro `LERR_()` can now be used to simplify inclusion and referral * (for local or single-usage errors, a local or even hidden definition is OK) --- src/common/advice/index.hpp | 4 +- src/common/config-rules.hpp | 9 ++- src/common/query/config-rules.cpp | 4 +- src/common/query/defs-manager-impl.hpp | 7 +- src/include/ui-protocol.hpp | 6 +- src/lib/depend.hpp | 2 +- src/lib/diff/diff-language.hpp | 8 ++- src/lib/diff/diff.cpp | 11 +-- src/lib/diff/tree-diff.cpp | 22 +++--- src/lib/error-exception.cpp | 3 +- src/lib/error.hpp | 10 +-- src/lib/linked-elements.hpp | 2 +- src/lib/opaque-holder.hpp | 4 +- src/lib/optional-ref.hpp | 2 +- src/lib/scoped-collection.hpp | 4 +- src/lib/searchpath.cpp | 3 - src/lib/searchpath.hpp | 3 +- src/lib/time/formats.hpp | 11 +-- src/lib/time/timecode.cpp | 34 ++++----- src/lib/time/timevalue.hpp | 2 +- src/lib/variant.hpp | 2 +- src/lib/wrapper.hpp | 2 +- src/stage/ctrl/panel-locator.hpp | 2 +- src/stage/ctrl/playback-controller.cpp | 2 +- src/stage/display-service.cpp | 2 +- src/stage/gtk-base.hpp | 9 ++- src/stage/gtk-lumiera.cpp | 8 ++- src/stage/interact/interaction-director.cpp | 2 +- src/stage/notification-service.cpp | 2 +- src/steam/asset/media.cpp | 2 +- src/steam/asset/struct-factory-impl.hpp | 2 +- src/steam/assetmanager.cpp | 45 ++++++------ src/steam/assetmanager.hpp | 14 ++-- src/steam/control/argument-erasure.hpp | 28 ++++---- src/steam/control/command-closure.hpp | 5 -- src/steam/control/command-mutation.hpp | 10 +-- src/steam/control/command-setup.cpp | 6 +- src/steam/control/command-signature.hpp | 5 ++ src/steam/control/command-simple-closure.hpp | 7 +- src/steam/control/command-storage-holder.hpp | 7 +- src/steam/control/command.cpp | 21 +++--- src/steam/control/command.hpp | 19 +++-- src/steam/control/memento-tie.hpp | 7 +- src/steam/control/session-command-service.cpp | 2 +- src/steam/engine/buffer-metadata.hpp | 25 +++---- src/steam/engine/buffer-provider.cpp | 4 +- src/steam/engine/buffhandle.hpp | 2 - src/steam/engine/channel-descriptor.hpp | 2 - src/steam/mobject/mobject-ref.cpp | 21 +++--- src/steam/mobject/mobject-ref.hpp | 25 +++---- src/steam/mobject/output-mapping.hpp | 4 +- src/steam/mobject/placement-ref.hpp | 38 +++++----- src/steam/mobject/placement.hpp | 31 ++++---- src/steam/mobject/session/placement-index.cpp | 72 +++++++++---------- src/steam/mobject/session/placement-index.hpp | 30 ++++---- src/steam/mobject/session/query-focus.cpp | 4 +- src/steam/mobject/session/scope-path.cpp | 5 -- src/steam/mobject/session/scope-path.hpp | 3 - src/steam/mobject/session/scope.cpp | 12 ++-- src/steam/mobject/session/scope.hpp | 10 ++- src/steam/play/dummy-player-service.cpp | 2 +- src/steam/play/output-manager.hpp | 12 ++-- src/steam/play/play-process.cpp | 4 +- src/steam/play/play-service.cpp | 7 +- src/steam/play/play-service.hpp | 10 +-- src/steam/play/render-configurator.cpp | 4 +- .../basics/dependency-configuration-test.cpp | 4 +- tests/basics/diagnostic-context-test.cpp | 2 +- tests/basics/singleton-subclass-test.cpp | 3 +- .../time/digxel-configurations-test.cpp | 2 +- tests/basics/time/time-control-test.cpp | 2 +- tests/basics/time/time-parsing-test.cpp | 2 +- tests/basics/time/time-value-test.cpp | 2 +- .../application/subsystem-runner-test.cpp | 8 +-- tests/core/steam/asset/create-asset-test.cpp | 24 +++---- tests/core/steam/asset/entry-id-test.cpp | 2 +- .../steam/control/command-argument-test.cpp | 3 +- .../control/command-instance-manager-test.cpp | 7 +- .../steam/control/command-mutation-test.cpp | 2 + .../core/steam/control/command-queue-test.cpp | 22 ++---- .../core/steam/control/command-use1-test.cpp | 10 +-- .../core/steam/control/command-use2-test.cpp | 4 +- tests/core/steam/control/memento-tie-test.cpp | 7 +- .../steam/engine/buffer-metadata-key-test.cpp | 5 -- .../steam/engine/buffer-metadata-test.cpp | 6 +- .../engine/buffer-provider-protocol-test.cpp | 4 +- tests/core/steam/mobject/mobject-ref-test.cpp | 6 +- .../core/steam/mobject/placement-ref-test.cpp | 12 ++-- .../mobject/session/placement-index-test.cpp | 5 +- .../mobject/session/placement-scope-test.cpp | 13 ++-- .../session/query-focus-stack-test.cpp | 12 ++-- .../steam/mobject/session/scope-path-test.cpp | 16 ++--- .../library/diff/diff-ignore-changes-test.cpp | 4 +- tests/library/diff/gen-node-test.cpp | 4 +- tests/library/diff/generic-record-test.cpp | 6 +- tests/library/diff/mutation-message-test.cpp | 2 +- .../diff/tree-mutator-binding-test.cpp | 2 +- tests/library/exception-error-test.cpp | 4 +- tests/library/iter-adapter-test.cpp | 2 +- tests/library/iter-chain-search-test.cpp | 2 +- tests/library/iter-cursor-test.cpp | 2 +- tests/library/iter-explorer-test.cpp | 2 +- tests/library/iter-queue-test.cpp | 2 +- tests/library/iter-source-test.cpp | 2 +- tests/library/iter-stack-test.cpp | 2 +- tests/library/itertools-test.cpp | 2 +- tests/library/linked-elements-test.cpp | 4 +- tests/library/meta/access-casted-test.cpp | 7 +- tests/library/meta/tuple-record-init-test.cpp | 3 +- .../meta/virtual-copy-support-test.cpp | 8 +-- tests/library/multifact-singleton-test.cpp | 2 +- tests/library/opaque-holder-test.cpp | 6 +- tests/library/path-array-test.cpp | 4 +- tests/library/scoped-collection-test.cpp | 2 +- tests/library/test/test-helper-test.cpp | 4 +- tests/stage/abstract-tangible-test.cpp | 10 +-- tests/stage/bus-term-test.cpp | 12 ++-- .../stage/interact/ui-coord-resolver-test.cpp | 10 +-- tests/stage/interact/ui-coord-test.cpp | 8 +-- tests/vault/gear/scheduler-stress-test.cpp | 5 ++ 120 files changed, 499 insertions(+), 498 deletions(-) diff --git a/src/common/advice/index.hpp b/src/common/advice/index.hpp index 4b7f4bb71..fed70b202 100644 --- a/src/common/advice/index.hpp +++ b/src/common/advice/index.hpp @@ -508,8 +508,8 @@ namespace advice { : error::Fatal { SelfCheckFailure (Literal failure) - : error::Fatal (string("Failed test: ")+failure - ,LERR_(INDEX_CORRUPTED)) + : error::Fatal {string("Failed test: ")+failure + ,LUMIERA_ERROR_INDEX_CORRUPTED} { } }; } diff --git a/src/common/config-rules.hpp b/src/common/config-rules.hpp index f41b6dffd..8cd94aeb3 100644 --- a/src/common/config-rules.hpp +++ b/src/common/config-rules.hpp @@ -72,9 +72,13 @@ namespace lumiera { + namespace error { + LUMIERA_ERROR_DECLARE (CAPABILITY_QUERY); ///< unresolvable capability query. + } using std::string; using lib::P; + /////////////////////////////////////////////////////////////////////TICKET #705 this is draft/preview code; a real resolution system needs to be integrated @@ -207,11 +211,6 @@ namespace lumiera { // TODO: find out what operations we need to support here for the »real solution« (using Prolog) }; - - - - - LUMIERA_ERROR_DECLARE (CAPABILITY_QUERY); ///< unresolvable capability query. } // namespace query diff --git a/src/common/query/config-rules.cpp b/src/common/query/config-rules.cpp index ac2e6e6aa..07ad99bc7 100644 --- a/src/common/query/config-rules.cpp +++ b/src/common/query/config-rules.cpp @@ -36,9 +36,11 @@ using lumiera::QueryKey; namespace lumiera { + namespace error { + LUMIERA_ERROR_DEFINE (CAPABILITY_QUERY, "unresolvable capability query"); + } namespace query { - LUMIERA_ERROR_DEFINE (CAPABILITY_QUERY, "unresolvable capability query"); } // namespace query diff --git a/src/common/query/defs-manager-impl.hpp b/src/common/query/defs-manager-impl.hpp index a4e76d7f4..eb0aab89d 100644 --- a/src/common/query/defs-manager-impl.hpp +++ b/src/common/query/defs-manager-impl.hpp @@ -53,7 +53,6 @@ using util::_Fmt; using steam::ConfigResolver; using lumiera::query::QueryHandler; ///////TODO preliminary interface defined in config-rules.hpp -using lumiera::query::LERR_(CAPABILITY_QUERY); namespace lumiera{ @@ -149,9 +148,9 @@ namespace query { res = create (capabilities); // not yet known as default, create new if (!res) - throw lumiera::error::Config (_Fmt("The following Query could not be resolved: %s.") - % capabilities.rebuild().asKey() - , LUMIERA_ERROR_CAPABILITY_QUERY ); + throw error::Config (_Fmt("The following Query could not be resolved: %s.") + % capabilities.rebuild().asKey() + , LERR_(CAPABILITY_QUERY) ); else return res; } diff --git a/src/include/ui-protocol.hpp b/src/include/ui-protocol.hpp index e66700063..9166dc5ac 100644 --- a/src/include/ui-protocol.hpp +++ b/src/include/ui-protocol.hpp @@ -55,8 +55,8 @@ #include "lib/symbol.hpp" -namespace lib { -namespace diff{ +namespace lumiera { +namespace error { LUMIERA_ERROR_DECLARE(DIFF_STRUCTURE); ///< Invalid diff structure: implicit rules and assumptions violated. }} namespace Glib { @@ -67,7 +67,7 @@ namespace stage { //using lib::Literal; using lib::Symbol; //using cuString = const Glib::ustring; - using lib::diff::LERR_(DIFF_STRUCTURE); + using LERR_(DIFF_STRUCTURE); extern const Symbol META_kind; diff --git a/src/lib/depend.hpp b/src/lib/depend.hpp index 2a3e1c910..34b3e93e2 100644 --- a/src/lib/depend.hpp +++ b/src/lib/depend.hpp @@ -182,7 +182,7 @@ namespace lib { creator_ = []() -> OBJ* { throw error::Fatal("Service not available at this point of the Application Lifecycle" - ,error::LERR_(LIFECYCLE)); + ,LERR_(LIFECYCLE)); }; } diff --git a/src/lib/diff/diff-language.hpp b/src/lib/diff/diff-language.hpp index 8929ad85c..2fb81b4a0 100644 --- a/src/lib/diff/diff-language.hpp +++ b/src/lib/diff/diff-language.hpp @@ -94,15 +94,17 @@ #include +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE(DIFF_STRUCTURE); ///< Invalid diff structure: implicit rules and assumptions violated. + LUMIERA_ERROR_DECLARE(DIFF_CONFLICT); ///< Collision in diff application: contents of target not as expected. +}} namespace lib { namespace diff{ namespace error = lumiera::error; - LUMIERA_ERROR_DECLARE(DIFF_STRUCTURE); ///< Invalid diff structure: implicit rules and assumptions violated. - LUMIERA_ERROR_DECLARE(DIFF_CONFLICT); ///< Collision in diff application: contents of target not as expected. - template using HandlerFun = void (I::*) (E const&); // NOTE: element value taken by const& diff --git a/src/lib/diff/diff.cpp b/src/lib/diff/diff.cpp index 54d5224df..1dbe01f50 100644 --- a/src/lib/diff/diff.cpp +++ b/src/lib/diff/diff.cpp @@ -35,13 +35,14 @@ #include "lib/diff/diff-language.hpp" - +namespace lumiera { +namespace error { + LUMIERA_ERROR_DEFINE(DIFF_STRUCTURE, "Invalid diff structure: implicit rules and assumptions violated."); + LUMIERA_ERROR_DEFINE(DIFF_CONFLICT, "Collision in diff application: contents of target not as expected."); +}} + namespace lib { namespace diff{ - LUMIERA_ERROR_DEFINE(DIFF_STRUCTURE, "Invalid diff structure: implicit rules and assumptions violated."); - LUMIERA_ERROR_DEFINE(DIFF_CONFLICT, "Collision in diff application: contents of target not as expected."); - - }} // namespace lib::diff diff --git a/src/lib/diff/tree-diff.cpp b/src/lib/diff/tree-diff.cpp index 04510240a..cf3de9ffd 100644 --- a/src/lib/diff/tree-diff.cpp +++ b/src/lib/diff/tree-diff.cpp @@ -88,45 +88,45 @@ namespace diff{ void TreeDiffMutatorBinding::__failMismatch (Literal oper, GenNode const& spec) { - throw error::State(_Fmt("Unable to %s element %s. Current shape of target " + throw error::State{_Fmt("Unable to %s element %s. Current shape of target " "data does not match expectations") % oper % spec - , LUMIERA_ERROR_DIFF_CONFLICT); + , LERR_(DIFF_CONFLICT)}; } void TreeDiffMutatorBinding::__expect_further_elements (GenNode const& elm) { if (not treeMutator_->hasSrc()) - throw error::State(_Fmt("Premature end of target sequence, still expecting element %s; " + throw error::State{_Fmt("Premature end of target sequence, still expecting element %s; " "unable to apply diff further.") % elm - , LUMIERA_ERROR_DIFF_CONFLICT); + , LERR_(DIFF_CONFLICT)}; } void TreeDiffMutatorBinding::__fail_not_found (GenNode const& elm) { - throw error::State(_Fmt("Premature end of sequence; unable to locate " - "element %s in the remainder of the target.") % elm - , LUMIERA_ERROR_DIFF_CONFLICT); + throw error::State{_Fmt("Premature end of sequence; unable to locate " + "element %s in the remainder of the target.") % elm + , LERR_(DIFF_CONFLICT)}; } void TreeDiffMutatorBinding::__expect_end_of_scope (GenNode::ID const& idi) { if (not treeMutator_->completeScope()) - throw error::State(_Fmt("Diff application floundered in nested scope %s; " + throw error::State{_Fmt("Diff application floundered in nested scope %s; " "unexpected extra elements found when diff " "should have settled everything.") % idi.getSym() - , LUMIERA_ERROR_DIFF_STRUCTURE); + , LERR_(DIFF_STRUCTURE)}; } void TreeDiffMutatorBinding::__expect_valid_parent_scope (GenNode::ID const& idi) { if (0 == scopeManger_->depth()) - throw error::Fatal(_Fmt("Diff application floundered after leaving scope %s; " + throw error::Fatal{_Fmt("Diff application floundered after leaving scope %s; " "unbalanced nested scopes, diff attempts to pop root.") % idi.getSym() - , LUMIERA_ERROR_DIFF_STRUCTURE); + , LERR_(DIFF_STRUCTURE)}; } diff --git a/src/lib/error-exception.cpp b/src/lib/error-exception.cpp index e356d8ff4..440e342f5 100644 --- a/src/lib/error-exception.cpp +++ b/src/lib/error-exception.cpp @@ -77,6 +77,7 @@ namespace lumiera { LUMIERA_ERROR_DEFINE (FLAG , "non-cleared lumiera errorstate"); LUMIERA_ERROR_DEFINE (INVALID , "invalid input or parameters"); LUMIERA_ERROR_DEFINE (EXTERNAL , "failure in external service"); + LUMIERA_ERROR_DEFINE (EXCEPTION, "generic Lumiera exception"); LUMIERA_ERROR_DEFINE (ASSERTION, "assertion failure"); /* some further generic error situations */ @@ -92,8 +93,6 @@ namespace lumiera { } // namespace error - LUMIERA_ERROR_DEFINE (EXCEPTION, "generic Lumiera exception"); - diff --git a/src/lib/error.hpp b/src/lib/error.hpp index 0091e7ff7..a7ca360a0 100644 --- a/src/lib/error.hpp +++ b/src/lib/error.hpp @@ -49,16 +49,18 @@ #include +#define LERR_(_NAME_) lumiera::error::LUMIERA_ERROR_##_NAME_ + namespace lumiera { using std::string; using CStr = const char*; + namespace error { + /** error-ID for unspecified exceptions */ + LUMIERA_ERROR_DECLARE(EXCEPTION); + } -#define LERR_(_NAME_) LUMIERA_ERROR_##_NAME_ - - /** error-ID for unspecified exceptions */ - LUMIERA_ERROR_DECLARE(EXCEPTION); /** * Interface and Base definition for all Lumiera Exceptions. diff --git a/src/lib/linked-elements.hpp b/src/lib/linked-elements.hpp index f0c1d1f93..8420b4b56 100644 --- a/src/lib/linked-elements.hpp +++ b/src/lib/linked-elements.hpp @@ -71,7 +71,7 @@ namespace lib { namespace error = lumiera::error; - using error::LERR_(INDEX_BOUNDS); + using LERR_(INDEX_BOUNDS); using util::unConst; diff --git a/src/lib/opaque-holder.hpp b/src/lib/opaque-holder.hpp index a04eea942..bd2b4c0d1 100644 --- a/src/lib/opaque-holder.hpp +++ b/src/lib/opaque-holder.hpp @@ -94,8 +94,8 @@ namespace lib { namespace error = lumiera::error; - using error::LERR_(BOTTOM_VALUE); - using error::LERR_(WRONG_TYPE); + using LERR_(BOTTOM_VALUE); + using LERR_(WRONG_TYPE); using util::isSameObject; using util::unConst; diff --git a/src/lib/optional-ref.hpp b/src/lib/optional-ref.hpp index 23e6827c1..14b581380 100644 --- a/src/lib/optional-ref.hpp +++ b/src/lib/optional-ref.hpp @@ -36,7 +36,7 @@ namespace lib { - using lumiera::error::LERR_(BOTTOM_VALUE); + using LERR_(BOTTOM_VALUE); diff --git a/src/lib/scoped-collection.hpp b/src/lib/scoped-collection.hpp index 007e3007f..aab2af229 100644 --- a/src/lib/scoped-collection.hpp +++ b/src/lib/scoped-collection.hpp @@ -82,8 +82,8 @@ namespace lib { namespace error = lumiera::error; - using error::LERR_(CAPACITY); - using error::LERR_(INDEX_BOUNDS); + using LERR_(INDEX_BOUNDS); + using LERR_(CAPACITY); diff --git a/src/lib/searchpath.cpp b/src/lib/searchpath.cpp index 5f21460c6..99cfe1fa3 100644 --- a/src/lib/searchpath.cpp +++ b/src/lib/searchpath.cpp @@ -40,9 +40,6 @@ namespace lib { - LUMIERA_ERROR_DEFINE (FILE_NOT_DIRECTORY, "path element points at a file instead of a directory"); - - using std::regex; using std::regex_replace; diff --git a/src/lib/searchpath.hpp b/src/lib/searchpath.hpp index c0633bd61..f079ce065 100644 --- a/src/lib/searchpath.hpp +++ b/src/lib/searchpath.hpp @@ -50,8 +50,7 @@ namespace lib { namespace error = lumiera::error; namespace fsys = boost::filesystem; - LUMIERA_ERROR_DECLARE (FILE_NOT_DIRECTORY); ///< path element points at a file instead of a directory - using error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); /** retrieve the location of the executable */ diff --git a/src/lib/time/formats.hpp b/src/lib/time/formats.hpp index 82d08b02b..17e83dadd 100644 --- a/src/lib/time/formats.hpp +++ b/src/lib/time/formats.hpp @@ -44,6 +44,11 @@ #include #include +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (INVALID_TIMECODE); ///< timecode format error, illegal value encountered. +}} + namespace lib { namespace time { @@ -64,13 +69,11 @@ namespace time { namespace format { - LUMIERA_ERROR_DECLARE (INVALID_TIMECODE); ///< timecode format error, illegal value encountered. - using std::string; using lib::meta::NoInstance; // the following types are for metaprogramming only... - /** + /** * Frame count as timecode format. * An integral number used to count frames * can be used as a simple from of time code. @@ -192,7 +195,7 @@ namespace time { */ class Supported { - enum { MAXID = 8 }; + enum { MAXID = 8 }; std::bitset flags_; diff --git a/src/lib/time/timecode.cpp b/src/lib/time/timecode.cpp index 4279e79aa..6e749ad29 100644 --- a/src/lib/time/timecode.cpp +++ b/src/lib/time/timecode.cpp @@ -49,15 +49,17 @@ using std::smatch; using std::regex_search; using boost::lexical_cast; -namespace error = lumiera::error; +namespace lumiera { +namespace error { + LUMIERA_ERROR_DEFINE (INVALID_TIMECODE, "timecode format error, illegal value encountered"); +}} namespace lib { namespace time { + namespace error = lumiera::error; - - namespace format { /* ================= Timecode implementation details ======== */ + namespace format { /* ================= Timecode implementation details ======== */ - LUMIERA_ERROR_DEFINE (INVALID_TIMECODE, "timecode format error, illegal value encountered"); /** try to parse a frame number specification @@ -120,7 +122,7 @@ namespace time { Seconds::parse (string const& seconds, QuantR grid) { static regex fracSecs_parser ("(?:^|[^\\./\\d\\-])(\\-?\\d+)(?:([\\-\\+]\\d+)?/(\\d+))?sec"); - //__no leading[./-\d] number [+-] number '/' number 'sec' + //__no leading[./-\d] number [+-] number '/' number 'sec' #define SUB_EXPR(N) lexical_cast (match[N]) smatch match; @@ -152,7 +154,7 @@ namespace time { /** build up a frame count - * by quantising the given time value + * by quantising the given time value */ void Frames::rebuild (FrameNr& frameNr, QuantR quantiser, TimeValue const& rawTime) @@ -161,7 +163,7 @@ namespace time { } /** calculate the time point denoted by this frame count */ - TimeValue + TimeValue Frames::evaluate (FrameNr const& frameNr, QuantR quantiser) { return quantiser.timeOf (frameNr); @@ -182,7 +184,7 @@ namespace time { /** calculate the time point denoted by this SMPTE timecode, * by summing up the timecode's components */ - TimeValue + TimeValue Smpte::evaluate (SmpteTC const& tc, QuantR quantiser) { uint frameRate = tc.getFps(); @@ -204,8 +206,8 @@ namespace time { * it need to be the actual framerate used by the quantiser. * Especially in case of NTSC drop-frame, the timecode * uses 30fps here, while the quantisation uses 29.97 - * @todo this design just doesn't feel quite right... - */ + * @todo this design just doesn't feel quite right... + */ uint Smpte::getFramerate (QuantR quantiser_, TimeValue const& rawTime) { @@ -224,7 +226,7 @@ namespace time { * 0:0:0:0 to 23:59:59:##. When this strategy function is invoked, * the frames, seconds, minutes and hours fields have already been processed * and stored into the component digxels, under the assumption the overall - * value stays in range. + * value stays in range. * @note currently the range is extended "naturally" (i.e. mathematically). * The representation is flipped around the zero point and the value * of the hours is just allowed to increase beyond 23 @@ -395,10 +397,10 @@ namespace time { void SmpteTC::invertOrientation() { - int fr (getFps()); + int fr (getFps()); int f (fr - frames); // revert orientation int s (60 - secs); // of the components - int m (60 - mins); // + int m (60 - mins); // int h = -hours; // assumed to be negative sgn *= -1; // flip sign field @@ -408,7 +410,7 @@ namespace time { hours.setValueRaw(h); mins = m; // invoking setters - secs = s; // ensures normalisation + secs = s; // ensures normalisation frames = f; } @@ -459,14 +461,14 @@ namespace time { /** */ int - HmsTC::getMins() const + HmsTC::getMins() const { return lumiera_time_minutes (tpoint_); } /** */ int - HmsTC::getHours() const + HmsTC::getHours() const { return lumiera_time_hours (tpoint_); } diff --git a/src/lib/time/timevalue.hpp b/src/lib/time/timevalue.hpp index a6d977165..98e9fcd14 100644 --- a/src/lib/time/timevalue.hpp +++ b/src/lib/time/timevalue.hpp @@ -709,7 +709,7 @@ namespace time { { if (n == NUM{0}) throw error::Logic ("Degenerated frame grid not allowed" - , error::LERR_(BOTTOM_VALUE)); + , LERR_(BOTTOM_VALUE)); return n; } diff --git a/src/lib/variant.hpp b/src/lib/variant.hpp index 70f3fcba9..db24b9cd3 100644 --- a/src/lib/variant.hpp +++ b/src/lib/variant.hpp @@ -356,7 +356,7 @@ namespace lib { if (!buff) throw error::Logic(indicateTypeMismatch(b) - ,error::LERR_(WRONG_TYPE)); + ,LERR_(WRONG_TYPE)); else return *buff; } diff --git a/src/lib/wrapper.hpp b/src/lib/wrapper.hpp index f036c31c9..0453d262d 100644 --- a/src/lib/wrapper.hpp +++ b/src/lib/wrapper.hpp @@ -58,7 +58,7 @@ namespace wrapper { using util::unConst; using util::isSameObject; using lib::meta::_Fun; - using lumiera::error::LERR_(BOTTOM_VALUE); + using LERR_(BOTTOM_VALUE); using std::function; diff --git a/src/stage/ctrl/panel-locator.hpp b/src/stage/ctrl/panel-locator.hpp index bfc3350ea..34e633821 100644 --- a/src/stage/ctrl/panel-locator.hpp +++ b/src/stage/ctrl/panel-locator.hpp @@ -126,7 +126,7 @@ namespace ctrl { if (-1 == typeID) throw error::Invalid (_Fmt{"Requested type «%s» not usable as docking panel."} % util::typeStr() - ,error::LERR_(WRONG_TYPE)); + ,LERR_(WRONG_TYPE)); return dynamic_cast (preliminary_impl_PanelLookup (typeID)); } diff --git a/src/stage/ctrl/playback-controller.cpp b/src/stage/ctrl/playback-controller.cpp index d2e568399..c15d05b7e 100644 --- a/src/stage/ctrl/playback-controller.cpp +++ b/src/stage/ctrl/playback-controller.cpp @@ -62,7 +62,7 @@ namespace ctrl { { if (not instance) throw error::Logic ("GTK UI is not in running state" - , error::LERR_(LIFECYCLE)); + , LERR_(LIFECYCLE)); return *instance; } diff --git a/src/stage/display-service.cpp b/src/stage/display-service.cpp index 74a5f9ef4..8939c87dd 100644 --- a/src/stage/display-service.cpp +++ b/src/stage/display-service.cpp @@ -120,7 +120,7 @@ namespace stage { - using lumiera::error::LERR_(LIFECYCLE); + using LERR_(LIFECYCLE); lib::Depend _instance; ///< a backdoor for the C Language impl to access the actual SessionCommand implementation... diff --git a/src/stage/gtk-base.hpp b/src/stage/gtk-base.hpp index 020dc115b..8fa06f674 100644 --- a/src/stage/gtk-base.hpp +++ b/src/stage/gtk-base.hpp @@ -80,6 +80,12 @@ #endif +namespace lumiera { +namespace error { + /* some commonly used error marks for the UI... */ + LUMIERA_ERROR_DECLARE (UIWIRING); // "GUI state contradicts assumptions in signal wiring" +}} + /* ======= Namespace Definitions ======= */ @@ -90,9 +96,6 @@ */ namespace stage { - /* some commonly used error marks for the UI... */ - LUMIERA_ERROR_DECLARE (UIWIRING); // "GUI state contradicts assumptions in signal wiring" - /* widely used type abbreviations */ using uString = Glib::ustring; using cuString = const uString; diff --git a/src/stage/gtk-lumiera.cpp b/src/stage/gtk-lumiera.cpp index 7f80c0f50..bae314b1c 100644 --- a/src/stage/gtk-lumiera.cpp +++ b/src/stage/gtk-lumiera.cpp @@ -73,10 +73,14 @@ using stage::LUMIERA_INTERFACE_INAME(lumieraorg_Gui, 1); using std::string; -namespace stage { - +namespace lumiera { +namespace error { /* == definition common error marks for the UI, declared in gtk-base.hpp == */ LUMIERA_ERROR_DEFINE (UIWIRING, "GUI state contradicts assumptions in signal wiring"); +}} + + +namespace stage { namespace { // implementation details diff --git a/src/stage/interact/interaction-director.cpp b/src/stage/interact/interaction-director.cpp index b38b54229..3791f1136 100644 --- a/src/stage/interact/interaction-director.cpp +++ b/src/stage/interact/interaction-director.cpp @@ -69,7 +69,7 @@ using lib::hash::LuidH; using lib::diff::Rec; using lib::diff::TreeMutator; using lib::diff::collection; -using lib::diff::LUMIERA_ERROR_DIFF_STRUCTURE; +using LERR_(DIFF_STRUCTURE); using std::make_unique; using util::toString; diff --git a/src/stage/notification-service.cpp b/src/stage/notification-service.cpp index eb5850de8..4f82ed94f 100644 --- a/src/stage/notification-service.cpp +++ b/src/stage/notification-service.cpp @@ -240,7 +240,7 @@ namespace stage { - using lumiera::error::LERR_(LIFECYCLE); + using LERR_(LIFECYCLE); lib::Depend _instance; ///< a backdoor for the C Language impl to access the actual SessionCommand implementation... diff --git a/src/steam/asset/media.cpp b/src/steam/asset/media.cpp index 0e4bef65d..1a7ca221c 100644 --- a/src/steam/asset/media.cpp +++ b/src/steam/asset/media.cpp @@ -242,7 +242,7 @@ namespace asset { "(multichannel) media. Found parent Media %s.") % mediaref % *mediaref.checkCompound() - ,LERR_(PART_OF_COMPOUND)); + ,LUMIERA_ERROR_PART_OF_COMPOUND); Clip* pC = new Clip (mediaref); return AssetManager::instance().wrap (*pC); } diff --git a/src/steam/asset/struct-factory-impl.hpp b/src/steam/asset/struct-factory-impl.hpp index d3cc8b714..3badb8108 100644 --- a/src/steam/asset/struct-factory-impl.hpp +++ b/src/steam/asset/struct-factory-impl.hpp @@ -70,7 +70,7 @@ namespace asset { using util::isnil; using util::contains; using lumiera::Query; - using lumiera::query::LERR_(CAPABILITY_QUERY); + using LERR_(CAPABILITY_QUERY); using lib::query::extractID; using steam::mobject::Session; diff --git a/src/steam/assetmanager.cpp b/src/steam/assetmanager.cpp index 1f3838c5c..d02bba9ba 100644 --- a/src/steam/assetmanager.cpp +++ b/src/steam/assetmanager.cpp @@ -45,14 +45,21 @@ using lib::Depend; using lib::Sync; +namespace lumiera { +namespace error { + // ------pre-defined-common-error-cases--------------- + LUMIERA_ERROR_DEFINE (UNKNOWN_ASSET_ID, "non-registered Asset ID"); + LUMIERA_ERROR_DEFINE (WRONG_ASSET_KIND, "wrong Asset kind, unable to cast"); +}} + namespace steam { namespace asset { namespace error = lumiera::error; - /** + /** * AssetManager error responses, caused by querying * invalid Asset IDs from the internal DB. - */ + */ struct IDErr : error::Invalid { @@ -60,10 +67,6 @@ namespace asset { }; - // ------pre-defined-common-error-cases--------------- - // - LUMIERA_ERROR_DEFINE (UNKNOWN_ASSET_ID, "non-registered Asset ID"); - LUMIERA_ERROR_DEFINE (WRONG_ASSET_KIND, "wrong Asset kind, unable to cast"); struct UnknownID : IDErr { @@ -100,7 +103,7 @@ namespace asset { /** provide the unique ID for given Asset::Ident tuple */ - ID + ID AssetManager::getID (const Asset::Ident& idi) { return asset::hash_value (idi); @@ -114,7 +117,7 @@ namespace asset { * @throw error::Invalid in case of invalid identity spec */ template - ID + ID AssetManager::reg (KIND* obj, const Asset::Ident& idi) { AssetManager& _aMang (AssetManager::instance()); @@ -133,16 +136,16 @@ namespace asset { /** @note the KIND of asset needs to be assignable by the actual stored asset * @throw error::Invalid if nothing is found or if the actual KIND - * of the stored object differs and can't be casted. + * of the stored object differs and can't be casted. */ template lib::P - AssetManager::getAsset (const ID& id) + AssetManager::getAsset (const ID& id) { if (lib::P obj = registry.get (id)) return obj; else - if (known (id)) // provide Ident tuple of existing Asset + if (known (id)) // provide Ident tuple of existing Asset throw WrongKind (registry.get(ID(id))->ident); else throw UnknownID (id); @@ -151,14 +154,14 @@ namespace asset { /** Convenience shortcut for fetching the registered smart-ptr * which is in charge of the given asset instance. By querying * directly asset.id (of type ID), the call to registry.get() - * can bypass the dynamic cast, because the type of the asset - * is explicitly given by type KIND. + * can bypass the dynamic cast, because the type of the asset + * is explicitly given by type KIND. */ template lib::P AssetManager::wrap (const KIND& asset) { - ENSURE (instance().known(asset.id), + ENSURE (instance().known(asset.id), "unregistered asset instance encountered."); return static_pointer_cast (instance().registry.get (asset.id)); @@ -173,7 +176,7 @@ namespace asset { AssetManager::known (IDA id) { return bool(registry.get (ID(id))); - } // query most general Asset ID-kind and use implicit + } // query most general Asset ID-kind and use implicit // conversion from smart-ptr to bool (test if empty) @@ -190,13 +193,13 @@ namespace asset { namespace { // details implementing AssetManager::remove - void + void recursive_call (AssetManager* instance, PAsset& pA) - { + { instance->remove (pA->getID()); } - function + function detach_child_recursively () ///< @return a functor recursively invoking remove(child) { return bind( &recursive_call, &AssetManager::instance(), _1 ); @@ -205,10 +208,10 @@ namespace asset { /** * remove the given asset from the internal DB - * together with all its dependents + * _together with all its dependents_ */ void - AssetManager::remove (IDA id) + AssetManager::remove (IDA id) { PAsset asset = getAsset (id); for_each (asset->dependants, detach_child_recursively()); @@ -225,7 +228,7 @@ namespace asset { } - list + list AssetManager::listContent() const { list res; diff --git a/src/steam/assetmanager.hpp b/src/steam/assetmanager.hpp index 9bf8ac8b6..563afbc1a 100644 --- a/src/steam/assetmanager.hpp +++ b/src/steam/assetmanager.hpp @@ -22,7 +22,7 @@ /** @file assetmanager.hpp ** Steam-Layer Interface: Asset Lookup and Organisation. - ** Declares the AssetManager interface used to access individual + ** Declares the AssetManager interface used to access individual ** Asset instances. ** ** These classes are placed into namespace asset and proc_interface. @@ -58,6 +58,13 @@ using std::string; using std::list; +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (UNKNOWN_ASSET_ID); ///< use of a non-registered Asset ID. + LUMIERA_ERROR_DECLARE (WRONG_ASSET_KIND); ///< Asset ID of wrong Asset kind, unable to cast. +}} + + namespace steam { namespace asset { @@ -67,7 +74,7 @@ namespace asset { /** * Facade for the Asset subsystem */ - class AssetManager + class AssetManager : util::NonCopyable { asset::DB & registry; @@ -130,9 +137,6 @@ namespace asset { }; - - LUMIERA_ERROR_DECLARE (UNKNOWN_ASSET_ID); ///< use of a non-registered Asset ID. - LUMIERA_ERROR_DECLARE (WRONG_ASSET_KIND); ///< Asset ID of wrong Asset kind, unable to cast. }} // namespace steam::asset diff --git a/src/steam/control/argument-erasure.hpp b/src/steam/control/argument-erasure.hpp index 1caab6465..9ec62e5e9 100644 --- a/src/steam/control/argument-erasure.hpp +++ b/src/steam/control/argument-erasure.hpp @@ -34,16 +34,18 @@ #include "lib/error.hpp" - -namespace steam { -namespace control { - - +namespace lumiera { +namespace error { LUMIERA_ERROR_DECLARE (INVALID_ARGUMENTS); ///< Arguments provided for binding doesn't match stored command function parameters + LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS); ///< Command functor not yet usable, because arguments aren't bound +}} + +namespace steam { +namespace control { + namespace err = lumiera::error; - - /** + /** * Adapter interface for invoking an argument binding for a command * \em without the need to disclose the concrete types and number of arguments. * At the receiver side, the concrete type can be restored by a dynamic cast. @@ -51,7 +53,7 @@ namespace control { * usually this receiver will be an implementation object, whose exact * type has been erased after definition, while the implementation * internally of course knows the type and thus can perform an - * dynamic cast on the passed on argument tuple + * dynamic cast on the passed on argument tuple */ struct Arguments; @@ -65,13 +67,12 @@ namespace control { template TUP const& - get () + get() { TypedArguments* dest = dynamic_cast*> (this); - if (!dest) - throw lumiera::error::Invalid("Wrong type or number of arguments" - , LUMIERA_ERROR_INVALID_ARGUMENTS); - + if (not dest) + throw err::Invalid{"Wrong type or number of arguments" + , LERR_(INVALID_ARGUMENTS)}; return dest->args_; } }; @@ -90,6 +91,5 @@ namespace control { - }} // namespace steam::control #endif diff --git a/src/steam/control/command-closure.hpp b/src/steam/control/command-closure.hpp index 7af349650..ae27db964 100644 --- a/src/steam/control/command-closure.hpp +++ b/src/steam/control/command-closure.hpp @@ -76,8 +76,6 @@ #include - - namespace steam { namespace control { @@ -88,9 +86,6 @@ namespace control { - LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS); ///< Command functor not yet usable, because arguments aren't bound - - /** * A neutral container internally holding * the functor used to implement the Command diff --git a/src/steam/control/command-mutation.hpp b/src/steam/control/command-mutation.hpp index 1184e9503..d61abfe7b 100644 --- a/src/steam/control/command-mutation.hpp +++ b/src/steam/control/command-mutation.hpp @@ -53,7 +53,7 @@ namespace steam { namespace control { - + namespace err = lumiera::error; /** @@ -79,8 +79,8 @@ namespace control { operator() (CmdClosure& clo) { if (!clo) - throw lumiera::error::State ("Lifecycle error: function arguments not ready", - LERR_(UNBOUND_ARGUMENTS)); + throw err::State{"Lifecycle error: function arguments not ready" + , LERR_(UNBOUND_ARGUMENTS)}; clo.invoke (func_); } }; @@ -122,8 +122,8 @@ namespace control { captureState (CmdClosure& clo) { if (!clo) - throw lumiera::error::State ("need additional function arguments to be able to capture UNDO state", - LERR_(UNBOUND_ARGUMENTS)); + throw err::State{"need additional function arguments to be able to capture UNDO state" + , LERR_(UNBOUND_ARGUMENTS)}; captureMemento_(clo); return *this; diff --git a/src/steam/control/command-setup.cpp b/src/steam/control/command-setup.cpp index a999a84aa..a5d12476f 100644 --- a/src/steam/control/command-setup.cpp +++ b/src/steam/control/command-setup.cpp @@ -122,7 +122,7 @@ namespace control { { if (not definitionBlock) throw error::Invalid ("unbound function/closure provided for CommandSetup" - , error::LERR_(BOTTOM_VALUE)); + , LERR_(BOTTOM_VALUE)); pendingCmdDefinitions().emplace_front (cmdID_, move(definitionBlock)); return *this; @@ -219,7 +219,7 @@ namespace control { if (not entry->second) throw error::Logic (_Fmt{"Command instance '%s' is not (yet/anymore) active"} % instanceID - , error::LERR_(LIFECYCLE)); + , LERR_(LIFECYCLE)); return entry->second; } @@ -245,7 +245,7 @@ namespace control { if (not entry->second.isValid()) throw error::Logic (_Fmt{"Command instance '%s' is not (yet/anymore) active"} % instanceID - , error::LERR_(LIFECYCLE)); + , LERR_(LIFECYCLE)); if (not must_be_bound or entry->second.canExec()) instance = move(entry->second); } diff --git a/src/steam/control/command-signature.hpp b/src/steam/control/command-signature.hpp index 20f1c5401..f3050ce24 100644 --- a/src/steam/control/command-signature.hpp +++ b/src/steam/control/command-signature.hpp @@ -55,6 +55,11 @@ +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS); ///< Command functor not yet usable, because arguments aren't bound + LUMIERA_ERROR_DECLARE (MISSING_MEMENTO); ///< Undo functor not yet usable, because no undo state has been captured +}} namespace steam { namespace control { diff --git a/src/steam/control/command-simple-closure.hpp b/src/steam/control/command-simple-closure.hpp index 86591a755..d9d3cb8f5 100644 --- a/src/steam/control/command-simple-closure.hpp +++ b/src/steam/control/command-simple-closure.hpp @@ -56,6 +56,7 @@ namespace steam { namespace control { + namespace err = lumiera::error; using lib::InPlaceBuffer; using std::string; @@ -136,9 +137,9 @@ namespace control { invoke (CmdFunctor const& func) override { if (!isValid()) - throw lumiera::error::State ("Lifecycle error: can't bind functor, " - "command arguments not yet provided", - LERR_(UNBOUND_ARGUMENTS)); + throw err::State{"Lifecycle error: can't bind functor, " + "command arguments not yet provided" + , LERR_(UNBOUND_ARGUMENTS)}; arguments_->invoke(func); } diff --git a/src/steam/control/command-storage-holder.hpp b/src/steam/control/command-storage-holder.hpp index 3913b385f..e6c7fa6d2 100644 --- a/src/steam/control/command-storage-holder.hpp +++ b/src/steam/control/command-storage-holder.hpp @@ -56,6 +56,7 @@ namespace steam { namespace control { + namespace err = lumiera::error; using lib::InPlaceBuffer; using std::string; @@ -143,9 +144,9 @@ namespace control { invoke (CmdFunctor const& func) override { if (!isValid()) - throw lumiera::error::State ("Lifecycle error: can't bind functor, " - "command arguments not yet provided", - LERR_(UNBOUND_ARGUMENTS)); + throw err::State{"Lifecycle error: can't bind functor, " + "command arguments not yet provided" + , LERR_(UNBOUND_ARGUMENTS)}; arguments_->invoke(func); } diff --git a/src/steam/control/command.cpp b/src/steam/control/command.cpp index c74c3b549..97d759a5e 100644 --- a/src/steam/control/command.cpp +++ b/src/steam/control/command.cpp @@ -60,15 +60,18 @@ using std::move; using util::_Fmt; -namespace steam { -namespace control { - namespace error = lumiera::error; - +namespace lumiera { +namespace error { LUMIERA_ERROR_DEFINE (INVALID_COMMAND, "Unknown or insufficiently defined command"); LUMIERA_ERROR_DEFINE (DUPLICATE_COMMAND, "Attempt to redefine an already existing command definition"); LUMIERA_ERROR_DEFINE (INVALID_ARGUMENTS, "Arguments provided for binding doesn't match stored command function parameters"); LUMIERA_ERROR_DEFINE (UNBOUND_ARGUMENTS, "Command mutation functor not yet usable, because arguments aren't bound"); LUMIERA_ERROR_DEFINE (MISSING_MEMENTO, "Undo functor not yet usable, because no undo state has been captured"); +}} + +namespace steam { +namespace control { + namespace error = lumiera::error; namespace { // some common error checks... @@ -116,7 +119,7 @@ namespace control { /** Access existing command for use. - * @throw error::Invalid if command not + * @throw error::Invalid if command not * registered or incompletely defined. * @remark this function deliberately returns by-value. * Returning a reference into the global CommandRegistry @@ -197,7 +200,7 @@ namespace control { Command cloneDefinition; cloneDefinition.activate (move (registry.createCloneImpl(this->impl())), newCmdID); ENSURE (cloneDefinition); - return cloneDefinition; + return cloneDefinition; } @@ -212,7 +215,7 @@ namespace control { Command clone; clone.activate (move (cloneImpl)); ENSURE (clone); - return clone; + return clone; } @@ -226,7 +229,7 @@ namespace control { { CommandImplCloneBuilder cloneBuilder(allocator_); refObject.prepareClone(cloneBuilder); - return allocator_.create (refObject, cloneBuilder.clonedUndoMutation() + return allocator_.create (refObject, cloneBuilder.clonedUndoMutation() , cloneBuilder.clonedClosuere()); } @@ -246,7 +249,7 @@ namespace control { bool Command::remove (Symbol cmdID) { - return CommandRegistry::instance().remove (cmdID); + return CommandRegistry::instance().remove (cmdID); } diff --git a/src/steam/control/command.hpp b/src/steam/control/command.hpp index 33f3dd5f2..5ad33ed92 100644 --- a/src/steam/control/command.hpp +++ b/src/steam/control/command.hpp @@ -81,7 +81,14 @@ #include - +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS); ///< Command functor not yet usable, because arguments aren't bound + LUMIERA_ERROR_DECLARE (INVALID_COMMAND); ///< Unknown or insufficiently defined command + LUMIERA_ERROR_DECLARE (DUPLICATE_COMMAND); ///< Attempt to redefine an already existing command definition + LUMIERA_ERROR_DECLARE (INVALID_ARGUMENTS); ///< Arguments provided for binding doesn't match stored command function parameters + LUMIERA_ERROR_DECLARE (MISSING_MEMENTO); ///< Undo functor not yet usable, because no undo state has been captured +}} namespace steam { namespace control { @@ -92,15 +99,7 @@ namespace control { using lib::meta::Tuple; using lib::meta::Types; - - LUMIERA_ERROR_DECLARE (UNBOUND_ARGUMENTS); ///< Command functor not yet usable, because arguments aren't bound - LUMIERA_ERROR_DECLARE (INVALID_COMMAND); ///< Unknown or insufficiently defined command - LUMIERA_ERROR_DECLARE (DUPLICATE_COMMAND); ///< Attempt to redefine an already existing command definition - LUMIERA_ERROR_DECLARE (INVALID_ARGUMENTS); ///< Arguments provided for binding doesn't match stored command function parameters - - - - typedef void* FuncPtr; + using FuncPtr = void*; class CommandDef; class CommandImpl; diff --git a/src/steam/control/memento-tie.hpp b/src/steam/control/memento-tie.hpp index 303d0ae43..76aa6c3f6 100644 --- a/src/steam/control/memento-tie.hpp +++ b/src/steam/control/memento-tie.hpp @@ -54,14 +54,13 @@ namespace steam { namespace control { + namespace err = lumiera::error; using boost::equality_comparable; using lib::meta::func::bindLast; using lib::meta::func::chained; using lib::meta::equals_safeInvoke; using lib::wrapper::ReplaceableItem; - - LUMIERA_ERROR_DECLARE (MISSING_MEMENTO); ///< Undo functor not yet usable, because no undo state has been captured /** @@ -174,8 +173,8 @@ namespace control { getState () { if (!isCaptured_) - throw lumiera::error::State ("need to invoke memento state capturing beforehand", - LERR_(MISSING_MEMENTO)); + throw err::State{"need to invoke memento state capturing beforehand" + , LERR_(MISSING_MEMENTO)}; return memento_; } diff --git a/src/steam/control/session-command-service.cpp b/src/steam/control/session-command-service.cpp index d046efe33..14ccfaf59 100644 --- a/src/steam/control/session-command-service.cpp +++ b/src/steam/control/session-command-service.cpp @@ -189,7 +189,7 @@ namespace control { - using lumiera::error::LERR_(LIFECYCLE); + using LERR_(LIFECYCLE); lib::Depend _instance; ///< a backdoor for the C Language impl to access the actual SessionCommand implementation... diff --git a/src/steam/engine/buffer-metadata.hpp b/src/steam/engine/buffer-metadata.hpp index 3af572e40..67819a6cd 100644 --- a/src/steam/engine/buffer-metadata.hpp +++ b/src/steam/engine/buffer-metadata.hpp @@ -126,9 +126,6 @@ namespace engine { namespace metadata { - using error::LERR_(LIFECYCLE); - using error::LERR_(BOTTOM_VALUE); - namespace { // details of hash calculation template HashVal @@ -649,19 +646,19 @@ namespace engine { ,bool onlyNew =false) { if (!concreteBuffer) - throw error::Invalid ("Attempt to lock a slot for a NULL buffer" - , error::LUMIERA_ERROR_BOTTOM_VALUE); + throw error::Invalid{"Attempt to lock a slot for a NULL buffer" + , LERR_(BOTTOM_VALUE)}; Entry newEntry(parentKey, concreteBuffer, implID); Entry* existing = table_.fetch (newEntry); if (existing && onlyNew) - throw error::Logic ("Attempt to lock a slot for a new buffer, " - "while actually the old buffer is still locked" - , error::LUMIERA_ERROR_LIFECYCLE ); + throw error::Logic{"Attempt to lock a slot for a new buffer, " + "while actually the old buffer is still locked" + , LERR_(LIFECYCLE)}; if (existing && existing->isLocked()) - throw error::Logic ("Attempt to re-lock a buffer still in use" - , error::LUMIERA_ERROR_LIFECYCLE ); + throw error::Logic{"Attempt to re-lock a buffer still in use" + , LERR_(LIFECYCLE)}; if (!existing) return store_and_lock (newEntry); // actual creation @@ -719,8 +716,8 @@ namespace engine { markLocked (Key const& parentKey, void* buffer, LocalKey const& implID =UNSPECIFIC) { if (!buffer) - throw error::Fatal ("Attempt to lock for a NULL buffer. Allocation floundered?" - , error::LUMIERA_ERROR_BOTTOM_VALUE); + throw error::Fatal{"Attempt to lock for a NULL buffer. Allocation floundered?" + , LERR_(BOTTOM_VALUE)}; return this->lock(parentKey, buffer, implID, true); // force creation of a new entry } @@ -742,8 +739,8 @@ namespace engine { release (Entry const& entry) { if (FREE != entry.state()) - throw error::Logic ("Attempt to release a buffer still in use" - , error::LUMIERA_ERROR_LIFECYCLE); + throw error::Logic{"Attempt to release a buffer still in use" + , LERR_(LIFECYCLE)}; table_.remove (HashVal(entry)); } diff --git a/src/steam/engine/buffer-provider.cpp b/src/steam/engine/buffer-provider.cpp index 8a5ca35d8..7eef08c0e 100644 --- a/src/steam/engine/buffer-provider.cpp +++ b/src/steam/engine/buffer-provider.cpp @@ -210,8 +210,8 @@ namespace engine { REQUIRE (refEntry.isTypeKey()); REQUIRE (!metaEntry.isTypeKey()); if (!metaEntry.isLocked()) - throw error::Logic ("unable to attach an object because buffer isn't locked for use" - , LERR_(LIFECYCLE)); + throw error::Logic{"unable to attach an object because buffer isn't locked for use" + , LERR_(LIFECYCLE)}; metaEntry.useTypeHandlerFrom (refEntry); // EX_STRONG } diff --git a/src/steam/engine/buffhandle.hpp b/src/steam/engine/buffhandle.hpp index 1df157fc5..f105f44c8 100644 --- a/src/steam/engine/buffhandle.hpp +++ b/src/steam/engine/buffhandle.hpp @@ -64,9 +64,7 @@ namespace steam { namespace engine { - namespace error = lumiera::error; - using error::LERR_(LIFECYCLE); using lib::HashVal; diff --git a/src/steam/engine/channel-descriptor.hpp b/src/steam/engine/channel-descriptor.hpp index 38618d474..2ea0ee47a 100644 --- a/src/steam/engine/channel-descriptor.hpp +++ b/src/steam/engine/channel-descriptor.hpp @@ -43,9 +43,7 @@ namespace steam { namespace engine { - namespace error = lumiera::error; - using error::LERR_(LIFECYCLE); using lib::HashVal; diff --git a/src/steam/mobject/mobject-ref.cpp b/src/steam/mobject/mobject-ref.cpp index 11651c3f7..975b68f2d 100644 --- a/src/steam/mobject/mobject-ref.cpp +++ b/src/steam/mobject/mobject-ref.cpp @@ -21,12 +21,12 @@ * *****************************************************/ -/** @file mobject-ref.cpp - ** Implementation part of the MObjectRef facility. +/** @file mobject-ref.cpp + ** Implementation part of the MObjectRef facility. ** Any C++ client about to use a MObjectRef needs to be linked (dynamically) against ** this implementation. Especially, this implementation allows to (re)-connect transparently ** to the PlacementIndex within the session, so to establish a direct link to the Object - ** denoted by the reference. + ** denoted by the reference. ** ** @see PlacementRef ** @see PlacementIndex @@ -38,6 +38,13 @@ #include "steam/mobject/mobject.hpp" #include "steam/mobject/placement.hpp" +namespace lumiera { +namespace error { + LUMIERA_ERROR_DEFINE (INVALID_PLACEMENTREF, "unresolvable placement reference, or of incompatible type"); + LUMIERA_ERROR_DEFINE (BOTTOM_PLACEMENTREF, "NIL placement-ID marker encountered."); + LUMIERA_ERROR_DEFINE (BOTTOM_MOBJECTREF, "NIL MObjectRef encountered"); +}} + namespace steam { namespace mobject { @@ -45,12 +52,4 @@ namespace mobject { /** */ - LUMIERA_ERROR_DEFINE (INVALID_PLACEMENTREF, "unresolvable placement reference, or of incompatible type"); - LUMIERA_ERROR_DEFINE (BOTTOM_PLACEMENTREF, "NIL placement-ID marker encountered."); - LUMIERA_ERROR_DEFINE (BOTTOM_MOBJECTREF, "NIL MObjectRef encountered"); - - - - - }} // namespace steam::mobject diff --git a/src/steam/mobject/mobject-ref.hpp b/src/steam/mobject/mobject-ref.hpp index b10aaaefa..78e9f4de5 100644 --- a/src/steam/mobject/mobject-ref.hpp +++ b/src/steam/mobject/mobject-ref.hpp @@ -69,18 +69,19 @@ ///////////////////////////////////////////TODO: define an C-API representation here, make the header multilingual! +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (BOTTOM_MOBJECTREF); ///< NIL MObjectRef encountered +}} + namespace steam { namespace mobject { namespace error = lumiera::error; - - class MObject; - LUMIERA_ERROR_DECLARE (BOTTOM_MOBJECTREF); ///< NIL MObjectRef encountered - /** * An active (smart-ptr like) external reference * to a specifically placed MObject "instance" within the session. @@ -137,7 +138,7 @@ namespace mobject { /** allow to use MObjectRef instead of a Placement-ID (hash) * @todo not sure if that leads to unexpected conversions, - * because the underlying implementation can be + * because the underlying implementation can be * converted to size_t */ //////////////////////////TICKET #682 revisit that decision later operator _Id const&() const { @@ -146,7 +147,7 @@ namespace mobject { - /** resolves the referred placement to an + /** resolves the referred placement to an * ExplicitPlacement and returns the found start time */ lib::time::Time @@ -157,7 +158,7 @@ namespace mobject { /** attach a child element to the model - * @param newPlacement to be copied into the model, placed + * @param newPlacement to be copied into the model, placed * into the scope of the object denoted by this MORef * @return MORef designing the newly created and attached object instance */ @@ -181,7 +182,7 @@ namespace mobject { */ void purge () - { + { if (isValid()) session::SessionServiceMutate::detach_and_clear (pRef_); @@ -214,7 +215,7 @@ namespace mobject { * - any Placement-ID * - any Placement-Ref * - a plain LUID - * @throws error::Invalid when the (directly or indirectly + * @throws error::Invalid when the (directly or indirectly * referred placement isn't known to the session PlacementIndex, * or when the placement actually found has an incompatible dynamic type */ @@ -233,7 +234,7 @@ namespace mobject { /** build and activate an MObject reference based on * an existing reference of the same pointee type * @note STRONG exception safety guarantee - * @throws error::Invalid when the referred placement + * @throws error::Invalid when the referred placement * isn't known to the current session's PlacementIndex */ MORef& @@ -254,7 +255,7 @@ namespace mobject { * @note STRONG exception safety guarantee * @throws error::Invalid when the referred placement isn't registered * within the current session, or if the runtime type of the pointees - * aren't assignment compatible + * aren't assignment compatible */ template MORef& @@ -270,7 +271,7 @@ namespace mobject { bool isValid() const { - return _Handle::isValid() + return _Handle::isValid() && pRef_.isValid(); } diff --git a/src/steam/mobject/output-mapping.hpp b/src/steam/mobject/output-mapping.hpp index cfd39e993..81b6a2e96 100644 --- a/src/steam/mobject/output-mapping.hpp +++ b/src/steam/mobject/output-mapping.hpp @@ -217,8 +217,8 @@ namespace mobject { operator Target() { if (not isValid()) - throw error::Logic ("attempt to resolve an unconnected output mapping" - , error::LERR_(UNCONNECTED)); + throw error::Logic{"attempt to resolve an unconnected output mapping" + , LERR_(UNCONNECTED)}; return resolve(); } diff --git a/src/steam/mobject/placement-ref.hpp b/src/steam/mobject/placement-ref.hpp index e6628f200..1eeae135d 100644 --- a/src/steam/mobject/placement-ref.hpp +++ b/src/steam/mobject/placement-ref.hpp @@ -71,22 +71,22 @@ #include "steam/mobject/session/session-service-fetch.hpp" +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (INVALID_PLACEMENTREF); ///< unresolvable placement reference, or of incompatible type + LUMIERA_ERROR_DECLARE (BOTTOM_PLACEMENTREF); ///< NIL placement-ID marker encountered +}} + namespace steam { namespace error = lumiera::error; namespace mobject { - - class MObject; - LUMIERA_ERROR_DECLARE (INVALID_PLACEMENTREF); ///< unresolvable placement reference, or of incompatible type - LUMIERA_ERROR_DECLARE (BOTTOM_PLACEMENTREF); ///< NIL placement-ID marker encountered - - /** * Reference tag denoting a placement attached to the session. * Implemented as a smart-handle, transparently accessing the @@ -110,7 +110,7 @@ namespace steam { * Any source allowing to infer a \em compatible mobject::Placement * is accepted. Here, compatibility is decided based on the run time * type of the pointee, in comparison to the template parameter Y. - * In any case, for this ctor to succeed, the provided ref or ID + * In any case, for this ctor to succeed, the provided ref or ID * needs to be resolvable to a placement by the implicit PlacementIndex * facility used by all PlacementRef instances (typically the Session). * @note there is no default ctor, a reference source is mandatory. @@ -118,14 +118,14 @@ namespace steam { * - an existing Placement * - just an Placement::ID * - a plain LUID - * @throw error::Invalid on incompatible run time type of the resolved ID + * @throw error::Invalid on incompatible run time type of the resolved ID */ template explicit PlacementRef (Y const& refID) : id_(recast (refID)) - { - validate(id_); + { + validate(id_); } /** Default is an NIL Placement ref. It throws on any access. */ @@ -137,15 +137,15 @@ namespace steam { PlacementRef (PlacementRef const& r) ///< copy ctor : id_(r.id_) - { - validate(id_); + { + validate(id_); } template PlacementRef (PlacementRef const& r) ///< extended copy ctor, when type X is assignable to MX : id_(recast(r)) { - validate(id_); + validate(id_); } @@ -183,7 +183,7 @@ namespace steam { PlacementMX& operator*() const { return access(id_); } ///< dereferencing fetches referred Placement from Index - PlacementMX& operator->() const { return access(id_); } ///< provide access to pointee API by smart-ptr chaining + PlacementMX& operator->() const { return access(id_); } ///< provide access to pointee API by smart-ptr chaining operator string() const { return access(id_).operator string(); } size_t use_count() const { return access(id_).use_count(); } @@ -211,7 +211,7 @@ namespace steam { } bool isValid() const - { + { if (checkValidity()) try { @@ -270,15 +270,15 @@ namespace steam { access (_Id const& placementID) { if (!placementID) - throw error::Logic ("Attempt to access a NIL PlacementRef" - , LERR_(BOTTOM_PLACEMENTREF)); + throw error::Logic{"Attempt to access a NIL PlacementRef" + , LERR_(BOTTOM_PLACEMENTREF)}; Placement & genericPlacement (session::SessionServiceFetch::resolveID (placementID)); // may throw REQUIRE (genericPlacement.isValid()); if (!(genericPlacement.template isCompatible())) - throw error::Invalid("actual type of the resolved placement is incompatible" - , LERR_(INVALID_PLACEMENTREF)); + throw error::Invalid{"actual type of the resolved placement is incompatible" + , LERR_(INVALID_PLACEMENTREF)}; ////////////////////////TODO: 1. better message, including type? ////////////////////////TODO: 2. define a separate error-ID for the type mismatch! diff --git a/src/steam/mobject/placement.hpp b/src/steam/mobject/placement.hpp index a426ac147..fade8ed18 100644 --- a/src/steam/mobject/placement.hpp +++ b/src/steam/mobject/placement.hpp @@ -104,9 +104,9 @@ namespace mobject { * * Placements are defined to form a hierarchy, thereby mirroring * the relations between their referents to some degree. This allows - * for building APIs targeted at specific kinds of MObjects, and + * for building APIs targeted at specific kinds of MObjects, and * at the same time allows a specific placement to stand-in when - * just a unspecific Placement is required. + * just a unspecific Placement is required. * * @param MO the (compile time) type of the referent * @param B immediate base class of this placement @@ -115,7 +115,7 @@ namespace mobject { class Placement ; - /** + /** * this specialisation forms the root of all placements * and defines all of Placement's actual functionality. */ @@ -134,15 +134,15 @@ namespace mobject { public: - /** smart pointer: accessing the MObject, + /** smart pointer: accessing the MObject, * which is subject to placement. * @note we don't provide operator* */ - MObject * - operator-> () const - { - ENSURE (*this); - return _SmartPtr::operator-> (); + MObject * + operator->() const + { + ENSURE (*this); + return _SmartPtr::operator->(); } /** run time diagnostics: is the pointee @@ -186,7 +186,7 @@ namespace mobject { /** interface for defining the kind of placement * to employ, and for controlling any additional - * constraints and properties. + * constraints and properties. */ session::LocatingPin chain; @@ -194,7 +194,7 @@ namespace mobject { * by the various LocatingPin (\see #chain) and * provide the resulting (explicit) placement. */ - virtual ExplicitPlacement resolve () const; + virtual ExplicitPlacement resolve () const; //////////////////////////TODO (1) could resolve() return a reference? Otherwise placement-ref.hpp needs to include ExplicitPlacement //////////////////////////TODO (2) does this really need to be virtual. Guess not. It's not abstract and not really polymorphic. But virtual here causes template bloat. ////////////TICKET #439 @@ -207,7 +207,7 @@ namespace mobject { { } protected: - Placement (MObject & subject, Deleter killer) + Placement (MObject & subject, Deleter killer) : _SmartPtr (&subject, killer) { }; friend class session::MObjectFactory; @@ -258,7 +258,7 @@ namespace mobject { _Id getID () const ///< @note overrides HashIndexed::getID to pass specific type information, - { + { return _Parent::template recastID(); } @@ -266,9 +266,8 @@ namespace mobject { /** @todo cleanup uses of ref-to-placement. See Ticket #115 */ - typedef Placement PlacementMO; - //‘typedef class mobject::Placement mobject::PlacementMO’ - typedef Placement PMO; + typedef Placement PlacementMO; + typedef Placement PMO; diff --git a/src/steam/mobject/session/placement-index.cpp b/src/steam/mobject/session/placement-index.cpp index dd8b1a6dd..912214b83 100644 --- a/src/steam/mobject/session/placement-index.cpp +++ b/src/steam/mobject/session/placement-index.cpp @@ -21,7 +21,7 @@ * *****************************************************/ -/** @file placement-index.cpp +/** @file placement-index.cpp ** Implementation of core session storage structure. ** The PlacementIndex associates IDs to instances, within a nested scope structure. ** Moreover, it provides and manages the actual Placement instances (storage), @@ -33,7 +33,7 @@ ** associations, especially for enumerating the contents of a scope. The latter is done ** by wrapping up an STL iterator range into a "Lumiera Forward Iterator" (adapter). ** Generally speaking, PlacementIndex is an implementation level facility and provides - ** the basic/low-level functionality. For example, the PlacementIndexQueryResolver + ** the basic/low-level functionality. For example, the PlacementIndexQueryResolver ** provides depth-first exploration of all the contents of an scope, including ** nested scopes, building on top of the scope iterators from PlacementIndex. ** @@ -65,6 +65,12 @@ #include #include +namespace lumiera { +namespace error { + LUMIERA_ERROR_DEFINE (NOT_IN_SESSION, "referring to a Placement not known to the current session"); + LUMIERA_ERROR_DEFINE (PLACEMENT_TYPE, "requested Placement (pointee) type not compatible with data or context"); + LUMIERA_ERROR_DEFINE (NONEMPTY_SCOPE, "Placement scope (still) contains other elements"); +}} namespace steam { namespace mobject { @@ -89,14 +95,11 @@ namespace session { using util::for_each; using util::has_any; - LUMIERA_ERROR_DEFINE (NOT_IN_SESSION, "referring to a Placement not known to the current session"); - LUMIERA_ERROR_DEFINE (PLACEMENT_TYPE, "requested Placement (pointee) type not compatible with data or context"); - LUMIERA_ERROR_DEFINE (NONEMPTY_SCOPE, "Placement scope (still) contains other elements"); /* some type shorthands */ - typedef mobject::PlacementMO PlacementMO; + typedef mobject::PlacementMO PlacementMO; typedef PlacementIndex::PRef PRef; typedef PlacementIndex::ID ID; @@ -104,11 +107,11 @@ namespace session { /*****************************************************************//** * Storage and implementation backing the PlacementIndex * - #placementTab_ is an hashtable mapping IDs to Placement + Scope - * - #scopeTab_ is an reverse association serving to keep track of + * - #scopeTab_ is an reverse association serving to keep track of * any scope's contents * - root scope element is stored and maintained explicitly. */ - class PlacementIndex::Table + class PlacementIndex::Table { typedef shared_ptr PPlacement; @@ -133,21 +136,19 @@ namespace session { PPlacement root_; public: - Table () + Table() { } - ~Table () - { - try - { - root_.reset(); - clear(); - } - catch(lumiera::Error& err) - { - WARN (session, "Problem while purging PlacementIndex: %s", err.what()); - lumiera_error(); // discard any error state - } } + ~Table() + try { + root_.reset(); + clear(); + } + catch (lumiera::Error& err) + { + WARN (session, "Problem while purging PlacementIndex: %s", err.what()); + lumiera_error(); // discard any error state + } size_t @@ -155,13 +156,13 @@ namespace session { { return placementTab_.size(); } - + size_t scope_cnt() const ///<@note root doesn't produce an scope entry { return scopeTab_.size(); } - + size_t element_cnt() const { @@ -221,7 +222,7 @@ namespace session { /** insert a specially configured root entry into - * the yet empty table. Root is it's own scope + * the yet empty table. Root is it's own scope */ void setupRoot (PlacementMO const& rootDef) @@ -257,7 +258,7 @@ namespace session { * It can be rediscovered later with the help * of the pointee's vtable * @see Placement#isCompatible - */ + */ ID addEntry (PlacementMO const& newObj, ID scopeID) { @@ -284,10 +285,10 @@ namespace session { } if (util::contains(scopeTab_, id)) - throw error::State ("Unable to remove the specified Placement, " - "because it defines an non-empty scope. " - "You need to delete any contents first." - ,LUMIERA_ERROR_NONEMPTY_SCOPE); ////////////////TICKET #197 + throw error::State{"Unable to remove the specified Placement, " + "because it defines an non-empty scope. " + "You need to delete any contents first." + , LERR_(NONEMPTY_SCOPE)}; //////////////////////////////TICKET #197 ASSERT (contains (id)); PlacementEntry toRemove = remove_base_entry (id); @@ -407,13 +408,12 @@ namespace session { mutable ElementResolver elementResolver_; ElementResolver - scopeIndexElementsResolver() const ///< @return functor for iterator element access + scopeIndexElementsResolver() const ///< @return functor for iterator element access { if (!elementResolver_) elementResolver_ = bind (&Table::resolveScopeIndexElement, this, _1 ); return elementResolver_; } - }; //(End) placement index table implementation @@ -472,7 +472,7 @@ namespace session { /** retrieve the Scope information * registered alongside with the denoted Placement. * @throw error::Invalid when the given ID isn't registered - * @note root is it's own scope, per definition. + * @note root is it's own scope, per definition. */ PlacementMO& PlacementIndex::getScope (ID id) const @@ -502,7 +502,7 @@ namespace session { * The given Placement is copied into the storage managed within the session. * This copy within the storage is what will be "the placement of this object". * It can be discovered as index (Session) content, re-accessed by the ID returned - * from this call and modified in the course of editing the session. + * from this call and modified in the course of editing the session. * @param newObj reference placement pointing to the MObject to be added * @param targetScope ref to a placement already added to the index, serving as * container "into" which the new placement will be located @@ -580,11 +580,11 @@ namespace session { } - /** + /** * PlacementIndex self-verification code * Executes all built-in checks automatically * on object creation. - * @throw SelfCheckFailure + * @throw SelfCheckFailure */ class PlacementIndex::Validator { @@ -691,7 +691,7 @@ namespace session { - + /** validity self-check, used for sanity checks and the session self-check. * The following checks are performed (causing at least one full table scan) diff --git a/src/steam/mobject/session/placement-index.hpp b/src/steam/mobject/session/placement-index.hpp index c958b3a9c..2e9a8d67c 100644 --- a/src/steam/mobject/session/placement-index.hpp +++ b/src/steam/mobject/session/placement-index.hpp @@ -56,7 +56,7 @@ ** When adding a Placement to the index, it is mandatory to specify a Scope: this is ** another Placement already registered within the index; the new Placement can be thought ** of as being located "within" or "below" this scope-defining reference Placement. An - ** typical example would be the addition of a \c Placement, specifying + ** typical example would be the addition of a \c Placement, specifying ** a \c Placement as scope. This would bring the mentioned Clip onto the ** "Track", as implemented by a Fork-MObject. Thus, all "object instances" within the ** session are arranged in a tree-like fashion. On creation of the PlacementIndex, @@ -133,6 +133,13 @@ namespace std { } +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (NOT_IN_SESSION); ///< referring to a Placement not known to the current session + LUMIERA_ERROR_DECLARE (PLACEMENT_TYPE); ///< requested Placement (pointee) type not compatible with data or context + LUMIERA_ERROR_DECLARE (NONEMPTY_SCOPE); ///< Placement scope (still) contains other elements +}} + namespace steam { namespace mobject { @@ -140,11 +147,6 @@ namespace mobject { namespace session { - LUMIERA_ERROR_DECLARE (NOT_IN_SESSION); ///< referring to a Placement not known to the current session - LUMIERA_ERROR_DECLARE (PLACEMENT_TYPE); ///< requested Placement (pointee) type not compatible with data or context - LUMIERA_ERROR_DECLARE (NONEMPTY_SCOPE); ///< Placement scope (still) contains other elements - - using std::unique_ptr; @@ -210,17 +212,17 @@ namespace session { PlacementMO& getScope (PlacementMO const&) const; PlacementMO& getScope (ID) const; - + iterator getReferrers (ID) const; - - - /** retrieve the logical root scope */ + + + /** retrieve the logical root scope */ PlacementMO& getRoot() const; - + size_t size() const; bool contains (PlacementMO const&) const; bool contains (ID) const; - + bool isValid() const; @@ -294,7 +296,7 @@ namespace session { return static_cast&> (result); } - + template inline Placement& PlacementIndex::find (PlacementRef const& pRef) const @@ -307,7 +309,7 @@ namespace session { inline Placement& PlacementIndex::getScope (PlacementMO const& p) const { - return getScope(p.getID()); + return getScope(p.getID()); } diff --git a/src/steam/mobject/session/query-focus.cpp b/src/steam/mobject/session/query-focus.cpp index e6fdd0664..49ed28497 100644 --- a/src/steam/mobject/session/query-focus.cpp +++ b/src/steam/mobject/session/query-focus.cpp @@ -93,8 +93,8 @@ namespace session { ___check_validTaget (Scope const& target) { if (!target.isValid()) - throw Invalid ("Invalid target location for QueryFocus" - , LUMIERA_ERROR_INVALID_SCOPE); ////////////////TICKET #197 + throw Invalid{"Invalid target location for QueryFocus" + , LERR_(INVALID_SCOPE)}; /////////////////////////////////////////TICKET #197 } }//(End) shortcut diff --git a/src/steam/mobject/session/scope-path.cpp b/src/steam/mobject/session/scope-path.cpp index 43ab39593..8defb40fd 100644 --- a/src/steam/mobject/session/scope-path.cpp +++ b/src/steam/mobject/session/scope-path.cpp @@ -49,11 +49,6 @@ namespace session { using util::isnil; - - LUMIERA_ERROR_DEFINE (EMPTY_SCOPE_PATH, "Placement scope not locatable (empty model path)"); - - - namespace { // Helpers and shortcuts.... /** issue a query to discover the (raw) path to root, diff --git a/src/steam/mobject/session/scope-path.hpp b/src/steam/mobject/session/scope-path.hpp index c140ada87..3f4123fe4 100644 --- a/src/steam/mobject/session/scope-path.hpp +++ b/src/steam/mobject/session/scope-path.hpp @@ -122,9 +122,6 @@ namespace mobject { namespace session { - LUMIERA_ERROR_DECLARE (EMPTY_SCOPE_PATH); ///< Placement scope not locatable (empty model path) - - /** * Sequence of nested scopes within the high-level model. * Implemented as vector of Scope elements. Providing diff --git a/src/steam/mobject/session/scope.cpp b/src/steam/mobject/session/scope.cpp index f723161fd..7cee2b4ed 100644 --- a/src/steam/mobject/session/scope.cpp +++ b/src/steam/mobject/session/scope.cpp @@ -53,15 +53,19 @@ using std::vector; using lib::IterSource; using lib::iter_source::wrapIter; + +namespace lumiera { +namespace error { + LUMIERA_ERROR_DEFINE (INVALID_SCOPE, "Placement scope invalid and not locatable within model"); + LUMIERA_ERROR_DEFINE (NO_PARENT_SCOPE, "Parent scope of root not accessible"); + LUMIERA_ERROR_DEFINE (EMPTY_SCOPE_PATH, "Placement scope not locatable (empty model path)"); +}} + namespace steam { namespace mobject { namespace session { - LUMIERA_ERROR_DEFINE (INVALID_SCOPE, "Placement scope invalid and not locatable within model"); - LUMIERA_ERROR_DEFINE (NO_PARENT_SCOPE, "Parent scope of root not accessible"); - - /** conversion of a scope top (placement) into a Scope. * only allowed if the given Placement is actually attached diff --git a/src/steam/mobject/session/scope.hpp b/src/steam/mobject/session/scope.hpp index 00d3bd6fa..dea2c7192 100644 --- a/src/steam/mobject/session/scope.hpp +++ b/src/steam/mobject/session/scope.hpp @@ -37,13 +37,17 @@ #include +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (EMPTY_SCOPE_PATH); ///< Placement scope not locatable (empty model path) + LUMIERA_ERROR_DECLARE (NO_PARENT_SCOPE); ///< Parent scope of root not accessible + LUMIERA_ERROR_DECLARE (INVALID_SCOPE); ///< Placement scope invalid and not locatable within model +}} + namespace steam { namespace mobject { namespace session { - LUMIERA_ERROR_DECLARE (NO_PARENT_SCOPE); ///< Parent scope of root not accessible - LUMIERA_ERROR_DECLARE (INVALID_SCOPE); ///< Placement scope invalid and not locatable within model - /** diff --git a/src/steam/play/dummy-player-service.cpp b/src/steam/play/dummy-player-service.cpp index b2e60dda0..20529e341 100644 --- a/src/steam/play/dummy-player-service.cpp +++ b/src/steam/play/dummy-player-service.cpp @@ -176,7 +176,7 @@ namespace steam { - using lumiera::error::LERR_(LIFECYCLE); + using LERR_(LIFECYCLE); lib::Depend _instance; ///< a backdoor for the C Language impl to access the actual SessionCommand implementation... typedef ProcessImpl* ProcP; diff --git a/src/steam/play/output-manager.hpp b/src/steam/play/output-manager.hpp index 9c79ff213..999ddc753 100644 --- a/src/steam/play/output-manager.hpp +++ b/src/steam/play/output-manager.hpp @@ -41,6 +41,11 @@ #include +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (CANT_PLAY); ///< unable to build playback or render process for this configuration +}} + namespace steam { namespace play { @@ -49,13 +54,6 @@ namespace play { using std::shared_ptr; - LUMIERA_ERROR_DECLARE(CANT_PLAY); ///< unable to build playback or render process for this configuration - - - - - - /**************************************************//** diff --git a/src/steam/play/play-process.cpp b/src/steam/play/play-process.cpp index 25c380612..d95998753 100644 --- a/src/steam/play/play-process.cpp +++ b/src/steam/play/play-process.cpp @@ -57,8 +57,8 @@ namespace play { : outputFeeds_(feeds) { if (isnil (feeds)) - throw error::State ("creating a PlayProcess without any usable output connections" - , LUMIERA_ERROR_CANT_PLAY); + throw error::State{"creating a PlayProcess without any usable output connections" + , LERR_(CANT_PLAY)}; } diff --git a/src/steam/play/play-service.cpp b/src/steam/play/play-service.cpp index c924fc922..af99730aa 100644 --- a/src/steam/play/play-service.cpp +++ b/src/steam/play/play-service.cpp @@ -53,6 +53,10 @@ namespace lumiera { /** static storage for the facade access front-end */ lib::Depend Play::facade; + + namespace error { + LUMIERA_ERROR_DEFINE (CANT_PLAY, "unable to build playback or render process for this configuration"); + } }//(End) namespace lumiera @@ -197,9 +201,6 @@ namespace play { - LUMIERA_ERROR_DEFINE (CANT_PLAY, "unable to build playback or render process for this configuration"); - - }} // namespace steam::play diff --git a/src/steam/play/play-service.hpp b/src/steam/play/play-service.hpp index 6ff47f676..819354727 100644 --- a/src/steam/play/play-service.hpp +++ b/src/steam/play/play-service.hpp @@ -65,6 +65,11 @@ //#include +namespace lumiera { +namespace error { + LUMIERA_ERROR_DECLARE (CANT_PLAY); ///< unable to build playback or render process for this configuration +}} + namespace steam { namespace play { @@ -116,10 +121,5 @@ namespace play { }; - LUMIERA_ERROR_DECLARE (CANT_PLAY); ///< unable to build playback or render process for this configuration - - - - }} // namespace steam::play #endif diff --git a/src/steam/play/render-configurator.cpp b/src/steam/play/render-configurator.cpp index 9c1aa97ab..fee7606f3 100644 --- a/src/steam/play/render-configurator.cpp +++ b/src/steam/play/render-configurator.cpp @@ -77,8 +77,8 @@ namespace play { REQUIRE (outputResolver_); OutputSlot& slot = outputResolver_->getOutputFor (port); if (!slot.isFree()) - throw error::State("unable to acquire a suitable output slot" /////////////////////TICKET #197 #816 --- could use util::_Fmt here - , LERR_(CANT_PLAY)); + throw error::State{"unable to acquire a suitable output slot" /////////////////////TICKET #197 #816 --- could use util::_Fmt here + , LERR_(CANT_PLAY)}; return slot; } diff --git a/tests/basics/dependency-configuration-test.cpp b/tests/basics/dependency-configuration-test.cpp index 5fc6af694..15cea98fd 100644 --- a/tests/basics/dependency-configuration-test.cpp +++ b/tests/basics/dependency-configuration-test.cpp @@ -72,8 +72,8 @@ namespace test{ }; } - using error::LERR_(LIFECYCLE); - using error::LERR_(FATAL); + using LERR_(LIFECYCLE); + using LERR_(FATAL); diff --git a/tests/basics/diagnostic-context-test.cpp b/tests/basics/diagnostic-context-test.cpp index f698b8105..f7aea1400 100644 --- a/tests/basics/diagnostic-context-test.cpp +++ b/tests/basics/diagnostic-context-test.cpp @@ -58,7 +58,7 @@ namespace test{ } // (End) test setup.... using lib::ThreadJoinable; - using error::LERR_(LOGIC); + using LERR_(LOGIC); using std::rand; diff --git a/tests/basics/singleton-subclass-test.cpp b/tests/basics/singleton-subclass-test.cpp index 8726dfff3..0ce888aef 100644 --- a/tests/basics/singleton-subclass-test.cpp +++ b/tests/basics/singleton-subclass-test.cpp @@ -47,7 +47,8 @@ using std::string; namespace lib { namespace test{ - using lumiera::error::LERR_(LIFECYCLE); + using LERR_(LIFECYCLE); + /** * Target object to be instantiated as Singleton diff --git a/tests/basics/time/digxel-configurations-test.cpp b/tests/basics/time/digxel-configurations-test.cpp index ea929d082..206147996 100644 --- a/tests/basics/time/digxel-configurations-test.cpp +++ b/tests/basics/time/digxel-configurations-test.cpp @@ -34,7 +34,7 @@ #include -using lumiera::error::LERR_(ASSERTION); +using LERR_(ASSERTION); using util::isSameObject; using util::typeStr; using std::rand; diff --git a/tests/basics/time/time-control-test.cpp b/tests/basics/time/time-control-test.cpp index d6a9b5fb3..e1cef771b 100644 --- a/tests/basics/time/time-control-test.cpp +++ b/tests/basics/time/time-control-test.cpp @@ -57,7 +57,7 @@ namespace test{ using steam::asset::meta::TimeGrid; using lib::meta::Types; using lib::meta::InstantiateChainedCombinations; - using error::LERR_(UNCONNECTED); + using LERR_(UNCONNECTED); diff --git a/tests/basics/time/time-parsing-test.cpp b/tests/basics/time/time-parsing-test.cpp index b10d503d2..fc6f39f1d 100644 --- a/tests/basics/time/time-parsing-test.cpp +++ b/tests/basics/time/time-parsing-test.cpp @@ -41,7 +41,7 @@ namespace time{ namespace test{ using steam::asset::meta::TimeGrid; - using format::LERR_(INVALID_TIMECODE); + using LERR_(INVALID_TIMECODE); namespace { // Helper for writing test cases diff --git a/tests/basics/time/time-value-test.cpp b/tests/basics/time/time-value-test.cpp index a049614dc..26b299a30 100644 --- a/tests/basics/time/time-value-test.cpp +++ b/tests/basics/time/time-value-test.cpp @@ -38,7 +38,7 @@ using boost::lexical_cast; using util::isnil; using std::string; -using lumiera::error::LERR_(BOTTOM_VALUE); +using LERR_(BOTTOM_VALUE); namespace lib { namespace time{ diff --git a/tests/core/application/subsystem-runner-test.cpp b/tests/core/application/subsystem-runner-test.cpp index 464d856a7..5a888c69a 100644 --- a/tests/core/application/subsystem-runner-test.cpp +++ b/tests/core/application/subsystem-runner-test.cpp @@ -87,8 +87,8 @@ namespace test { /** marker for simulated failure exceptions */ LUMIERA_ERROR_DEFINE( TEST, "simulated failure."); - using error::LERR_(LOGIC); - using error::LERR_(STATE); + using LERR_(LOGIC); + using LERR_(STATE); @@ -147,7 +147,7 @@ namespace test { return true; else if ("throw"==startSpec) //---starting flounders - throw error::Fatal("simulated failure to start the subsystem", LERR_(TEST)); + throw error::Fatal("simulated failure to start the subsystem", LUMIERA_ERROR_TEST); return started_; } @@ -212,7 +212,7 @@ namespace test { if ("true" ==runSpec) termination(0); // signal regular termination if ("throw"==runSpec) { - Error problemIndicator("simulated Problem terminating subsystem",LERR_(TEST)); + Error problemIndicator("simulated Problem terminating subsystem",LUMIERA_ERROR_TEST); lumiera_error(); // reset error state.... // Note: in real life this actually // would be an catched exception! diff --git a/tests/core/steam/asset/create-asset-test.cpp b/tests/core/steam/asset/create-asset-test.cpp index 8150dfc1b..b41a7af37 100644 --- a/tests/core/steam/asset/create-asset-test.cpp +++ b/tests/core/steam/asset/create-asset-test.cpp @@ -51,6 +51,9 @@ namespace steam { namespace asset{ namespace test { + using LERR_(UNKNOWN_ASSET_ID); + using LERR_(WRONG_ASSET_KIND); + using MediaAccessMock = lib::DependInject ::Local; @@ -66,7 +69,7 @@ namespace test { virtual void run(Arg arg) { MediaAccessMock useMockMedia; - + createMedia(); factoryVariants(); createMetaAssets(); @@ -128,19 +131,12 @@ namespace test { CHECK (aMang.known (mm3->getID())); CHECK ( !aMang.known (mm3->getID(), Category(AUDIO))); // not found within AUDIO-Category - try - { // can't be found if specifying wrong Asset kind.... - aMang.getAsset (ID(mm1->getID())); - NOTREACHED(); - } - catch (lumiera::error::Invalid& xxx) {CHECK (xxx.getID()==LUMIERA_ERROR_WRONG_ASSET_KIND);} - try - { // try accessing nonexistent ID - aMang.getAsset (ID (1234567890)); - NOTREACHED(); - } - catch (lumiera::error::Invalid& xxx) {CHECK (xxx.getID()==LUMIERA_ERROR_UNKNOWN_ASSET_ID);} - lumiera_error (); // reset errorflag + + // can't be found if specifying wrong Asset kind.... + VERIFY_ERROR (WRONG_ASSET_KIND, aMang.getAsset (ID(mm1->getID())) ); + + // try accessing nonexistent ID + VERIFY_ERROR (UNKNOWN_ASSET_ID, aMang.getAsset (ID (1234567890)) ); // checking the Ident-Fields diff --git a/tests/core/steam/asset/entry-id-test.cpp b/tests/core/steam/asset/entry-id-test.cpp index 738faa43b..2423cd2bf 100644 --- a/tests/core/steam/asset/entry-id-test.cpp +++ b/tests/core/steam/asset/entry-id-test.cpp @@ -54,7 +54,7 @@ namespace lib { namespace idi { namespace test{ - using lumiera::error::LERR_(WRONG_TYPE); + using LERR_(WRONG_TYPE); namespace { // Test definitions... diff --git a/tests/core/steam/control/command-argument-test.cpp b/tests/core/steam/control/command-argument-test.cpp index 1b6a4155b..1247c8b0a 100644 --- a/tests/core/steam/control/command-argument-test.cpp +++ b/tests/core/steam/control/command-argument-test.cpp @@ -59,8 +59,7 @@ namespace test { using lib::test::showSizeof; using lib::test::randTime; using namespace lib::meta; - - + using LERR_(MISSING_MEMENTO); diff --git a/tests/core/steam/control/command-instance-manager-test.cpp b/tests/core/steam/control/command-instance-manager-test.cpp index 3595961f7..5d210899a 100644 --- a/tests/core/steam/control/command-instance-manager-test.cpp +++ b/tests/core/steam/control/command-instance-manager-test.cpp @@ -50,9 +50,10 @@ namespace test { using std::move; using std::rand; - using lumiera::error::LERR_(LIFECYCLE); - - + using LERR_(LIFECYCLE); + using LERR_(INVALID_COMMAND); + using LERR_(DUPLICATE_COMMAND); + using LERR_(UNBOUND_ARGUMENTS); namespace { // Test fixture.... diff --git a/tests/core/steam/control/command-mutation-test.cpp b/tests/core/steam/control/command-mutation-test.cpp index 9ef89c987..545c743a2 100644 --- a/tests/core/steam/control/command-mutation-test.cpp +++ b/tests/core/steam/control/command-mutation-test.cpp @@ -49,6 +49,8 @@ namespace test { using namespace lib::meta; using control::CmdClosure; + using LERR_(MISSING_MEMENTO); + using LERR_(UNBOUND_ARGUMENTS); namespace { /* ======= test functions to bind ========= */ diff --git a/tests/core/steam/control/command-queue-test.cpp b/tests/core/steam/control/command-queue-test.cpp index 5f7395423..377d54a6f 100644 --- a/tests/core/steam/control/command-queue-test.cpp +++ b/tests/core/steam/control/command-queue-test.cpp @@ -24,25 +24,19 @@ #include "lib/test/run.hpp" #include "steam/control/command-queue.hpp" #include "steam/control/command-def.hpp" -//#include "steam/control/command-registry.hpp" -//#include "lib/test/event-log.hpp" #include "lib/symbol.hpp" #include "lib/util.hpp" #include "steam/control/test-dummy-commands.hpp" -//#include - -namespace steam { -namespace control { -namespace test { +namespace steam { +namespace control{ +namespace test { - -// using std::function; -// using std::rand; using lib::Symbol; using util::isnil; + using LERR_(UNBOUND_ARGUMENTS); namespace { // test fixture... @@ -52,11 +46,6 @@ namespace test { }//(End) test fixture -// typedef shared_ptr PCommandImpl; -// typedef HandlingPattern const& HaPatt; - - - @@ -64,7 +53,6 @@ namespace test { * @test verify proper working of queue management used within SteamDispatcher. * - can enqueue and dequeue command messages * - handling of priority messages - * * @see CommandQueue * @see DispatcherLoop * @see SteamDispatcher @@ -95,7 +83,7 @@ namespace test { } //-------------(End)FIXTURE - + virtual void run (Arg) { diff --git a/tests/core/steam/control/command-use1-test.cpp b/tests/core/steam/control/command-use1-test.cpp index 17cd4253e..fd2f2d6f0 100644 --- a/tests/core/steam/control/command-use1-test.cpp +++ b/tests/core/steam/control/command-use1-test.cpp @@ -41,9 +41,10 @@ namespace test { using util::isSameObject; using util::contains; - - - + using LERR_(INVALID_COMMAND); + using LERR_(DUPLICATE_COMMAND); + using LERR_(UNBOUND_ARGUMENTS); + using LERR_(INVALID_ARGUMENTS); @@ -52,7 +53,6 @@ namespace test { * @test command usage aspects I: defining commands in various ways, * then re-accessing those definitions, create instances, * invoke them and undo the effect. Clean up finally. - * * @see Command * @see command-basic-test.cpp (simple usage example) */ @@ -65,7 +65,7 @@ namespace test { virtual void - run (Arg) + run (Arg) { command1::check_ = 0; uint cnt_defs = Command::definition_count(); diff --git a/tests/core/steam/control/command-use2-test.cpp b/tests/core/steam/control/command-use2-test.cpp index d20652f60..8f66e68d1 100644 --- a/tests/core/steam/control/command-use2-test.cpp +++ b/tests/core/steam/control/command-use2-test.cpp @@ -52,7 +52,6 @@ namespace steam { namespace control { namespace test { - using util::_Fmt; using std::string; using std::function; @@ -61,8 +60,7 @@ namespace test { using boost::lexical_cast; using util::contains; - - using lumiera::error::LERR_(EXTERNAL); + using LERR_(EXTERNAL); /** diagnostics: checks if the given value has been written diff --git a/tests/core/steam/control/memento-tie-test.cpp b/tests/core/steam/control/memento-tie-test.cpp index 0bc5d96cb..c7580b1d8 100644 --- a/tests/core/steam/control/memento-tie-test.cpp +++ b/tests/core/steam/control/memento-tie-test.cpp @@ -37,13 +37,10 @@ using std::bind; using std::rand; -namespace steam { +namespace steam { namespace control { namespace test { - - - namespace { int testVal=0; ///< used to verify the effect of testFunc @@ -67,6 +64,8 @@ namespace test { const size_t ALIGNMENT = sizeof(size_t); } + using LERR_(MISSING_MEMENTO); + /*************************************************************************************//** diff --git a/tests/core/steam/engine/buffer-metadata-key-test.cpp b/tests/core/steam/engine/buffer-metadata-key-test.cpp index 9126517f9..230ad3f3a 100644 --- a/tests/core/steam/engine/buffer-metadata-key-test.cpp +++ b/tests/core/steam/engine/buffer-metadata-key-test.cpp @@ -43,11 +43,6 @@ namespace engine{ namespace metadata{ namespace test { - - using lumiera::error::LERR_(INVALID); - using lumiera::error::LERR_(LIFECYCLE); - - namespace { // Test fixture const size_t TEST_MAX_SIZE = 1024 * 1024; diff --git a/tests/core/steam/engine/buffer-metadata-test.cpp b/tests/core/steam/engine/buffer-metadata-test.cpp index c79493341..ec69ae067 100644 --- a/tests/core/steam/engine/buffer-metadata-test.cpp +++ b/tests/core/steam/engine/buffer-metadata-test.cpp @@ -47,9 +47,9 @@ namespace steam { namespace engine{ namespace test { - using lumiera::error::LERR_(FATAL); - using lumiera::error::LERR_(INVALID); - using lumiera::error::LERR_(LIFECYCLE); + using LERR_(FATAL); + using LERR_(INVALID); + using LERR_(LIFECYCLE); namespace { // Test fixture diff --git a/tests/core/steam/engine/buffer-provider-protocol-test.cpp b/tests/core/steam/engine/buffer-provider-protocol-test.cpp index d8a6edb2d..4cda14c23 100644 --- a/tests/core/steam/engine/buffer-provider-protocol-test.cpp +++ b/tests/core/steam/engine/buffer-provider-protocol-test.cpp @@ -46,8 +46,8 @@ namespace test { using lib::test::Dummy; using steam::engine::BuffHandle; - using error::LERR_(LOGIC); - using error::LERR_(LIFECYCLE); + using LERR_(LIFECYCLE); + using LERR_(LOGIC); namespace { // Test fixture diff --git a/tests/core/steam/mobject/mobject-ref-test.cpp b/tests/core/steam/mobject/mobject-ref-test.cpp index f37b36a9c..1eb787a02 100644 --- a/tests/core/steam/mobject/mobject-ref-test.cpp +++ b/tests/core/steam/mobject/mobject-ref-test.cpp @@ -43,6 +43,7 @@ #include "lib/format-cout.hpp" #include "lib/util.hpp" +#include using lib::test::showSizeof; using lib::time::Duration; @@ -52,7 +53,7 @@ using util::isnil; using std::string; -namespace steam { +namespace steam { namespace mobject { namespace test { @@ -77,6 +78,9 @@ namespace test { } + using LERR_(INVALID_PLACEMENTREF); + using LERR_(BOTTOM_MOBJECTREF); + using session::Clip; using session::PMedia; diff --git a/tests/core/steam/mobject/placement-ref-test.cpp b/tests/core/steam/mobject/placement-ref-test.cpp index 3bb8445ef..ad9892e1a 100644 --- a/tests/core/steam/mobject/placement-ref-test.cpp +++ b/tests/core/steam/mobject/placement-ref-test.cpp @@ -38,18 +38,20 @@ #include "lib/util.hpp" -using util::isSameObject; - - namespace steam { namespace mobject { namespace session { namespace test { using namespace mobject::test; - typedef TestPlacement PSub; - typedef PlacementMO::ID P_ID; + using util::isSameObject; + using LERR_(NOT_IN_SESSION); + using LERR_(BOTTOM_PLACEMENTREF); + + using PSub = TestPlacement; + using P_ID = PlacementMO::ID; + /***********************************************************************//** diff --git a/tests/core/steam/mobject/session/placement-index-test.cpp b/tests/core/steam/mobject/session/placement-index-test.cpp index d441d63f4..466340a25 100644 --- a/tests/core/steam/mobject/session/placement-index-test.cpp +++ b/tests/core/steam/mobject/session/placement-index-test.cpp @@ -44,12 +44,15 @@ using util::isSameObject; using std::string; -namespace steam { +namespace steam { namespace mobject { namespace session { namespace test { using session::test::TestClip; + using LERR_(BOTTOM_PLACEMENTREF); + using LERR_(NONEMPTY_SCOPE); + using LERR_(INVALID_SCOPE); typedef PlacementIndex& Idx; diff --git a/tests/core/steam/mobject/session/placement-scope-test.cpp b/tests/core/steam/mobject/session/placement-scope-test.cpp index 399e9010b..776e7fa5f 100644 --- a/tests/core/steam/mobject/session/placement-scope-test.cpp +++ b/tests/core/steam/mobject/session/placement-scope-test.cpp @@ -35,10 +35,7 @@ #include "lib/util.hpp" -using util::isSameObject; - - -namespace steam { +namespace steam { namespace mobject { namespace session { namespace test { @@ -61,6 +58,8 @@ namespace test { } } + using LERR_(NO_PARENT_SCOPE); + using util::isSameObject; @@ -72,7 +71,7 @@ namespace test { * - discovers the scope of a placement * - finds the parent scope * - enumerates a scope path up to root - * + * * @see mobject::Placement * @see mobject::session::ScopePath * @see mobject::session::QueryFocus @@ -81,7 +80,7 @@ namespace test { { virtual void - run (Arg) + run (Arg) { // Prepare an (test)Session // with some dummy contents @@ -201,4 +200,4 @@ namespace test { LAUNCHER (PlacementScope_test, "function session"); -}}}} // namespace steam::mobject::session::test +}}}}// namespace steam::mobject::session::test diff --git a/tests/core/steam/mobject/session/query-focus-stack-test.cpp b/tests/core/steam/mobject/session/query-focus-stack-test.cpp index a2a300a44..7063b844b 100644 --- a/tests/core/steam/mobject/session/query-focus-stack-test.cpp +++ b/tests/core/steam/mobject/session/query-focus-stack-test.cpp @@ -33,16 +33,14 @@ #include "lib/util.hpp" - - -namespace steam { +namespace steam { namespace mobject { namespace session { namespace test { using util::isnil; using util::isSameObject; - using lumiera::error::LERR_(INVALID); + using LERR_(INVALID_SCOPE); /***********************************************************************//** @@ -54,7 +52,7 @@ namespace test { * some path frames to play with. * @note this test executes a lot of functionality in a manual by-hand way, * which in the actual application is accessed and utilised through - * QueryFocus objects as frontend. + * QueryFocus objects as frontend. * * @see mobject::session::QueryFocusStack * @see mobject::session::ScopePath @@ -63,7 +61,7 @@ namespace test { { virtual void - run (Arg) + run (Arg) { // Prepare an (test)Index and // set up dummy session contents @@ -251,4 +249,4 @@ namespace test { LAUNCHER (QueryFocusStack_test, "unit session"); -}}}} // namespace steam::mobject::session::test +}}}}// namespace steam::mobject::session::test diff --git a/tests/core/steam/mobject/session/scope-path-test.cpp b/tests/core/steam/mobject/session/scope-path-test.cpp index 31563bb76..fd127e527 100644 --- a/tests/core/steam/mobject/session/scope-path-test.cpp +++ b/tests/core/steam/mobject/session/scope-path-test.cpp @@ -37,7 +37,7 @@ #include -namespace steam { +namespace steam { namespace mobject { namespace session { namespace test { @@ -46,9 +46,10 @@ namespace test { using util::isnil; using util::isSameObject; - using lumiera::error::LERR_(LOGIC); - using lumiera::error::LERR_(INVALID); - + using LERR_(LOGIC); + using LERR_(INVALID_SCOPE); + using LERR_(NOT_IN_SESSION); + using LERR_(EMPTY_SCOPE_PATH); @@ -67,7 +68,7 @@ namespace test { { virtual void - run (Arg) + run (Arg) { // Prepare an (test)Index backing the PlacementRefs PPIdx index = build_testScopes(); @@ -294,7 +295,7 @@ namespace test { path1 = path2; // but path without refcount may be overwritten path1 = path3; CHECK (path1 == path3); - + intrusive_ptr_release (&path2); // refcount drops to zero... CHECK (0 == path1.ref_count()); CHECK (0 == path2.ref_count()); @@ -342,7 +343,7 @@ namespace test { TestPlacement<> newNode (*new DummyMO); PMO& parentRefPoint = parent.getTop(); - Scope newLocation = + Scope newLocation = index->find( // place newNode as sibling of "leaf" index->insert (newNode, parentRefPoint)); path.navigate (newLocation); __SHOWPATH(5) @@ -383,7 +384,6 @@ namespace test { CHECK (isSameObject (other.getTop(), separatePlacement)); ScopePath rootPrefix = commonPrefix (path,refPath); CHECK (rootPrefix.endsAt (root)); - } diff --git a/tests/library/diff/diff-ignore-changes-test.cpp b/tests/library/diff/diff-ignore-changes-test.cpp index cbc7ec694..542b7281d 100644 --- a/tests/library/diff/diff-ignore-changes-test.cpp +++ b/tests/library/diff/diff-ignore-changes-test.cpp @@ -56,7 +56,7 @@ namespace test{ ATTRIB2("β", int64_t(2)), // attribute α = 2L (int64_t) ATTRIB3("γ", 3.45), // attribute γ = 3.45 (double) TYPE_X("type", "ξ"), // a "magic" type attribute "Xi" - TYPE_Z("type", "ζ"), // + TYPE_Z("type", "ζ"), // CHILD_A("a"), // unnamed string child node CHILD_B('b'), // unnamed char child node CHILD_T(Time(12,34,56,78)), // unnamed time value child @@ -66,7 +66,7 @@ namespace test{ }//(End)Test fixture - + using LERR_(DIFF_CONFLICT); diff --git a/tests/library/diff/gen-node-test.cpp b/tests/library/diff/gen-node-test.cpp index 76fbb9e35..12d732b4a 100644 --- a/tests/library/diff/gen-node-test.cpp +++ b/tests/library/diff/gen-node-test.cpp @@ -52,8 +52,8 @@ namespace lib { namespace diff{ namespace test{ - using error::LERR_(WRONG_TYPE); - using error::LERR_(BOTTOM_VALUE); + using LERR_(WRONG_TYPE); + using LERR_(BOTTOM_VALUE); namespace {//Test fixture.... diff --git a/tests/library/diff/generic-record-test.cpp b/tests/library/diff/generic-record-test.cpp index 632c78cb6..5304b793b 100644 --- a/tests/library/diff/generic-record-test.cpp +++ b/tests/library/diff/generic-record-test.cpp @@ -47,9 +47,9 @@ namespace lib { namespace diff{ namespace test{ - using lumiera::error::LERR_(INVALID); - using lumiera::error::LERR_(INDEX_BOUNDS); - using lumiera::error::LERR_(BOTTOM_VALUE); + using LERR_(INVALID); + using LERR_(INDEX_BOUNDS); + using LERR_(BOTTOM_VALUE); namespace {//Test fixture.... diff --git a/tests/library/diff/mutation-message-test.cpp b/tests/library/diff/mutation-message-test.cpp index 3bad00977..f1a088334 100644 --- a/tests/library/diff/mutation-message-test.cpp +++ b/tests/library/diff/mutation-message-test.cpp @@ -37,7 +37,7 @@ #include #include -using lumiera::error::LERR_(ITER_EXHAUST); +using LERR_(ITER_EXHAUST); using lib::iter_stl::IterSnapshot; using lib::iter_stl::snapshot; using lib::time::Time; diff --git a/tests/library/diff/tree-mutator-binding-test.cpp b/tests/library/diff/tree-mutator-binding-test.cpp index aaa2344e4..afaf521cd 100644 --- a/tests/library/diff/tree-mutator-binding-test.cpp +++ b/tests/library/diff/tree-mutator-binding-test.cpp @@ -55,7 +55,7 @@ namespace lib { namespace diff{ namespace test{ - using lumiera::error::LERR_(LOGIC); + using LERR_(LOGIC); namespace {//Test fixture.... diff --git a/tests/library/exception-error-test.cpp b/tests/library/exception-error-test.cpp index 2bd59f033..ab3c891e7 100644 --- a/tests/library/exception-error-test.cpp +++ b/tests/library/exception-error-test.cpp @@ -53,7 +53,7 @@ namespace lumiera { LUMIERA_ERROR_DEFINE (DERIVED, "convoluted exception"); /** define a specific Error subclass derived from error::external */ - using DerivedError = error::LumieraError; + using DerivedError = error::LumieraError; /******************************************************//** @@ -139,7 +139,7 @@ namespace lumiera { */ void checkErrorFlagPropagation() { - lumiera_error_set(LERR_(LIFE_AND_UNIVERSE), "what is the answer?"); + lumiera_error_set(LUMIERA_ERROR_LIFE_AND_UNIVERSE, "what is the answer?"); CHECK (lumiera_error_peek()); catcher (&test::detectErrorflag); diff --git a/tests/library/iter-adapter-test.cpp b/tests/library/iter-adapter-test.cpp index c29bbb0a0..1da93eee0 100644 --- a/tests/library/iter-adapter-test.cpp +++ b/tests/library/iter-adapter-test.cpp @@ -44,7 +44,7 @@ namespace lib { namespace test{ using ::Test; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); using boost::lexical_cast; using util::for_each; using util::isnil; diff --git a/tests/library/iter-chain-search-test.cpp b/tests/library/iter-chain-search-test.cpp index 714af1695..a79faa1c9 100644 --- a/tests/library/iter-chain-search-test.cpp +++ b/tests/library/iter-chain-search-test.cpp @@ -50,7 +50,7 @@ namespace test{ using std::vector; using std::string; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); namespace { // test fixture diff --git a/tests/library/iter-cursor-test.cpp b/tests/library/iter-cursor-test.cpp index b70f514d9..f02db4856 100644 --- a/tests/library/iter-cursor-test.cpp +++ b/tests/library/iter-cursor-test.cpp @@ -44,7 +44,7 @@ namespace test{ using util::isnil; using std::vector; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); namespace { // test fixture diff --git a/tests/library/iter-explorer-test.cpp b/tests/library/iter-explorer-test.cpp index ff471b9f2..88079efe4 100644 --- a/tests/library/iter-explorer-test.cpp +++ b/tests/library/iter-explorer-test.cpp @@ -78,7 +78,7 @@ namespace test{ using util::isnil; using util::isSameObject; using lib::iter_stl::eachElm; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); using std::vector; using std::string; diff --git a/tests/library/iter-queue-test.cpp b/tests/library/iter-queue-test.cpp index 52476dda8..1b6167792 100644 --- a/tests/library/iter-queue-test.cpp +++ b/tests/library/iter-queue-test.cpp @@ -39,7 +39,7 @@ namespace test{ using ::Test; using util::isnil; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); diff --git a/tests/library/iter-source-test.cpp b/tests/library/iter-source-test.cpp index 06eb1c527..d031a8f2e 100644 --- a/tests/library/iter-source-test.cpp +++ b/tests/library/iter-source-test.cpp @@ -57,7 +57,7 @@ namespace test{ using std::list; using std::rand; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); using iter_source::eachEntry; using iter_source::transform; diff --git a/tests/library/iter-stack-test.cpp b/tests/library/iter-stack-test.cpp index 2457bcee2..8b7ebdd36 100644 --- a/tests/library/iter-stack-test.cpp +++ b/tests/library/iter-stack-test.cpp @@ -39,7 +39,7 @@ namespace test{ using ::Test; using util::isnil; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); diff --git a/tests/library/itertools-test.cpp b/tests/library/itertools-test.cpp index 7ff57e79a..bcef847b8 100644 --- a/tests/library/itertools-test.cpp +++ b/tests/library/itertools-test.cpp @@ -50,7 +50,7 @@ namespace test{ using std::vector; using std::rand; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); diff --git a/tests/library/linked-elements-test.cpp b/tests/library/linked-elements-test.cpp index caaf471b4..ef65d8520 100644 --- a/tests/library/linked-elements-test.cpp +++ b/tests/library/linked-elements-test.cpp @@ -46,7 +46,7 @@ namespace test{ using util::isnil; using util::isSameObject; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); namespace { // test data... @@ -80,7 +80,7 @@ namespace test{ , next{0} { if (i == exception_trigger) - throw error::Fatal("simulated error", LERR_(PROVOKED_FAILURE)); + throw error::Fatal("simulated error", LUMIERA_ERROR_PROVOKED_FAILURE); } }; diff --git a/tests/library/meta/access-casted-test.cpp b/tests/library/meta/access-casted-test.cpp index f641bda40..2bcace212 100644 --- a/tests/library/meta/access-casted-test.cpp +++ b/tests/library/meta/access-casted-test.cpp @@ -41,8 +41,8 @@ using std::ostream; using util::isSameObject; -using lumiera::error::LERR_(BOTTOM_VALUE); -using lumiera::error::LERR_(WRONG_TYPE); +using LERR_(BOTTOM_VALUE); +using LERR_(WRONG_TYPE); namespace util { @@ -50,9 +50,6 @@ namespace test { - - - namespace { // Test fixture... struct B {}; diff --git a/tests/library/meta/tuple-record-init-test.cpp b/tests/library/meta/tuple-record-init-test.cpp index 075f5b877..c8753d291 100644 --- a/tests/library/meta/tuple-record-init-test.cpp +++ b/tests/library/meta/tuple-record-init-test.cpp @@ -47,8 +47,6 @@ using lib::time::Duration; using lib::time::Time; using lib::hash::LuidH; -using lumiera::error::LERR_(WRONG_TYPE); - using std::string; using std::tuple; using std::get; @@ -57,6 +55,7 @@ namespace lib { namespace meta { namespace test { + using LERR_(WRONG_TYPE); diff --git a/tests/library/meta/virtual-copy-support-test.cpp b/tests/library/meta/virtual-copy-support-test.cpp index 2ab0a898c..20c18ee04 100644 --- a/tests/library/meta/virtual-copy-support-test.cpp +++ b/tests/library/meta/virtual-copy-support-test.cpp @@ -41,8 +41,8 @@ using util::_Fmt; using util::isnil; using std::string; -using lumiera::error::LERR_(LOGIC); -using lumiera::error::LERR_(WRONG_TYPE); +using LERR_(LOGIC); +using LERR_(WRONG_TYPE); namespace lib { @@ -220,9 +220,9 @@ namespace test { Opaque* impl = dynamic_cast (&bas); if (!impl) - throw error::Logic("virtual copy works only on instances " + throw error::Logic{"virtual copy works only on instances " "of the same concrete implementation class" - ,error::LERR_(WRONG_TYPE)); + , LERR_(WRONG_TYPE)}; else return *impl; } diff --git a/tests/library/multifact-singleton-test.cpp b/tests/library/multifact-singleton-test.cpp index 44a825a64..35a6c7d2e 100644 --- a/tests/library/multifact-singleton-test.cpp +++ b/tests/library/multifact-singleton-test.cpp @@ -46,7 +46,7 @@ namespace test{ using std::ostream; using std::string; - using lumiera::error::LERR_(INVALID); + using LERR_(INVALID); namespace { // hierarchy of test dummy objects diff --git a/tests/library/opaque-holder-test.cpp b/tests/library/opaque-holder-test.cpp index 2d6c414bf..4ca4412ee 100644 --- a/tests/library/opaque-holder-test.cpp +++ b/tests/library/opaque-holder-test.cpp @@ -43,9 +43,9 @@ namespace test{ using util::isnil; using util::for_each; using util::isSameObject; - using error::LERR_(BOTTOM_VALUE); - using error::LERR_(WRONG_TYPE); - using error::LERR_(ASSERTION); + using LERR_(BOTTOM_VALUE); + using LERR_(WRONG_TYPE); + using LERR_(ASSERTION); using std::vector; using std::cout; diff --git a/tests/library/path-array-test.cpp b/tests/library/path-array-test.cpp index 24b8dad8c..f42792c52 100644 --- a/tests/library/path-array-test.cpp +++ b/tests/library/path-array-test.cpp @@ -44,8 +44,8 @@ using util::join; namespace lib { namespace test { - using lumiera::error::LERR_(INDEX_BOUNDS); - using lumiera::error::LERR_(INVALID); + using LERR_(INDEX_BOUNDS); + using LERR_(INVALID); using ParrT = lib::PathArray<5>; diff --git a/tests/library/scoped-collection-test.cpp b/tests/library/scoped-collection-test.cpp index 48947ee7d..58f125786 100644 --- a/tests/library/scoped-collection-test.cpp +++ b/tests/library/scoped-collection-test.cpp @@ -91,7 +91,7 @@ namespace test{ using util::isnil; - using lumiera::error::LERR_(ITER_EXHAUST); + using LERR_(ITER_EXHAUST); typedef ScopedCollection CollD; diff --git a/tests/library/test/test-helper-test.cpp b/tests/library/test/test-helper-test.cpp index 85d485a70..3c04fe3af 100644 --- a/tests/library/test/test-helper-test.cpp +++ b/tests/library/test/test-helper-test.cpp @@ -38,8 +38,8 @@ using util::for_each; using lumiera::Error; -using lumiera::LUMIERA_ERROR_EXCEPTION; -using lumiera::error::LUMIERA_ERROR_ASSERTION; +using LERR_(EXCEPTION); +using LERR_(ASSERTION); using lib::time::TimeVar; using lib::time::Time; diff --git a/tests/stage/abstract-tangible-test.cpp b/tests/stage/abstract-tangible-test.cpp index 317d7409c..3d020e021 100644 --- a/tests/stage/abstract-tangible-test.cpp +++ b/tests/stage/abstract-tangible-test.cpp @@ -80,11 +80,11 @@ using steam::control::CommandDef; -namespace stage { -namespace model{ -namespace test { +namespace stage { +namespace model { +namespace test { - using lumiera::error::LERR_(WRONG_TYPE); + using LERR_(WRONG_TYPE); using ID = lib::idi::BareEntryID const&; namespace { // test fixture... @@ -760,4 +760,4 @@ namespace test { LAUNCHER (AbstractTangible_test, "unit stage"); -}}} // namespace stage::model::test +}}}// namespace stage::model::test diff --git a/tests/stage/bus-term-test.cpp b/tests/stage/bus-term-test.cpp index 1b0d17f47..21b75dd72 100644 --- a/tests/stage/bus-term-test.cpp +++ b/tests/stage/bus-term-test.cpp @@ -88,8 +88,8 @@ namespace test { using lib::test::EventLog; using lib::CallQueue; - using steam::control::LUMIERA_ERROR_UNBOUND_ARGUMENTS; - using lumiera::error::LUMIERA_ERROR_WRONG_TYPE; + using LERR_(UNBOUND_ARGUMENTS); + using LERR_(WRONG_TYPE); using ID = lib::idi::BareEntryID const&; @@ -239,7 +239,7 @@ namespace test { // we cannot invoke commands without binding required arguments VERIFY_ERROR (WRONG_TYPE, mock.invoke(cmd) ); - // proper argument typing is ensured while dispatching the bind message. + // proper argument typing is ensured while dispatching the bind message. VERIFY_ERROR (WRONG_TYPE, mock.invoke(cmd, Rec({"lalala"})) ); // command can't be issued, since it's still unbound @@ -390,7 +390,7 @@ namespace test { CHECK (nexusLog.verifyEvent("create", "alpha") .beforeCall("mark").on("TestNexus").arg("alpha", "Centauri") // bus API invoked .beforeCall("doMsg").on("alpha").arg("Centauri") // handler on target invoked - .beforeEvent("mark", "Centauri") // target action activated + .beforeEvent("mark", "Centauri") // target action activated .beforeEvent("TestNexus","delivered mark to bID-alpha")); // dispatch done within UI-Bus CHECK (nexusLog.verifyEvent("TestNexus","delivered mark to bID-alpha") @@ -619,7 +619,7 @@ namespace test { ClassLock sync; --generator_instances; } - + /* == Interface IterSource == */ @@ -661,7 +661,7 @@ namespace test { } }; - + /** * launch the Session Thread and start injecting Borgs */ diff --git a/tests/stage/interact/ui-coord-resolver-test.cpp b/tests/stage/interact/ui-coord-resolver-test.cpp index cccc0e858..20132e4e3 100644 --- a/tests/stage/interact/ui-coord-resolver-test.cpp +++ b/tests/stage/interact/ui-coord-resolver-test.cpp @@ -46,12 +46,12 @@ using util::join; -namespace stage { -namespace interact { -namespace test { +namespace stage { +namespace interact{ +namespace test { - using lumiera::error::LERR_(INVALID); - using lumiera::error::LERR_(STATE); + using LERR_(INVALID); + using LERR_(STATE); diff --git a/tests/stage/interact/ui-coord-test.cpp b/tests/stage/interact/ui-coord-test.cpp index 2dc9b7f06..9dd4e129a 100644 --- a/tests/stage/interact/ui-coord-test.cpp +++ b/tests/stage/interact/ui-coord-test.cpp @@ -41,12 +41,12 @@ using util::join; -namespace stage { +namespace stage { namespace interact { -namespace test { +namespace test { - using lumiera::error::LERR_(INDEX_BOUNDS); - using lumiera::error::LERR_(LOGIC); + using LERR_(INDEX_BOUNDS); + using LERR_(LOGIC); diff --git a/tests/vault/gear/scheduler-stress-test.cpp b/tests/vault/gear/scheduler-stress-test.cpp index 3c8007f11..52ade0f2f 100644 --- a/tests/vault/gear/scheduler-stress-test.cpp +++ b/tests/vault/gear/scheduler-stress-test.cpp @@ -382,6 +382,11 @@ namespace test { cpuLoad.calibrate(); //////////////////////////////////////////////////////////////////TODO for development only MARK_TEST_FUN + TestChainLoad testLoad{64}; + testLoad.configure_isolated_nodes() + .buildTopology() + .printTopologyDOT() + .printTopologyStatistics(); struct Setup : StressRig {