Public Member Functions | Public Attributes | Friends

fio_BasicString Class Reference
[Classes for large file i/o, relative file, and DataBase]

<Description:> A more elaborate class description that describes all aspects of class usage etc. More...

#include <fio_BasicString.h>

Inheritance diagram for fio_BasicString:
Inheritance graph
[legend]
Collaboration diagram for fio_BasicString:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 fio_BasicString (const fio_BasicString &s)
 fio_BasicString (fio_RelFileTrans &a_relFileTrans, const string &a_string)
 String is first time occure.
 fio_BasicString (fio_RelFileTrans &a_relFileTrans, ivd_VectorSize_t a_vectorSize, ivd_RecordIDX_t a_vectorIndex)
 Get string from database.
virtual ~fio_BasicString ()
void operator= (const fio_BasicString &s)
void operator= (const string &s)
bool Write2DB (UInt16_t &a_vectorSize, ivd_RecordIDX_t &a_vectorIndex, fio_Transaction &a_trans)
void Dump (ostream &os)

Public Attributes

 log_CLASSID_m

Friends

class ut_fio_String

Detailed Description

<Description:> A more elaborate class description that describes all aspects of class usage etc.

Author:
Dejan Volk Lupo, HERMES SoftLab
See also:
<reference>

Definition at line 55 of file fio_BasicString.h.


Constructor & Destructor Documentation

fio_BasicString::fio_BasicString ( const fio_BasicString s  )  [inline, explicit]

Definition at line 59 of file fio_BasicString.h.

        :
        fio_Vector(s),
        string(s)
    {
        // Empty
    };

fio_BasicString::fio_BasicString ( fio_RelFileTrans a_relFileTrans,
const string &  a_string 
) [explicit]

String is first time occure.

Definition at line 52 of file fio_BasicString.cpp.

            :
            fio_Vector(a_relFileTrans), // it's new
            string(a_string)
{
//    log_FUNC_m(fio_BasicString(string));
    // Empty
}

fio_BasicString::fio_BasicString ( fio_RelFileTrans a_relFileTrans,
ivd_VectorSize_t  a_vectorSize,
ivd_RecordIDX_t  a_vectorIndex 
) [explicit]

Get string from database.

Definition at line 66 of file fio_BasicString.cpp.

References alloca(), fio_Vector::m_changed, and fio_Vector::ReadFromDB().

                :
                fio_Vector(a_relFileTrans, a_vectorSize, a_vectorIndex, false)
//               string(a_vectorSize << 3, 'x')
{
//    log_FUNC_m(fio_BasicString(fio_RelFileTrans, ivd_VectorSize_t, ivd_RecordIDX_t));
    if (  a_vectorSize  > 0
       && a_vectorIndex > 0) {
        int maxStrSize = a_vectorSize * 8 + 1; // +1 in case that string is as large as vectore
        char *buff = reinterpret_cast<char*>(alloca(maxStrSize));
//        ReadFromDB(reinterpret_cast<void*>(const_cast<char*>(data())));
        ReadFromDB(buff);
        buff[maxStrSize - 1] = 0; //
        *this = buff;  // operator = set change flag to true, but it's not true here
        //log_DBG_m(dbg_DETAIL, "Got string " << *this << "  from buff " << buff
        //                   << " vec size " << a_vectorSize
        //                   << " idx " << a_vectorIndex);
        m_changed = false;
    }
}

Here is the call graph for this function:

virtual fio_BasicString::~fio_BasicString (  )  [inline, virtual]

Definition at line 76 of file fio_BasicString.h.

{};


Member Function Documentation

void fio_BasicString::Dump ( ostream &  os  ) 

Reimplemented from fio_Vector.

Definition at line 139 of file fio_BasicString.cpp.

Referenced by hsm_FileHeader::RemoveNameFromHSMDB().

                                     {
    os << " String = " << static_cast<const string>(*this) << endl;
    fio_Vector::Dump(os);
    os << endl;
}

Here is the caller graph for this function:

void fio_BasicString::operator= ( const string &  s  ) 

Reimplemented in fio_String< _REL_FILE >, fio_String<&g_nsNameRF_p >, and fio_String<&g_DirEntName_p >.

Definition at line 98 of file fio_BasicString.cpp.

References log_FUNC_m, fio_Vector::m_changed, and operator=().

                                                    {
        log_FUNC_m(operator=(string));
        m_changed = true;
        string::operator=(s);
    }

Here is the call graph for this function:

void fio_BasicString::operator= ( const fio_BasicString s  ) 

Definition at line 91 of file fio_BasicString.cpp.

References log_FUNC_m.

Referenced by operator=().

Here is the caller graph for this function:

bool fio_BasicString::Write2DB ( UInt16_t a_vectorSize,
ivd_RecordIDX_t a_vectorIndex,
fio_Transaction a_trans 
)

Definition at line 105 of file fio_BasicString.cpp.

References alloca(), cmn_NumOfOctets(), len, and size.

Referenced by hdb_RemoveName(), hsm_FileHeader::RemoveFromActiveList(), hsm_FileHeader::StoreNameOwnRec(), hsm_FileHeader::StoreOldNameOwnRec(), hsm_FHrelc::Truncate(), and fsc_nsNameMgr::Write2DB().

                                                          {

//    log_FUNC_m(Write2DB);

    char *buff = NULL;
    ivd_VectorSize_t size(0);

    int len = length();
    if (len > 0) {

        // allign to 8 bytes,
        size = cmn_NumOfOctets(len);
        int buffSize(size << 3);

        buff = reinterpret_cast<char*>(alloca(buffSize));

        memset(buff + buffSize - 8, 0, 8);
        strncpy(buff, data(), len);
    }

    a_vectorSize = (UInt8_t)size;

    bool ret = fio_Vector::Write2DB(buff, size, a_vectorIndex, a_trans);
    //log_DBG_m(dbg_DETAIL, "Write string " << *this
    //                   << "  from buff " << buff
    //                   << "  vec size " << size
    //                   << " idx " << a_vectorIndex);
    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class ut_fio_String [friend]

Definition at line 56 of file fio_BasicString.h.


Member Data Documentation

Reimplemented from fio_Vector.

Definition at line 76 of file fio_BasicString.h.


The documentation for this class was generated from the following files: