LibPkg
Classes | Public Types | Public Member Functions | List of all members
pkg::status_table Class Reference

A class for mapping package name to package status. More...

#include <status_table.h>

Inheritance diagram for pkg::status_table:
pkg::table

Classes

class  commit_error
 An exception class for reporting failure to commit table. More...
 

Public Types

typedef string key_type
 
typedef status mapped_type
 
typedef std::map< key_type, mapped_type >::const_iterator const_iterator
 

Public Member Functions

 status_table (const string &pathname=string())
 Construct status table. More...
 
virtual ~status_table ()
 Destroy status table. More...
 
const mapped_typeoperator[] (const key_type &key) const
 Get status of package. More...
 
const_iterator begin () const
 Get const iterator for start of table. More...
 
const_iterator end () const
 Get const iterator for end of table. More...
 
const_iterator find (const key_type &key) const
 Find const iterator for package. More...
 
void insert (const key_type &key, const mapped_type &value)
 Set status of package. More...
 
void insert (const status_table &table)
 Set status of packages. More...
 
void clear ()
 Clear status of all packages. More...
 
void commit ()
 Commit changes. More...
 
void rollback ()
 Roll back changes. More...
 
- Public Member Functions inherited from pkg::table
 table ()
 Construct table. More...
 
virtual ~table ()
 Destroy table. More...
 

Additional Inherited Members

- Protected Member Functions inherited from pkg::table
void notify ()
 Notify watchers that a change has occurred. More...
 

Detailed Description

A class for mapping package name to package status.

Member Typedef Documentation

◆ key_type

◆ mapped_type

◆ const_iterator

Constructor & Destructor Documentation

◆ status_table()

pkg::status_table::status_table ( const string &  pathname = string())

Construct status table.

Parameters
pathnamethe pathname of the underlying status file

References rollback().

◆ ~status_table()

pkg::status_table::~status_table ( )
virtual

Destroy status table.

Member Function Documentation

◆ operator[]()

const status_table::mapped_type & pkg::status_table::operator[] ( const key_type key) const

Get status of package.

The table cannot be modified using this operator.

Parameters
keythe package name
Returns
the status of the package

◆ begin()

const_iterator pkg::status_table::begin ( ) const
inline

Get const iterator for start of table.

Returns
the const iterator

Referenced by pkg::pkgbase::fix_dependencies(), insert(), pkg::update::poll(), and pkg::pkgbase::remove_auto().

◆ end()

const_iterator pkg::status_table::end ( ) const
inline

Get const iterator for end of table.

Returns
the const iterator

References clear(), commit(), find(), insert(), and rollback().

Referenced by pkg::pkgbase::fix_dependencies(), insert(), pkg::update::poll(), and pkg::pkgbase::remove_auto().

◆ find()

status_table::const_iterator pkg::status_table::find ( const key_type key) const

Find const iterator for package.

Parameters
keythe package name
Returns
the const iterator, or end() if not found

Referenced by end().

◆ insert() [1/2]

void pkg::status_table::insert ( const key_type key,
const mapped_type value 
)

Set status of package.

The underlying status file will not be modified until the change is committed, but watchers are notified immediately.

Parameters
keythe package name
valuethe required status

References pkg::table::notify().

Referenced by pkg::commit::commit(), end(), pkg::pkgbase::fix_dependencies(), pkg::unpack::poll(), and pkg::pkgbase::remove_auto().

◆ insert() [2/2]

void pkg::status_table::insert ( const status_table table)

Set status of packages.

Parameters
tablethe table from which the values are copied

References begin(), end(), and pkg::table::notify().

◆ clear()

void pkg::status_table::clear ( )

Clear status of all packages.

References pkg::table::notify().

Referenced by pkg::commit::commit(), and end().

◆ commit()

void pkg::status_table::commit ( )

Commit changes.

Any changes since the last call to commit() or rollback() are committed to disc.

References dst_pathname, pkg::force_delete(), pkg::force_move(), and pkg::object_type().

Referenced by pkg::commit::commit(), end(), pkg::unpack::poll(), and pkg::pkgbase::remove_auto().

◆ rollback()

void pkg::status_table::rollback ( )

Roll back changes.

Any changes since the last call to commit() or rollback() are discarded.

Referenced by end(), pkg::unpack::poll(), and status_table().


The documentation for this class was generated from the following files:

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)