| Flutter Impeller |

Public Types | Public Member Functions | Friends | List of all members
impeller::Archive Class Reference

`#include <archive.h>`

## Public Types
using | UnarchiveStep = std::function< bool(ArchiveLocation &)>

## Public Member Functions
| Archive (const std::string &path)
| ~Archive ()
bool | IsValid () const
template<class T , class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>
bool | Write (const T &archivable)
template<class T , class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>
bool | Read (PrimaryKey name, T &archivable)
template<class T , class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>
size_t | Read (UnarchiveStep stepper)

## Friends
class | ArchiveLocation

## Detailed Description

Definition at line 22 of file archive.h.

## Member Typedef Documentation

## ◆ UnarchiveStep

using impeller::Archive::UnarchiveStep = std::function<bool(ArchiveLocation&)>

Definition at line 44 of file archive.h.

## Constructor & Destructor Documentation

## ◆ Archive()

impeller::Archive::Archive | ( | const std::string & | path | ) |

Definition at line 17 of file archive.cc.

18 : database_(std::make_unique<ArchiveDatabase>(path)) {}

## ◆ ~Archive()

impeller::Archive::~Archive | ( |  | ) |

Definition at line 20 of file archive.cc.

20 {
21 FML_DCHECK(transaction_count_ == 0)
22 << "There must be no pending transactions";
23 }

## Member Function Documentation

## ◆ IsValid()

bool impeller::Archive::IsValid | ( |  | ) | const

Definition at line 25 of file archive.cc.

25 {
26 return database_->IsValid();
27 }

Referenced by impeller::testing::TEST_F().

## ◆ Read() [1/2]

template<class T , class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>

bool impeller::Archive::Read | ( | PrimaryKey | name,
|  | T & | archivable
| ) |  |
| inline

Definition at line 39 of file archive.h.

39 {
40 const ArchiveDef& def = T::kArchiveDefinition;
41 return UnarchiveInstance(def, name, archivable);
42 }

Referenced by impeller::testing::TEST_F().

## ◆ Read() [2/2]

template<class T , class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>

size_t impeller::Archive::Read | ( | UnarchiveStep | stepper | ) |
| inline

Definition at line 48 of file archive.h.

48 {
49 const ArchiveDef& def = T::kArchiveDefinition;
50 return UnarchiveInstances(def, stepper);
51 }

## ◆ Write()

template<class T , class = std::enable_if_t<std::is_base_of<Archivable, T>::value>>

bool impeller::Archive::Write | ( | const T & | archivable | ) |
| inline

Definition at line 32 of file archive.h.

32 {
33 const ArchiveDef& def = T::kArchiveDefinition;
34 return ArchiveInstance(def, archivable).has_value();
35 }

Referenced by impeller::testing::TEST_F().

## Friends And Related Function Documentation

## ◆ ArchiveLocation

friend class ArchiveLocation
| friend

Definition at line 57 of file archive.h.

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

- impeller/archivist/archive.h
- impeller/archivist/archive.cc