30 #include "../my_config.h"
42 class pile :
public generic_file
51 pile(
const pile & ref) :
generic_file(ref) { copy_from(ref); };
52 const pile & operator = (
const pile & ref) { detruit(); copy_from(ref);
return *
this; };
53 ~pile() { detruit(); };
65 void push(generic_file *f,
const std::string & label =
"",
bool extend_mode =
false);
76 template <
class T>
bool pop_and_close_if_type_is(T *ptr);
79 generic_file *top() {
if(stack.empty())
return nullptr;
else return stack.back().ptr; };
82 generic_file *bottom() {
if(stack.empty())
return nullptr;
else return stack[0].ptr; };
85 U_I size()
const {
return stack.size(); };
88 bool is_empty()
const {
return stack.empty(); };
91 void clear() { detruit(); };
96 template<
class T>
void find_first_from_top(T * & ref);
99 template<
class T>
void find_first_from_bottom(T * & ref);
121 void clear_label(
const std::string & label);
129 void add_label(
const std::string & label);
133 void sync_write_above(generic_file *ptr);
136 void flush_read_above(generic_file *ptr);
141 bool skippable(skippability direction,
const infinint & amount);
142 bool skip(
const infinint & pos);
144 bool skip_relative(S_I x);
145 infinint get_position()
const;
147 void copy_to(generic_file & ref);
148 void copy_to(generic_file & ref,
const infinint & crc_size, crc * & value);
151 void inherited_read_ahead(
const infinint & amount);
152 U_I inherited_read(
char *a, U_I size);
153 void inherited_write(
const char *a, U_I size);
154 void inherited_sync_write();
155 void inherited_flush_read();
156 void inherited_terminate();
162 std::list<std::string> labels;
167 std::vector<face> stack;
169 void copy_from(
const pile & ref)
174 std::vector<face>::iterator look_for_label(
const std::string & label);
178 template <
class T>
bool pile::pop_and_close_if_type_is(T *ptr)
184 top = stack.back().ptr;
185 ptr =
dynamic_cast<T *
>(top);
199 template <
class T>
void pile::find_first_from_top(T * & ref)
202 for(std::vector<face>::reverse_iterator it = stack.rbegin(); it != stack.rend() && ref ==
nullptr; ++it)
203 ref = dynamic_cast<T *>(it->ptr);
207 template <
class T>
void pile::find_first_from_bottom(T * & ref)
210 for(std::vector<face>::iterator it = stack.begin(); it != stack.end() && ref ==
nullptr; ++it)
211 ref = dynamic_cast<T *>(it->ptr);
U_32 copy_to(generic_file &ref, U_32 size)
small copy (up to 4GB) with CRC calculation
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
generic_file(gf_mode m)
main constructor
this is the interface class from which all other data transfer classes inherit
libdar namespace encapsulate all libdar symbols