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) 2025 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 *
6 * https://opensource.org/licenses/MIT. *
7 * *
8 * SPDX-License-Identifier: MIT *
9 ******************************************************************************/
10
11#pragma once
12
13#include <cstdint>
14#include <memory>
15#include <ostream>
16#include <vector>
17
18#include "keypop/calypso/caard/card/FileData.hpp"
19
20namespace keypop {
21namespace calypso {
22namespace card {
23namespace card {
24
25class FileHeader;
26
33public:
39 enum Type {
46
55
63
72
81 };
82
89 virtual uint8_t getSfi() const = 0;
90
97 virtual const std::shared_ptr<FileHeader> getHeader() const = 0;
98
105 virtual const std::shared_ptr<FileData> getData() const = 0;
106
110 friend std::ostream&
111 operator<<(std::ostream& os, const ElementaryFile& ef) {
112 os << "ELEMENTARY_FILE: {"
113 << "SFI: " << ef.getSfi() << ", "
114 << "HEADER: " << ef.getHeader() << ", "
115 << "DATA: " << ef.getData() << "}";
116
117 return os;
118 }
119
123 friend std::ostream&
124 operator<<(std::ostream& os, const std::shared_ptr<ElementaryFile> ef) {
125 if (ef == nullptr) {
126 os << "ELEMENTARY_FILE: null";
127 } else {
128 os << *ef.get();
129 }
130
131 return os;
132 }
133
137 friend std::ostream&
139 std::ostream& os,
140 const std::vector<std::shared_ptr<ElementaryFile>>& ef) {
141 os << "ELEMENTARY_FILES: {";
142
143 for (auto it = ef.begin(); it != ef.end(); it++) {
144 if (it != ef.begin()) {
145 os << ", ";
146 }
147
148 os << *it;
149 }
150
151 os << "}";
152
153 return os;
154 }
155};
156
157} /* namespace card */
158} /* namespace card */
159} /* namespace calypso */
160} /* 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