first shot at Ticket #355: use a default-constructed "invalid" PlacementRef

Making PlacementRef default constructible this way
would resolve the immediate problems; as any access
goes through an index lookup and thus will throw.
The bool check on this special ref yields false,
so this solution seems to fill the bill.
This commit is contained in:
Fischlurch 2009-10-18 01:30:43 +02:00
parent 2e62a3b01b
commit 474c293197
4 changed files with 16 additions and 1 deletions

View file

@ -106,6 +106,13 @@ namespace mobject {
validate(id_);
}
/** Default is an NIL Placement ref. It throws on any access. */
PlacementRef ()
: id_()
{
REQUIRE (!isValid(), "hash-ID clash with existing ID");
}
PlacementRef (PlacementRef const& r) ///< copy ctor
: id_(r.id_)
{

View file

@ -43,7 +43,7 @@ namespace session {
*/
class ScopePath
{
vector<RefPlacement> path_;
vector<Scope> path_;
public:
ScopePath();

View file

@ -42,6 +42,13 @@ namespace session {
}
Scope::Scope ()
: anchor_()
{
REQUIRE (!anchor_.isValid());
}
ScopeLocator::ScopeLocator()
: focusStack_(new QueryFocusStack)
{

View file

@ -59,6 +59,7 @@ namespace session {
public:
Scope (PlacementMO const& constitutingPlacement);
Scope (); ///< unlocated NIL scope
static Scope const& containing (PlacementMO const& aPlacement); //////////////TODO really returning a const& here??
static Scope const& containing (RefPlacement const& refPlacement);