Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
asset-diagnostics.hpp
Go to the documentation of this file.
1/*
2 ASSET-DIAGNOSTICS.hpp - collection of test and debug helpers
3
4 Copyright (C)
5 2008, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
23#ifndef ASSET_ASSET_DIAGNOSTICS_H
24#define ASSET_ASSET_DIAGNOSTICS_H
25
26
28#include "lib/format-string.hpp"
29#include "lib/format-cout.hpp"
30#include "lib/util-foreach.hpp"
31#include "lib/util.hpp"
32
33#include <functional>
34
35using util::contains;
36using util::for_each;
37using util::_Fmt;
38using std::placeholders::_1;
39using std::bind;
40using std::string;
41using std::cout;
42
43
44namespace steam {
45namespace asset {
46
47 inline void
48 dump (PcAsset const& aa)
49 {
50 if (!aa)
51 cout << "Asset(NULL)\n";
52 else
53 {
54 _Fmt fmt("%s %|50T.| id=%s adr=%p smart-ptr=%p use-count=%u");
55 cout << fmt % aa % aa->getID() % (void*)aa.get() % &aa % (aa.use_count() - 1) << "\n";
56 } }
57
58
59 inline void
61 {
62 list<PcAsset> assets (AssetManager::instance().listContent());
63 cout << "----all-registered-Assets----\n";
64 for (auto const& pA : assets)
65 dump (pA);
66 }
67
68
69 template<class CHI, class PAR>
70 inline bool
72 {
73 return (child == parent)
74 or (0 < child->getParents().size()
75 and (parent == child->getParents()[0])
76 and (contains (parent->getDependant(), child)))
77 ;
78 }
79
80
81
82
83}} // namespace steam::asset
84#endif
Steam-Layer Interface: Asset Lookup and Organisation.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Definition p.hpp:77
TAR * get() const
Definition p.hpp:94
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
A front-end for using printf-style formatting.
Automatically use custom string conversion in C++ stream output.
Front-end for printf-style string template interpolation.
The asset subsystem of the Steam-Layer.
bool dependencyCheck(lib::P< CHI > child, lib::P< PAR > parent)
Steam-Layer implementation namespace root.
bool contains(MAP &map, typename MAP::key_type const &key)
shortcut for containment test on a map
Definition util.hpp:230
disable_if< can_IterForEach< Container >, FUN > for_each(Container const &coll, FUN doIt)
operate on all elements of a STL container.
Perform operations "for each element" of a collection.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...