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 steam {
41 namespace mobject {
42 namespace session {
43 
44  LUMIERA_ERROR_DECLARE (NO_PARENT_SCOPE);
45  LUMIERA_ERROR_DECLARE (INVALID_SCOPE);
46 
47 
48 
74  class Scope
75  {
76  RefPlacement anchor_;
77 
78  public:
79  Scope (PlacementMO const& constitutingPlacement);
80  Scope ();
81 
82  explicit
83  Scope (PlacementMO::ID const& constitutingPlacement);
84 
85  Scope (Scope const&);
86  Scope& operator= (Scope const&);
87 
88  static const Scope INVALID;
89 
90  static Scope containing (PlacementMO const& aPlacement);
91  static Scope containing (RefPlacement const& refPlacement);
92 
93  operator std::string() const;
94  Scope getParent() const;
95  PlacementMO& getTop() const;
96  bool isValid() const;
97  bool isRoot() const;
98 
99  friend bool operator== (Scope const&, Scope const&);
100  friend bool operator!= (Scope const&, Scope const&);
101  };
102 
103 
104 
105 
106 
111  inline bool
112  operator== (Scope const& scope1, Scope const& scope2)
113  {
114  return scope1.anchor_ == scope2.anchor_;
115  }
116 
117  inline bool
118  operator!= (Scope const& scope1, Scope const& scope2)
119  {
120  return scope1.anchor_ != scope2.anchor_;
121  }
122 
123 
124 
125 
126 }}} // namespace steam::mobject::session
127 #endif
Scope getParent() const
retrieve the parent scope which encloses this scope.
Definition: scope.cpp:214
Scope()
unlocated NIL scope
Definition: scope.cpp:78
Core abstraction: placement of a media object into session context.
LUMIERA_ERROR_DECLARE(NOT_IN_SESSION)
referring to a Placement not known to the current session
static Scope containing(PlacementMO const &aPlacement)
discover the enclosing scope of a given Placement
Definition: scope.cpp:189
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:74
bool isValid() const
check if this scope can be located.
Definition: scope.cpp:236
A generic reference mechanism for Placements, as added to the current session.
static const Scope INVALID
constant invalid scope token.
Definition: scope.hpp:88
Lumiera error handling (C++ interface).
friend bool operator==(Scope const &, Scope const &)
as scopes are constituted by a "scope top" element (placement) registered within the PlacementIndex o...
Definition: scope.hpp:112