Keyple Card Calypso C++ Library 2.1.0
Reference Terminal Reader API for C++
FileDataAdapter.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2022 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional information regarding *
5 * copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the terms of the Eclipse *
8 * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 *
9 * *
10 * SPDX-License-Identifier: EPL-2.0 *
11 **************************************************************************************************/
12
13#pragma once
14
15#include <cstdint>
16#include <map>
17#include <memory>
18#include <ostream>
19#include <vector>
20
21/* Keyple Core Util */
22#include "LoggerFactory.h"
23
24/* Calypsonet Terminal alypso */
25#include "FileData.h"
26
27namespace keyple {
28namespace card {
29namespace calypso {
30
31using namespace calypsonet::terminal::calypso::card;
32using namespace keyple::core::util::cpp;
33
40class FileDataAdapter final : public FileData {
41public:
49
57 FileDataAdapter(const std::shared_ptr<FileData> source);
58
64 const std::map<const uint8_t, std::vector<uint8_t>>& getAllRecordsContent() const
65 override;
66
72 const std::vector<uint8_t> getContent() const override;
73
79 const std::vector<uint8_t> getContent(const uint8_t numRecord) const override;
80
86 const std::vector<uint8_t> getContent(const uint8_t numRecord,
87 const uint8_t dataOffset,
88 const uint8_t dataLength) const override;
89
95 const std::shared_ptr<int> getContentAsCounterValue(const int numCounter) const override;
96
102 const std::map<const int, const int> getAllCountersValue() const override;
103
112 void setContent(const uint8_t numRecord, const std::vector<uint8_t>& content);
113
122 void setCounter(const uint8_t numCounter, const std::vector<uint8_t>& content);
123
136 void setContent(const uint8_t numRecord,
137 const std::vector<uint8_t> content,
138 const uint8_t offset);
139
152 void fillContent(const uint8_t numRecord,
153 const std::vector<uint8_t> content,
154 const uint8_t offset);
155
166 void addCyclicContent(const std::vector<uint8_t>& content);
167
171 friend std::ostream& operator<<(std::ostream& os, const FileDataAdapter& fda);
172
173private:
177 const std::unique_ptr<Logger> mLogger = LoggerFactory::getLogger(typeid(FileDataAdapter));
178
182 std::map<const uint8_t, std::vector<uint8_t>> mRecords;
183
184};
185
186}
187}
188}
const std::map< const int, const int > getAllCountersValue() const override
friend std::ostream & operator<<(std::ostream &os, const FileDataAdapter &fda)
const std::shared_ptr< int > getContentAsCounterValue(const int numCounter) const override
void setCounter(const uint8_t numCounter, const std::vector< uint8_t > &content)
void fillContent(const uint8_t numRecord, const std::vector< uint8_t > content, const uint8_t offset)
const std::map< const uint8_t, std::vector< uint8_t > > & getAllRecordsContent() const override
void addCyclicContent(const std::vector< uint8_t > &content)
const std::vector< uint8_t > getContent() const override
void setContent(const uint8_t numRecord, const std::vector< uint8_t > &content)