52 #ifndef STEAM_MOBJECT_OUTPUT_MAPPING_H 53 #define STEAM_MOBJECT_OUTPUT_MAPPING_H 61 #include <boost/operators.hpp> 80 template<
typename FUN>
83 template<
typename RET>
89 using OutputMappingMemberFunc = decltype(&DEF::output) ;
93 using Target =
typename Rebinder::Res;
133 typedef _def<DEF>
Setup;
139 std::map<HashVal,HashVal> table_;
142 using Target =
typename Setup::Target;
146 size_t size()
const {
return table_.size(); }
147 bool empty()
const {
return 0 == size(); }
148 void clear() { table_.clear(); }
162 :
public boost::equality_comparable<Resolver, Target
163 , boost::equality_comparable<Resolver>>
169 : thisMapping_(container)
183 PId targetPipeID (pID_);
184 return thisMapping_.resolveTarget (targetPipeID);
199 operator= (
PPipe newPipe2map)
201 REQUIRE (newPipe2map);
202 pID_ = newPipe2map->getID();
220 throw error::Logic{
"attempt to resolve an unconnected output mapping" 221 , LERR_(UNCONNECTED)};
232 operator bool()
const 243 return a.pID_ == b.pID_;
247 operator== (
Resolver const& rr, Target
const& tval)
249 return rr.resolve() == tval;
262 contains (
PId mapping4sourcePipeID)
264 return util::contains (table_, mapping4sourcePipeID);
268 contains (
PPipe sourcePipe)
271 or this->contains (sourcePipe->getID());
278 resolveTarget (
PId mappedPipeID)
280 return DEF::output (mappedPipeID);
284 buildResolutionWrapper (
HashVal tableSlot)
286 ASSERT (this->contains (tableSlot));
287 return Resolver (*
this, table_[tableSlot]);
331 if (not contains (sourcePipeID))
335 table_[sourcePipeID] = _mapping::resolveQuery (query4pipe);
337 return buildResolutionWrapper (sourcePipeID);
348 return (*
this) [pipe->getID()];
386 HashVal hash4query = _mapping::slot (query4pipe);
387 if (not contains (hash4query))
390 auto addEntry = [&](
auto query)
392 table_[hash4query] = _mapping::resolveQuery (query);
395 if (uint seqNr = _mapping::is_defaults_query_with_channel (query4pipe))
399 PPipe corresponding_sourcePipe
401 _mapping::build_corresponding_sourceQuery (query4pipe));
402 ENSURE (corresponding_sourcePipe);
404 PId sourcePipeID = corresponding_sourcePipe->getID();
405 addEntry (DEF::buildQuery (sourcePipeID, seqNr));
408 addEntry (query4pipe);
411 ENSURE (this->contains (hash4query));
412 return buildResolutionWrapper (hash4query);
A "processing pipe" represented as Asset.
Basic and generic representation of an internal query.
bool isValid() const
< is this a valid connected mapping?
Steam-Layer implementation namespace root.
static StructFactory retrieve
storage for the static StructFactory instance
Derived specific exceptions within Lumiera's exception hierarchy.
Resolver operator[](PId sourcePipeID)
standard map-style access to an OutputMapping.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
Lumiera error handling (C++ interface).
Hash value types and utilities.
size_t HashVal
a STL compatible hash value
OutputMapping is a facility to resolve output designations.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Generic interface to express a query for specifically typed result elements exposing some capabilitie...
string resolve(fsys::path iniSpec)
use the general mechanism for resolving a search path to get the absolute path of the setup...
thin wrapper around a size_t hash ID used as primary key for all Asset objects.