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) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
31 #ifndef STEAM_CONTROL_STYPEMANAGER_H
32 #define STEAM_CONTROL_STYPEMANAGER_H
33 
34 
35 #include "steam/streamtype.hpp"
36 #include "lib/depend.hpp"
37 
38 #include <memory>
39 
40 
41 namespace steam {
42 namespace control {
43 
44  using lib::Symbol;
45 
46 
48  {
49 
50  class Registry;
51  std::unique_ptr<Registry> reg_;
52 
53  public:
55 
57 
58 
61  StreamType const& getType (Symbol sTypeID) ;
62 
63  StreamType const& getType (StreamType::ID stID) ;
64 
66  StreamType const& getType (StreamType::Prototype const& protoType) ;
67 
69  StreamType const& getType (StreamType::ImplFacade const& implType) ;
70 
74  ImplFacade const& getImpl (Symbol libID, StreamType::Prototype const& protoType) ;
75 
79  template<class TY>
80  ImplFacade const& getImpl (Symbol libID, TY& rawType) ;
81 
82 
83 
85  protected:
86  STypeManager() ;
87  ~STypeManager();
88 
90 
96  void reset() ;
97 
98  private:
99  ImplFacade const& fetchImpl (StreamType::ImplFacade::TypeTag);
100  };
101 
102  extern const char* ON_STREAMTYPES_RESET;
103 
104 
105  template<class TY>
107  STypeManager::getImpl (Symbol libID, TY& rawType)
108  {
109  return fetchImpl (ImplFacade::TypeTag (libID,rawType));
110  }
111 
112 
113 }} // namespace steam::control
114 
115 
116 namespace proc_interface {
117 
119 
120 
121 } // namespace proc_interface
122 
123 
124 extern "C" { //TODO provide a separate header if some C code or plugin happens to need this...
125 
131  void
132  lumiera_StreamType_registerInitFunction (void setupFun(void));
133 
134  // TODO provide a C interface usable from such a setupFun to access the STypeManager registration functions.
135 }
136 
137 
138 #endif
Framework for classification of media streams.
opaque placeholder (type erasure) for implementation specific type info.
Definition: streamtype.hpp:178
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:289
A (more or less) concrete implementation type, wired up as a facade providing the basic set of operat...
Definition: streamtype.hpp:108
static lib::Depend< STypeManager > instance
access the system-wide stream type manager instance.
Token or Atom with distinct identity.
Definition: symbol.hpp:126
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:134
StreamType const & getType(Symbol sTypeID)
(re)-access a media stream type using just a symbolic ID.