Lumiera  0.pre.03
»edit your freedom«
stypemanager.hpp
Go to the documentation of this file.
1 /*
2  STYPEMANAGER.hpp - entry point for dealing with media stream types
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 
14 
22 #ifndef STEAM_CONTROL_STYPEMANAGER_H
23 #define STEAM_CONTROL_STYPEMANAGER_H
24 
25 
26 #include "steam/streamtype.hpp"
27 #include "lib/depend.hpp"
28 
29 #include <memory>
30 
31 
32 namespace steam {
33 namespace control {
34 
35  using lib::Symbol;
36 
37 
39  {
40 
41  class Registry;
42  std::unique_ptr<Registry> reg_;
43 
44  public:
46 
48 
49 
52  StreamType const& getType (Symbol sTypeID) ;
53 
54  StreamType const& getType (StreamType::ID stID) ;
55 
57  StreamType const& getType (StreamType::Prototype const& protoType) ;
58 
60  StreamType const& getType (StreamType::ImplFacade const& implType) ;
61 
65  ImplFacade const& getImpl (Symbol libID, StreamType::Prototype const& protoType) ;
66 
70  template<class TY>
71  ImplFacade const& getImpl (Symbol libID, TY& rawType) ;
72 
73 
74 
76  protected:
77  STypeManager() ;
78  ~STypeManager();
79 
81 
87  void reset() ;
88 
89  private:
90  ImplFacade const& fetchImpl (StreamType::ImplFacade::TypeTag);
91  };
92 
93  extern const char* ON_STREAMTYPES_RESET;
94 
95 
96  template<class TY>
98  STypeManager::getImpl (Symbol libID, TY& rawType)
99  {
100  return fetchImpl (ImplFacade::TypeTag (libID,rawType));
101  }
102 
103 
104 }} // namespace steam::control
105 
106 
107 namespace proc_interface {
108 
110 
111 
112 } // namespace proc_interface
113 
114 
115 extern "C" { //TODO provide a separate header if some C code or plugin happens to need this...
116 
122  void
123  lumiera_StreamType_registerInitFunction (void setupFun(void));
124 
125  // TODO provide a C interface usable from such a setupFun to access the STypeManager registration functions.
126 }
127 
128 
129 #endif
Framework for classification of media streams.
opaque placeholder (type erasure) for implementation specific type info.
Definition: streamtype.hpp:169
ImplFacade const & getImpl(Symbol libID, StreamType::Prototype const &protoType)
build or retrieve an implementation (facade) utilizing a specific MediaImplLib and implementing the g...
Steam-Layer implementation namespace root.
Access point to singletons and other kinds of dependencies designated by type.
Definition: depend.hpp:280
A (more or less) concrete implementation type, wired up as a facade providing the basic set of operat...
Definition: streamtype.hpp:99
static lib::Depend< STypeManager > instance
access the system-wide stream type manager instance.
Token or Atom with distinct identity.
Definition: symbol.hpp:117
Singleton services and Dependency Injection.
const char * ON_STREAMTYPES_RESET
triggered to load the generic pristine default
void reset()
Lifecycle: reset all type registration information to the generic pristine default state...
void lumiera_StreamType_registerInitFunction(void setupFun(void))
any stream type implementation, which needs to be present on the pristine default level (without any ...
Helper to abstract creation and lifecycle of a dependency.
Definition: depend.hpp:125
StreamType const & getType(Symbol sTypeID)
(re)-access a media stream type using just a symbolic ID.