Keypop Calypso Card C++ API 2.0.0
Reference Calypso Card API for C++
ElementaryFile.hpp
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2024 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * This program and the accompanying materials are made available under the *
5 * terms of the MIT License which is available at https://opensource.org/licenses/MIT. *
6 * *
7 * SPDX-License-Identifier: MIT *
8 **************************************************************************************************/
9
10#pragma once
11
12#include <cstdint>
13#include <memory>
14#include <ostream>
15#include <vector>
16
17#include "keypop/calypso/caard/card/FileData.hpp"
18
19namespace keypop {
20namespace calypso {
21namespace card {
22namespace card {
23
24class FileHeader;
25
32public:
38 enum Type {
45
53
61
70
79 };
80
87 virtual uint8_t getSfi() const = 0;
88
95 virtual const std::shared_ptr<FileHeader> getHeader() const = 0;
96
103 virtual const std::shared_ptr<FileData> getData() const = 0;
104
108 friend std::ostream&
109 operator<<(std::ostream& os, const ElementaryFile& ef) {
110 os << "ELEMENTARY_FILE: {" << "SFI: " << ef.getSfi() << ", " << "HEADER: " << ef.getHeader()
111 << ", " << "DATA: " << ef.getData() << "}";
112
113 return os;
114 }
115
119 friend std::ostream&
120 operator<<(std::ostream& os, const std::shared_ptr<ElementaryFile> ef) {
121 if (ef == nullptr) {
122 os << "ELEMENTARY_FILE: null";
123 } else {
124 os << *ef.get();
125 }
126
127 return os;
128 }
129
133 friend std::ostream&
134 operator<<(std::ostream& os, const std::vector<std::shared_ptr<ElementaryFile>>& ef) {
135 os << "ELEMENTARY_FILES: {";
136
137 for (auto it = ef.begin(); it != ef.end(); it++) {
138 if (it != ef.begin()) {
139 os << ", ";
140 }
141
142 os << *it;
143 }
144
145 os << "}";
146
147 return os;
148 }
149};
150
151} /* namespace card */
152} /* namespace card */
153} /* namespace calypso */
154} /* namespace keypop */
virtual const std::shared_ptr< FileHeader > getHeader() const =0
friend std::ostream & operator<<(std::ostream &os, const ElementaryFile &ef)
virtual const std::shared_ptr< FileData > getData() const =0