Lumiera  0.pre.03
»edit your freedom«
abstractmo.hpp
Go to the documentation of this file.
1 /*
2  ABSTRACTMO.hpp - abstract base class for all Media Objects
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 
29 #ifndef MOBJECT_SESSION_ABSTRACTMO_H
30 #define MOBJECT_SESSION_ABSTRACTMO_H
31 
33 #include "lib/symbol.hpp"
34 
35 
36 
37 namespace steam {
38 namespace mobject {
39 namespace session {
40 
41  namespace error = lumiera::error;
42 
43 
48  class AbstractMO
49  : public MObject
50  {
51 
52 
53  /* === some default implementations === */
54 
55  DEFINE_PROCESSABLE_BY (builder::BuilderTool);
56 
57  string
58  initShortID() const
59  {
60  return buildShortID("MObject");
61  }
62 
63  public:
64 
65  Duration&
66  getLength()
67  {
68  return length_;
69  }
70 
71  bool operator== (const MObject& oo) const;
72 
73  protected:
74  void
75  throwIfInvalid() const
76  {
77  if (!isValid())
78  throw error::Fatal ("Invalid MObject in model. Indicates a race "
79  "or similarly broken internal assumptions.");
80  }
81 
82  string buildShortID (lib::Literal typeID, string suffix ="") const;
83  };
84 
85 
86 
87 }}} // namespace steam::mobject::session
88 #endif
inline string literal This is a marker type to indicate that
Definition: symbol.hpp:85
bool operator==(const MObject &oo) const
default/fallback implementation of equality using literal object identity (same address).
Definition: abstractmo.cpp:45
Base class of all BuilderTools, used according to the visitor pattern: each Tool contains the concret...
Core abstraction of the Session model: a media object.
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
MObject is the interface class for all "Media Objects".
Definition: mobject.hpp:79
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:199
Marker types to indicate a literal string and a Symbol.
abstract base class of all MObjects for providing common services.
Definition: abstractmo.hpp:48
Duration is the internal Lumiera time metric.
Definition: timevalue.hpp:477
virtual bool isValid() const =0
MObject self-test (usable for asserting)