Skip to content

Commit

Permalink
Start work on a very simple permissions system.
Browse files Browse the repository at this point in the history
First step for issue opencog#1855
  • Loading branch information
linas committed Nov 4, 2018
1 parent a5f5c7e commit f38148f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion opencog/atomspace/AtomSpace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ using namespace opencog;
AtomSpace::AtomSpace(AtomSpace* parent, bool transient) :
_atom_table(parent? &parent->_atom_table : nullptr, this, transient),
_backing_store(nullptr),
_transient(transient)
_read_only(false)
{
}

Expand All @@ -79,6 +79,17 @@ void AtomSpace::clear_transient()
_atom_table.clear_transient();
}

// An extremely primitive permissions system.
void AtomSpace::set_read_only(void)
{
_read_only = true;
}

void AtomSpace::set_read_write(void)
{
_read_only = false;
}

bool AtomSpace::compare_atomspaces(const AtomSpace& space_first,
const AtomSpace& space_second,
bool check_truth_values,
Expand Down
9 changes: 8 additions & 1 deletion opencog/atomspace/AtomSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AtomSpace

AtomTable& get_atomtable(void) { return _atom_table; }

bool _transient;
bool _read_only;
protected:

/**
Expand All @@ -92,9 +92,16 @@ class AtomSpace
AtomSpace(AtomSpace* parent=nullptr, bool transient=false);
~AtomSpace();

// Transient atomspaces are lighter-weight, faster, but are missing
// some features. They are used during pattern matching, to hold
// temporary results.
void ready_transient(AtomSpace* parent);
void clear_transient();

void set_read_only(void);
void set_read_write(void);
bool get_read_only(void) { return _read_only; }

/// Get the environment that this atomspace was created in.
AtomSpace* get_environ() const {
AtomTable* env = _atom_table.get_environ();
Expand Down

0 comments on commit f38148f

Please sign in to comment.