Keyple Card Calypso C++ Library 2.2.5.6
Reference Terminal Reader API for C++
FileDataAdapter.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2023 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 Card Calypso */
23
24/* Keyple Core Util */
25#include "LoggerFactory.h"
26
27/* Calypsonet Terminal Calypso */
28#include "FileData.h"
29
30namespace keyple {
31namespace card {
32namespace calypso {
33
34using namespace calypsonet::terminal::calypso::card;
35using namespace keyple::core::util::cpp;
36
43class KEYPLECARDCALYPSO_API FileDataAdapter final : public FileData {
44public:
52
60 FileDataAdapter(const std::shared_ptr<FileData> source);
61
67 const std::map<const uint8_t, std::vector<uint8_t>>& getAllRecordsContent() const
68 override;
69
75 const std::vector<uint8_t> getContent() const override;
76
82 const std::vector<uint8_t> getContent(const uint8_t numRecord) const override;
83
89 const std::vector<uint8_t> getContent(const uint8_t numRecord,
90 const uint8_t dataOffset,
91 const uint8_t dataLength) const override;
92
98 const std::shared_ptr<int> getContentAsCounterValue(const int numCounter) const override;
99
105 const std::map<const int, const int> getAllCountersValue() const override;
106
115 void setContent(const uint8_t numRecord, const std::vector<uint8_t>& content);
116
125 void setCounter(const uint8_t numCounter, const std::vector<uint8_t>& content);
126
139 void setContent(const uint8_t numRecord,
140 const std::vector<uint8_t> content,
141 const int offset);
142
155 void fillContent(const uint8_t numRecord,
156 const std::vector<uint8_t> content,
157 const int offset);
158
169 void addCyclicContent(const std::vector<uint8_t>& content);
170
174 friend std::ostream& operator<<(std::ostream& os, const FileDataAdapter& fda);
175
176private:
180 const std::unique_ptr<Logger> mLogger = LoggerFactory::getLogger(typeid(FileDataAdapter));
181
185 std::map<const uint8_t, std::vector<uint8_t>> mRecords;
186
187};
188
189}
190}
191}
#define KEYPLECARDCALYPSO_API
std::ostream & operator<<(std::ostream &os, const std::shared_ptr< ApduRequestAdapter > ara)