Lumiera  0.pre.03
»edit your freedom«
scope.hpp
Go to the documentation of this file.
1 /*
2  SCOPE.hpp - nested search scope for properties of placement
3 
4  Copyright (C) Lumiera.org
5  2009, 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 
30 #ifndef STEAM_MOBJECT_SESSION_SCOPE_H
31 #define STEAM_MOBJECT_SESSION_SCOPE_H
32 
35 #include "lib/error.hpp"
36 
37 #include <string>
38 
39 
40 namespace lumiera {
41 namespace error {
42  LUMIERA_ERROR_DECLARE (EMPTY_SCOPE_PATH);
43  LUMIERA_ERROR_DECLARE (NO_PARENT_SCOPE);
44  LUMIERA_ERROR_DECLARE (INVALID_SCOPE);
45 }}
46 
47 namespace steam {
48 namespace mobject {
49 namespace session {
50 
51 
52 
78  class Scope
79  {
80  RefPlacement anchor_;
81 
82  public:
83  Scope (PlacementMO const& constitutingPlacement);
84  Scope ();
85 
86  explicit
87  Scope (PlacementMO::ID const& constitutingPlacement);
88 
89  Scope (Scope const&);
90  Scope& operator= (Scope const&);
91 
92  static const Scope INVALID;
93 
94  static Scope containing (PlacementMO const& aPlacement);
95  static Scope containing (RefPlacement const& refPlacement);
96 
97  operator std::string() const;
98  Scope getParent() const;
99  PlacementMO& getTop() const;
100  bool isValid() const;
101  bool isRoot() const;
102 
103  friend bool operator== (Scope const&, Scope const&);
104  friend bool operator!= (Scope const&, Scope const&);
105  };
106 
107 
108 
109 
110 
115  inline bool
116  operator== (Scope const& scope1, Scope const& scope2)
117  {
118  return scope1.anchor_ == scope2.anchor_;
119  }
120 
121  inline bool
122  operator!= (Scope const& scope1, Scope const& scope2)
123  {
124  return scope1.anchor_ != scope2.anchor_;
125  }
126 
127 
128 
129 
130 }}} // namespace steam::mobject::session
131 #endif
Core abstraction: placement of a media object into session context.
#define LUMIERA_ERROR_DECLARE(err)
Forward declare an error constant.
Definition: error.h:71
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
Definition: sequence.hpp:74
A Placement scope within the high-level-model.
Definition: scope.hpp:78
A generic reference mechanism for Placements, as added to the current session.
static const Scope INVALID
constant invalid scope token.
Definition: scope.hpp:92
Lumiera error handling (C++ interface).
Lumiera public interface.
Definition: advice.cpp:113