base: add 'Volatile_object::print' method

The method prints the message "<unconstructed>" if the object is not
available. Otherwise, it prints the encapsulated object.
This commit is contained in:
Norman Feske 2016-11-02 15:48:25 +01:00 committed by Christian Helmuth
parent a27cbfd371
commit 35fa67768f

View File

@ -142,6 +142,14 @@ class Genode::Volatile_object
MT const *operator -> () const { _check_constructed(); return _const_ptr(); }
MT &operator * () { _check_constructed(); return *_ptr(); }
void print(Output &out) const
{
if (_constructed)
_const_ptr()->print(out);
else
out.out_string("<unconstructed>");
}
};