Commit graph

2998 commits

Author SHA1 Message Date
2c20d407fc mass clean-up: adapt usage of std::cout pretty much everywhere
- remove unnecessary includes
- expunge all remaining usages of boost::format
- able to leave out the expliti string(elm) in output
- drop various operator<<, since we're now picking up
  custom string conversions automatically
- delete diagnostics headers, which are now largely superfluous
- use newer helper functions occasionally

I didn't blindly change any usage of <iostream> though;
sometimes, just using the output streams right away
seems adequate.
2016-01-07 20:12:46 +01:00
6ae8dc62c7 supplement: a "Make P" free function for our smart-ptr
the usual drill...
only when wrapped into a factory function, RAII is really
airtight, even when used from within expression evaluation.

Thanks C++11 we're now able to provide such en passant
2016-01-07 00:38:20 +01:00
ed92b92158 formatting(#985): use custom string conversion with smart-ptr
our lib::P smart-pointer is built on top of std::shared_ptr,
while additionally delegating comparisons to the pointee.

In a similar vein, I've now added a custom string conversion,
delegating to the pointee, with a type-string as fallback.

Together with the built-in string conversion for output streams,
we should now be able to remove most of the explicit string
conversions and calls to util::str in all of our test code.

This removes the last roadblock towards disentangling the
pretty-printing header includes, which in turn should allow
us to remove any conditional code in the built-in string
conversion of GenNode, Variant and the like. Which basically
was the objective for ticket #985
2016-01-06 06:24:02 +01:00
2cf127e16a formatting(#985): define pretty-printing format for addresses
use a shortened display, showing only the last 4 bytes for diagnostics
since we're typically only interested in spotting "same" and "different",
while the full memory address is irrelevant
2016-01-06 06:24:02 +01:00
ee52a83cb2 stream-output(#985): use custom string conversions
provide a generic overload for the stream inserter operator<<
to use custom string conversions when applicable.

The overload will be disabled when a direct lexical conversion
is possible (which means, we can expect the output stream to
know allready how to print those values, like e.g. all kinds
of numbers).

Additionally, we provide a pretty-printing mechansim for pointers,
to show the address and possibly invoke a custom string conversion
on the pointee
2016-01-06 04:36:53 +01:00
60a7e7acb2 formatting-utils(#985): provide some basics
No more fiddling with printf just to show a number reliably!

simple functions to pretty-print addresses,
doubles and floats (fixed-point, with rounding).

Also make all these basic formatting helpers noexcept
2016-01-06 04:04:56 +01:00
1814b1fc69 type-traits(#985): rework and clean-up our type-traits
include the improved facility to detect the ability
for lexical cast. Also remove the boost dependency
and switch entirely to standard <type_traits>
2016-01-06 02:41:58 +01:00
5be35a407f toString(#985): new minimal string-conversion facility
now placed into the very basic header lib/meta/util.hpp
2016-01-05 23:55:18 +01:00
0c4495a451 reorganisation(#985): move basic typeString implementation into lib::meta
- simple function to pick up the mangled type
- pretty-printing is implemented in format-obj.cpp
- also move the demangleCxx()-Function to that location,
  it starts to be used for real, outside the test framework
2016-01-05 23:34:53 +01:00
f077c14d47 compiler evolution: get rid of a gcc-4.7 workaround
our minimal compiler requirement is gcc-4.9 since the
transition to Debian/Jessie as reference system.

gcc-4.9 is known to treat SFINAE on private fields properly
2016-01-05 23:16:18 +01:00
c104e28ebf inline(#985): provide our own minimal variant of enable_if
this is a stripped-down and very leightweight variant
of the well-known enable_if metaprogramming trick.

Providing this standard variant in a header with minimal
dependencies will allow us to phase out boost inclusions
from many further headers. As a plus, our own variant
is written such as to be more conciese in usage
(no "typename" and no acces of an embedded "::type" menber)
2016-01-05 22:00:53 +01:00
ff7ac5523f clean-up(#985): tighten basic header lib/meta/util.hpp
This header shall provide only very fundamental
metaprogramming helpers, since it is included pervasively
2016-01-05 22:00:53 +01:00
fec0a88753 investigation(#985): solution concept for generic stringify
this includes a reorganisation concept for the header includes,
a minimal version (with minimal include dependencies), and
a generic ostream inserter operator<<
2016-01-05 03:32:24 +01:00
d09a5846d4 basically a working solution for toString in ostream
...and learned a lot about the new type_traits on the way.

As it seems, it is not possible to get a clean error message
when passing an "object" with no custom string conversion;
instead, some overload for an rvalue-ostream kicks in.

probably I'll go for shoing a type string in these cases
2016-01-04 22:21:09 +01:00
83862d2c2d Bugfix: endless loop caused by self re-invocation
our util::_Fmt is more clever than boost::format;
unfortunately "this" is string convertible,
so we end up calling ourselfs until Segfault
2016-01-04 02:29:31 +01:00
b96fd1299d preparation(#985): purge any remaining direct uses of boost::format
now we use boost::format through our own front-end util::_Fmt
solely, which both helps to reduce compilation time and code size,
and gives us a direct string conversion, which automatically
uses any custom operator string() available on arguments.

While desirable as such, I did this conversion now, since
it allows us to get rid of boost::str, which in turn helps
to drill down any remaning uses of our own util::str
2016-01-04 01:38:04 +01:00
286a051088 fix broken logic when matching on events with classifier
the fixed version is actually more permissive,
insofar it matches any type of event, when ID = classifier
(or alternatively it matches events with type = classifier)
2016-01-03 05:11:25 +01:00
c9ea9de54d cover basic up-link and down-link communication in BusTerm_test 2016-01-03 03:37:52 +01:00
540151b56b provide a mock handler for commands and state marks
in the real system, this will be the task of the CoreService,
while here, in test mode, we allow to install handling closures
from the unit-test-code
2016-01-03 03:23:39 +01:00
fc5b59a848 change formatting helper to exploit RTTI (!)
our formatting helper for diagnostics output,
which is primarily used in the unit-tests,
first tries to invoke a custom string conversion.

If that is not possible, it falls back to printing
the demangled type name of the object in question.

With just a minor change we're able to evaluate RTTI here
and print the actual type name, instead of the static
supertype the compiler sees on invocation. We just rely
on the typeid(obj) built-in function.

The only catch is we have to strip the " const*" suffix
(and no, it is not possible to do that on metaprogramming
level, due to the special situation where we have a void*)

This also prompted me to write some util functions for
this often encountered task to check / remove a prefix or suffix
Hopefully I've got those functions correct and safe....
2016-01-02 22:32:42 +01:00
2e4d74747e implement logging overrides in the Test-Nexus implementation
the actual functionality is forwareded to the base class,
which is the regular Nexus Hub
2016-01-02 19:16:37 +01:00
3230660d86 implement, cover and use the log clearing function 2016-01-02 02:00:07 +01:00
c6945a452e need helper functionality for tests to scrap existing log contents
...this is necessary whenever the mocked facility covered
by log matching is managed automatically as singleton,
because then other test cases will leave garbage
in the log
2016-01-02 01:41:53 +01:00
603f9e2b7d DOC: fix some Doxygen link syntax
I worked under the erroneous assumption, that Doxygen
will use its internal entity-IDs as the link-IDs when
generating mardown-links. Yes, this seemed logical and
this would be the way I'd implement it....

But seemingly, Doxygen is not so consistent when it
comes to questions of syntax. The same holds true for
markdown, which lacking a coherent definition anyway.

Another problem is that Doxygen's auto-link generation
frequently fails, for reasons not yet clear to me.
Sometimes it seems to be necessary to give it a nudge
by including the \ref command. While I'm not willing
to go into focussed invstigation of Doxygen syntax
right now, at least I've done a search-and-replace
to remove the malformed links I've written the
last days
2015-12-27 03:16:49 +01:00
dddcbe9994 DOC: supply basics of UI-Bus and generic UI-element protocol
the initial draft of this concept is in place now, and
the first round of unit tests pass. I've got some understanding
of the purpose of the interactions and involved elements
and I'm confident this design is evolving in a sane way.

Note: extensive documentation is in the TiddlyWiki,
here I've just pasted and reworded some paragraphs from there
and integrated them into the Doxygen docs
2015-12-27 01:58:15 +01:00
b9ef66b221 provide and cover a mock implementation of receiving notification messages 2015-12-26 04:40:38 +01:00
3c24b4f8e4 should provide a generic entry point for all "state mark" messages 2015-12-26 03:03:46 +01:00
9aa1fec369 UI-Element protocol: clarify the role of the doExpand() extension point
and let the concrete extension point decide if the corresponding
state change was actually relevant and should be persisted
2015-12-26 00:59:16 +01:00
3a287bf134 implement the generic expand/collapse mechanism 2015-12-25 03:53:26 +01:00
a9552ceace add stubs for the specific implementation within Widget and Controller 2015-12-25 03:51:19 +01:00
5564a51a79 build/platform: make lib SigC++ available for GUI test code
Explanation: sigC++ was already linked as transitive dependency
from gtkmm, since it is used for the "signal-slot" system wihin GTK.
But now we want to use sigC++ itself from our generic UI-Backbone,
so we need to pick up the additional compiler and linker flags
and use them when building the relevant parts of both the application
and the test suite
2015-12-25 03:06:33 +01:00
4d1fcd6dcb implement logging/identification of mock UI elements 2015-12-25 00:41:14 +01:00
972045d8f8 fix a segfault caused by re-entrance
at the point when we're connecting a new node to the UI-Bus,
the new node's BusTerm is not yet initialised, since we need
the uplink connection we're about to create for setting up
this BusTerm.

Consequently, the new nodes's ID is not yet initialised,
so we need to pass this endpoint-ID explicitly to the
registration function.
2015-12-24 22:43:41 +01:00
38e6d635dc implement routing in the UI-Bus hub 2015-12-24 22:27:37 +01:00
37802fd699 complete wiring of nexus and core services
since, by definition, the Nexus is "the" up-link,
all we need is clever overriding of the relevant
handling functions, so the nexus will care for the routing,
while the CoreService cares for command and presentation
state handling
2015-12-19 04:05:21 +01:00
449fa16444 WIP: draft of the UI backbone setup
- front-end handle
- Nexus == routing hub
- CoreService == service access point for command invocation
2015-12-19 03:40:19 +01:00
0f793e0a79 untangle the setup of test nexus 2015-12-18 19:50:57 +01:00
f19ebd63d0 pondering about how to connect the central bus hub
...especially since we need a faked UI backbone for unit testing
2015-12-18 19:50:02 +01:00
af98d75da4 consider the bus side of the generic UI base in more detail
especially define the outline of the bus communication
and connection management
2015-12-18 01:02:19 +01:00
a9a6aabcbc return to topic: UI element protocol
next step will be to rig the mock element and set up
and cover the basic / generic element behaviour

This changeset
 - adapts the (planned) unit test to the semantic of
   the EventLog, which is now fully implemented

 - adjusts the function names on the public Tangible interface,
   to be better in line with the naming convention of the
   corrsponding operations on the UI-Bus:

   * "mark" operations are towards the UI element
   * "note" messages are from the UI element towards some
     state manager, which can be reached via the bus
2015-12-16 02:16:53 +01:00
cb4a0a6e60 change the EventLog header to store a "this" attribute
seems more logical than calling the attribute "ID",
especially since we're now able to use the on("xyz") matcher
2015-12-15 23:44:34 +01:00
c8068496d1 EventLog unit test PASS
so this turned out to be rather expensive,
while actually not difficult to implement.
On the way, I've learned
- how to build a backtracking matcher, based on
  a filtering (monadic) structure and chained lambdas
- learned the hard way how (not) to return a container
  by move-reference
- made first contact with the regular expressions
  now available from the standard library
2015-12-13 05:03:36 +01:00
d0cdae2cee implement matching on regular expressions 2015-12-13 03:24:25 +01:00
42a5668831 implement further match refinements (type, attribute, target) 2015-12-12 23:41:24 +01:00
941fe3a9b9 factor out util function to "stringify" arbitrary arguments
this function is of use also for creating a vector of strings
from a bunch of C-Strings, but it could also be used to
construct other stuff initialised by strings (e.g. RegExps)
2015-12-12 23:18:25 +01:00
33f7fe116a implement refinement filter on log entry's arguments.
Whew! functional programming is such a powerful concept.
You get additional refinement and lazy backtracking
basically for free....
2015-12-12 03:13:32 +01:00
5bc6919bdb implement the specialised event or call-matching logic 2015-12-12 02:23:12 +01:00
80ffdc1f05 provide the remaining, specialised logging calls 2015-12-12 01:35:38 +01:00
261bcc9fdb implement logging of "events" with additional ID / classifier 2015-12-12 01:28:42 +01:00
4522e209fb implement generic log entry with arbitrary fields 2015-12-12 01:24:52 +01:00