|
inlib
1.2.0
|


Public Member Functions | |
| key (ifile &a_file, seek a_seek_parent_dir, const std::string &a_object_name, const std::string &a_object_title, const std::string &a_object_class, uint32 a_object_size) | |
| virtual | ~key () |
| uint16 | cycle () const |
| void | set_cycle (uint16 a_cycle) |
| const std::string & | object_name () const |
| std::string | object_name () |
| const std::string & | object_class () const |
| std::string | object_class () |
| bool | write_self () |
| bool | write_file (uint32 &a_nbytes) |
| void | set_number_of_bytes (uint32 a_n) |
| uint32 | number_of_bytes () const |
| uint32 | object_size () const |
| seek | seek_key () const |
| short | key_length () const |
| char * | data_buffer () |
| const char * | eob () const |
| bool | to_buffer (wbuf &a_wb) const |
Static Public Member Functions | |
| static unsigned int | std_string_record_size (const std::string &x) |
Protected Member Functions | |
| key (const key &a_from) | |
| key & | operator= (const key &) |
| uint32 | record_size (uint32 a_version) const |
| bool | initialize (uint32 a_nbytes) |
Static Protected Member Functions | |
| static std::string | sout (const std::string &a_string) |
Protected Attributes | |
| ifile & | m_file |
| uint32 | m_buf_size |
| char * | m_buffer |
| uint32 | m_nbytes |
| uint32 | m_version |
| uint32 | m_object_size |
| date | m_date |
| uint16 | m_key_length |
| uint16 | m_cycle |
| seek | m_seek_key |
| seek | m_seek_parent_dir |
| std::string | m_object_class |
| std::string | m_object_name |
| std::string | m_object_title |
| inlib::wroot::key::key | ( | ifile & | a_file, |
| seek | a_seek_parent_dir, | ||
| const std::string & | a_object_name, | ||
| const std::string & | a_object_title, | ||
| const std::string & | a_object_class, | ||
| uint32 | a_object_size | ||
| ) | [inline] |
Definition at line 37 of file key.
:m_file(a_file) ,m_buf_size(0) ,m_buffer(0) // Record : ,m_nbytes(0) ,m_version(class_version()) ,m_object_size(a_object_size) ,m_date(0) ,m_key_length(0) ,m_cycle(0) ,m_seek_key(0) ,m_seek_parent_dir(0) ,m_object_class(a_object_class) ,m_object_name(a_object_name) ,m_object_title(a_object_title) { #ifdef INLIB_MEM mem::increment(s_class().c_str()); #endif if(a_object_size) { if(m_file.END()>START_BIG_FILE()) m_version += 1000; } if(m_version>1000) { } else { if(a_seek_parent_dir>START_BIG_FILE()) m_version += 1000; } m_key_length = record_size(m_version); initialize(a_object_size); m_seek_parent_dir = a_seek_parent_dir; }
| virtual inlib::wroot::key::~key | ( | ) | [inline, virtual] |
| inlib::wroot::key::key | ( | const key & | a_from | ) | [inline, protected] |
| uint16 inlib::wroot::key::cycle | ( | ) | const [inline] |
| char* inlib::wroot::key::data_buffer | ( | ) | [inline] |
Definition at line 141 of file key.
{return m_buffer + m_key_length;}
| const char* inlib::wroot::key::eob | ( | ) | const [inline] |
Definition at line 142 of file key.
{return m_buffer + m_buf_size;}
| bool inlib::wroot::key::initialize | ( | uint32 | a_nbytes | ) | [inline, protected] |
Definition at line 216 of file key.
{
uint32 nsize = m_key_length+a_nbytes;
m_date = get_date();
if(a_nbytes) {//GB
m_seek_key = m_file.END();
m_file.set_END(m_seek_key+nsize);
} else { //basket
m_seek_key = 0;
}
delete [] m_buffer;
m_buffer = new char[nsize];
m_buf_size = nsize;
m_nbytes = nsize;
return true;
}
| short inlib::wroot::key::key_length | ( | ) | const [inline] |
Definition at line 139 of file key.
{return m_key_length;}
| uint32 inlib::wroot::key::number_of_bytes | ( | ) | const [inline] |
| const std::string& inlib::wroot::key::object_class | ( | ) | const [inline] |
Definition at line 97 of file key.
{return m_object_class;}
| std::string inlib::wroot::key::object_class | ( | ) | [inline] |
Definition at line 98 of file key.
{return m_object_class;}
| const std::string& inlib::wroot::key::object_name | ( | ) | const [inline] |
Definition at line 94 of file key.
{return m_object_name;}
| std::string inlib::wroot::key::object_name | ( | ) | [inline] |
Definition at line 95 of file key.
{return m_object_name;}
| uint32 inlib::wroot::key::object_size | ( | ) | const [inline] |
Definition at line 136 of file key.
{return m_object_size;}
Definition at line 195 of file key.
{
// Return the size in bytes of the key header structure.
uint32 nbytes = sizeof(m_nbytes);
nbytes += sizeof(short);
nbytes += sizeof(m_object_size);
nbytes += sizeof(date);
nbytes += sizeof(m_key_length);
nbytes += sizeof(m_cycle);
if(a_version>1000) {
nbytes += sizeof(seek);
nbytes += sizeof(seek);
} else {
nbytes += sizeof(seek32);
nbytes += sizeof(seek32);
}
nbytes += std_string_record_size(m_object_class);
nbytes += std_string_record_size(m_object_name);
nbytes += std_string_record_size(m_object_title);
return nbytes;
}
| seek inlib::wroot::key::seek_key | ( | ) | const [inline] |
Definition at line 138 of file key.
{return m_seek_key;}
| void inlib::wroot::key::set_cycle | ( | uint16 | a_cycle | ) | [inline] |
| void inlib::wroot::key::set_number_of_bytes | ( | uint32 | a_n | ) | [inline] |
| static std::string inlib::wroot::key::sout | ( | const std::string & | a_string | ) | [inline, static, protected] |
| static unsigned int inlib::wroot::key::std_string_record_size | ( | const std::string & | x | ) | [inline, static] |
| bool inlib::wroot::key::to_buffer | ( | wbuf & | a_wb | ) | const [inline] |
Definition at line 144 of file key.
{
if(!a_wb.write(m_nbytes)) return false;
short version = m_version;
if(!a_wb.write(version)) return false;
if(!a_wb.write(m_object_size)) return false;
unsigned int date = 0; //FIXME
if(!a_wb.write(date)) return false;
if(!a_wb.write(m_key_length)) return false;
if(!a_wb.write(m_cycle)) return false;
if(version>1000) {
if(!a_wb.write(m_seek_key)) return false;
if(!a_wb.write(m_seek_parent_dir)) return false;
} else {
if(m_seek_key>START_BIG_FILE()) {
m_file.out() << "inlib::wroot::key::to_buffer :"
<< " attempt to write big seek "
<< m_seek_key << " on 32 bits."
<< std::endl;
return false;
}
if(!a_wb.write((seek32)m_seek_key)) return false;
if(m_seek_parent_dir>START_BIG_FILE()) {
m_file.out() << "inlib::wroot::key::to_buffer :"
<< " (2) attempt to write big seek "
<< m_seek_parent_dir << " on 32 bits."
<< std::endl;
return false;
}
if(!a_wb.write((seek32)m_seek_parent_dir)) return false;
}
if(!a_wb.write(m_object_class)) return false;
if(!a_wb.write(m_object_name)) return false;
if(!a_wb.write(m_object_title)) return false;
if(m_file.verbose()) {
m_file.out() << "inlib::wroot::key::to_buffer :"
<< " nbytes : " << m_nbytes
<< ", object class : " << sout(m_object_class)
<< ", object name : " << sout(m_object_name)
<< ", object title : " << sout(m_object_title)
<< ", object size : " << m_object_size
<< "."
<< std::endl;
}
return true;
}
| bool inlib::wroot::key::write_file | ( | uint32 & | a_nbytes | ) | [inline] |
Definition at line 106 of file key.
{
if(!m_file.set_pos(m_seek_key)) {
a_nbytes = 0;
return false;
}
if(!m_file.write_buffer(m_buffer,m_nbytes)) {
a_nbytes = 0;
return false;
}
if(m_file.verbose()) {
m_file.out() << "inlib::wroot::key::write_file :"
<< " writing " << m_nbytes << " bytes"
<< " at address " << m_seek_key
<< " for ID=" << sout(m_object_name)
<< " Title=" << sout(m_object_title) << "."
<< std::endl;
}
delete [] m_buffer; //???
m_buffer = 0;
m_buf_size = 0;
a_nbytes = m_nbytes;
return true;
}
| bool inlib::wroot::key::write_self | ( | ) | [inline] |
uint32 inlib::wroot::key::m_buf_size [protected] |
char* inlib::wroot::key::m_buffer [protected] |
uint16 inlib::wroot::key::m_cycle [protected] |
date inlib::wroot::key::m_date [protected] |
ifile& inlib::wroot::key::m_file [protected] |
uint16 inlib::wroot::key::m_key_length [protected] |
uint32 inlib::wroot::key::m_nbytes [protected] |
std::string inlib::wroot::key::m_object_class [protected] |
std::string inlib::wroot::key::m_object_name [protected] |
uint32 inlib::wroot::key::m_object_size [protected] |
std::string inlib::wroot::key::m_object_title [protected] |
seek inlib::wroot::key::m_seek_key [protected] |
seek inlib::wroot::key::m_seek_parent_dir [protected] |
uint32 inlib::wroot::key::m_version [protected] |
1.7.5.1