/usr/include/osl/state/historyState.h is in libosl-dev 0.8.0-1.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* historyState.h
*/
#ifndef _HISTORYSTATE_H
#define _HISTORYSTATE_H
#include "osl/numEffectState.h"
#include <vector>
namespace osl
{
namespace state
{
class HistoryState
#if OSL_WORDSIZE == 32
: public misc::Align16New
#endif
{
NumEffectState initial_state;
mutable NumEffectState current;
mutable bool dirty;
std::vector<Move> moves;
public:
HistoryState();
explicit HistoryState(const SimpleState& initial);
~HistoryState();
void setRoot(const SimpleState&);
void makeMove(Move move);
void unmakeMove();
void makeMovePass();
void unmakeMovePass();
const NumEffectState& state() const {
if (dirty)
update();
return current;
}
operator const NumEffectState& () const { return state(); }
const NumEffectState& initialState() const { return initial_state; }
bool empty() const { return moves.empty(); }
const std::vector<Move>& history() const { return moves; }
bool isConsistent() const { return state().isConsistent(); }
private:
void update() const;
};
class DoUndoMoveLock
{
HistoryState& state;
public:
DoUndoMoveLock(HistoryState& s, Move move) : state(s)
{
state.makeMove(move);
}
~DoUndoMoveLock()
{
state.unmakeMove();
}
};
}
using state::HistoryState;
using state::DoUndoMoveLock;
}
#endif /* _HISTORYSTATE_H */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
|