Lumiera  0.pre.03
»edit your freedom«
model-port.hpp
Go to the documentation of this file.
1 /*
2  MODEL-PORT.hpp - point to pull output data from the model
3 
4  Copyright (C) Lumiera.org
5  2010, 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 
66 #ifndef STEAM_MOBJECT_MODEL_PORT_H
67 #define STEAM_MOBJECT_MODEL_PORT_H
68 
69 #include "steam/asset/pipe.hpp"
70 #include "steam/streamtype.hpp"
71 
72 namespace steam {
73 namespace mobject {
74 
75  LUMIERA_ERROR_DECLARE (INVALID_MODEL_PORT);
76  LUMIERA_ERROR_DECLARE (UNCONNECTED_MODEL_PORT);
77 
78 
79  using asset::ID;
80 
81 
104  class ModelPort
105  {
106  ID<asset::Pipe> id_;
107 
108  public:
109  ModelPort()
111  { }
112 
113  ModelPort (ID<asset::Pipe> refID);
114 
115  // using default copy operations
116 
117 
118  static bool exists (ID<asset::Pipe>);
119 
120  ID<asset::Pipe> pipe() const;
121  ID<asset::Struct> holder() const;
122  StreamType::ID streamType() const;
123 
124  bool
125  isValid() const
126  {
127  return exists (this->id_);
128  }
129 
130  explicit
131  operator bool() const
132  {
133  return isValid();
134  }
135 
136 
137  friend bool
138  operator== (ModelPort const& mp1, ModelPort const& mp2)
139  {
140  return mp1.id_ == mp2.id_;
141  }
142 
143  friend bool
144  operator!= (ModelPort const& mp1, ModelPort const& mp2)
145  {
146  return mp1.id_ != mp2.id_;
147  }
148 
149  friend bool
150  operator< (ModelPort const& mp1, ModelPort const& mp2)
151  {
152  return lib::HashVal(mp1.id_) < lib::HashVal(mp2.id_);
153  }
154 
155  private:
156 
157  };
158 
159 
160 
161 }} // namespace steam::mobject
162 #endif
LUMIERA_ERROR_DECLARE(BUILDER_LIFECYCLE)
Builder activated while in non operational state.
A "processing pipe" represented as Asset.
Framework for classification of media streams.
static bool exists(ID< asset::Pipe >)
check if the global model port registration contains a mapping for the given pipe-ID ...
Steam-Layer implementation namespace root.
ID< asset::Pipe > pipe() const
access the Pipe (ID) of the global model port registered with the ID underlying this model port...
Handle designating a point within the model, where actually output data can be pulled.
Definition: model-port.hpp:104
size_t HashVal
a STL compatible hash value
Definition: hash-value.h:56
ID< asset::Struct > holder() const
access the timeline (or similar structural element) holding a global pipe which corresponds to this m...
StreamType::ID streamType() const
convenience shortcut to access the stream type associated with the pipe-ID corresponding to this mode...
thin wrapper around a size_t hash ID used as primary key for all Asset objects.
Definition: asset.hpp:108