Flutter Impeller
impeller::ArchiveVector Class Reference

#include <archive_vector.h>

Inheritance diagram for impeller::ArchiveVector:
impeller::Archivable

Public Member Functions

PrimaryKey GetPrimaryKey () const override
 
const std::vector< int64_t > GetKeys () const
 
bool Write (ArchiveLocation &item) const override
 
bool Read (ArchiveLocation &item) override
 
- Public Member Functions inherited from impeller::Archivable
virtual ~Archivable ()=default
 

Static Public Attributes

static ArchiveDef kArchiveDefinition
 

Friends

class ArchiveLocation
 

Detailed Description

Definition at line 12 of file archive_vector.h.

Member Function Documentation

◆ GetKeys()

const std::vector< int64_t > impeller::ArchiveVector::GetKeys ( ) const

Definition at line 30 of file archive_vector.cc.

30  {
31  return keys_;
32 }

◆ GetPrimaryKey()

PrimaryKey impeller::ArchiveVector::GetPrimaryKey ( ) const
overridevirtual

Implements impeller::Archivable.

Definition at line 25 of file archive_vector.cc.

25  {
26  // Archive definition says the keys will be auto assigned.
27  return std::nullopt;
28 }

◆ Read()

bool impeller::ArchiveVector::Read ( ArchiveLocation item)
overridevirtual

Implements impeller::Archivable.

Definition at line 45 of file archive_vector.cc.

45  {
46  std::string flattened;
47  if (!item.Read(kVectorKeys, flattened)) {
48  return false;
49  }
50 
51  std::stringstream stream(flattened);
52  int64_t single = 0;
53  while (stream >> single) {
54  keys_.emplace_back(single);
55  stream.ignore();
56  }
57 
58  return true;
59 }

References impeller::kVectorKeys, and impeller::ArchiveLocation::Read().

◆ Write()

bool impeller::ArchiveVector::Write ( ArchiveLocation item) const
overridevirtual

Implements impeller::Archivable.

Definition at line 34 of file archive_vector.cc.

34  {
35  std::stringstream stream;
36  for (size_t i = 0, count = keys_.size(); i < count; i++) {
37  stream << keys_[i];
38  if (i != count - 1) {
39  stream << ",";
40  }
41  }
42  return item.Write(kVectorKeys, stream.str());
43 }

References impeller::kVectorKeys, and impeller::ArchiveLocation::Write().

Friends And Related Function Documentation

◆ ArchiveLocation

friend class ArchiveLocation
friend

Definition at line 27 of file archive_vector.h.

Member Data Documentation

◆ kArchiveDefinition

ArchiveDef impeller::ArchiveVector::kArchiveDefinition
static
Initial value:
= {
.table_name = "IPLR_vectors",
.members = {kVectorKeys},
}

Definition at line 14 of file archive_vector.h.


The documentation for this class was generated from the following files:
impeller::kVectorKeys
static constexpr const char * kVectorKeys
Definition: archive_vector.cc:18