Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

fsc_nsAttrMgr Class Reference
[G_nsc]

Is a wrapper between nsElement and nsAttrStream. More...

#include <fsc_nsAttrMgr.h>

Collaboration diagram for fsc_nsAttrMgr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 fsc_nsAttrMgr (UInt8_t a_attrIdxType, UInt8_t a_size, ivd_RecordIDX_t a_idx)
 ~fsc_nsAttrMgr (void)
void ChgAttributes (df_SplitInfo &a_splitInfo, fsc_GenInsertAct_e a_genInsAct)
void RemoveAttributes ()
bool Write2DB (UInt8_t &a_elementType, UInt8_t &a_numOfElement, ivd_RecordIDX_t &a_recordIdx, fio_Transaction &a_trans)
void Dump (ostream &os)
df_StandardAttr_tGetStandAttrRef ()
void Pack (df_Packer &a_packer)

Public Attributes

 log_CLASSID_m

Private Member Functions

fsc_MergeStatus_e MergeAttributes (df_SplitInfo &a_splitInfo)
 Attribute from DB and DF must be merged when not all attributes storred and got splitted data form DF.

Private Attributes

fsc_nsAttribIdxType_e m_attrIdxType
 to know if all attributes are set.
fsc_nsAttrStream m_attrStream
 file name
bool m_changed
 need to update in DB
ivd_VectorSize_t m_vectorSizeInDB

Detailed Description

Is a wrapper between nsElement and nsAttrStream.

Its value will be increased when generation of attributes will be add. The only significant work for now is to handle mearging of attributes spreaded on more splits.

Definition at line 55 of file fsc_nsAttrMgr.h.


Constructor & Destructor Documentation

fsc_nsAttrMgr::fsc_nsAttrMgr ( UInt8_t  a_attrIdxType,
UInt8_t  a_size,
ivd_RecordIDX_t  a_idx 
)

Definition at line 51 of file fsc_nsAttrMgr.cpp.

References log_FUNC_m.

        :
        m_attrIdxType(static_cast<fsc_nsAttribIdxType_e>(a_attrIdxType)),
        m_attrStream(*g_nsAttribRF_p, a_size, a_idx),
        m_changed(false),
        m_vectorSizeInDB( (a_idx > 0 && a_size == 0) ? c_fio_numOfDifVector : a_size )
{ 
    log_FUNC_m(fsc_nsAttrMgr);
}

fsc_nsAttrMgr::~fsc_nsAttrMgr ( void   )  [inline]

Definition at line 62 of file fsc_nsAttrMgr.h.

{};


Member Function Documentation

void fsc_nsAttrMgr::ChgAttributes ( df_SplitInfo a_splitInfo,
fsc_GenInsertAct_e  a_genInsAct 
)

Definition at line 91 of file fsc_nsAttrMgr.cpp.

References ait_NOTALLATTR, df_SplitInfo::attrStream, df_SplitInfo::failedDataType, fio_Vector::GetVectorIndex(), giaLAST_GEN_UPDATED, giaNEWEST_GEN, df_SplitInfo::lastSplit, log_FUNC_m, m_attrIdxType, m_attrStream, m_changed, MergeAttributes(), mrgALREADY_IN, mrgCOMPLETED, mrgINSERTED, fsc_nsStream::SetLimitedStream(), df_SplitInfo::splitOffset, and df_Stream::StealFirstStream().

Referenced by fsc_nsElement::ChgAttrib().

                                                                  {    
    log_FUNC_m(ChgAttributes)    ;
    bool splittedData = (!a_splitInfo.lastSplit) || (a_splitInfo.splitOffset > 0);
    if (a_genInsAct == giaNEWEST_GEN){
        if (a_splitInfo.failedDataType) {
            m_attrIdxType = ait_INVMETADATA;
            goto end;
        }
        if (splittedData) {
            m_attrIdxType = ait_NOTALLATTR;
        } else {
            m_attrIdxType = ait_ATTRIB;
        }
    }
    else if (   m_attrIdxType == ait_NOTALLATTR
             && a_genInsAct   == giaLAST_GEN_UPDATED) {

        if (a_splitInfo.failedDataType) {
            m_attrIdxType = ait_INVMETADATA;
            goto end;
        }
        if (splittedData) {
            if (m_attrStream.GetVectorIndex() > 0) {
                // attribute from DB and DF will be merged to DF (a_splitInfo.attrStream)
                switch (MergeAttributes(a_splitInfo)) {
                    case mrgCOMPLETED : 
                        m_attrIdxType = ait_ATTRIB;
                        break;
                    case mrgALREADY_IN : 
                        return;
                        break;
                    case mrgINSERTED :
                        break;
                }
            }
        }
        else {  // data is not splitted
            m_attrIdxType = ait_ATTRIB;
        }
    }
    else {
        return; // skip. reasons: too old generations or already completed
    }
end:
    m_changed = true;
    m_attrStream.SetLimitedStream(a_splitInfo.attrStream.StealFirstStream());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsAttrMgr::Dump ( ostream &  os  )  [inline]

Definition at line 74 of file fsc_nsAttrMgr.h.

References fsc_nsAttrStream::Dump(), and m_attrStream.

Referenced by fsc_nsElement::Dump().

                           {
        m_attrStream.Dump(os);
    };

Here is the call graph for this function:

Here is the caller graph for this function:

df_StandardAttr_t& fsc_nsAttrMgr::GetStandAttrRef (  )  [inline]

Definition at line 78 of file fsc_nsAttrMgr.h.

References fsc_nsAttrStream::GetStandAttrRef(), and m_attrStream.

Referenced by fsc_nsElement::CheckLastGen(), fsc_nsElement::GetStandAttrPtr(), and fsc_nsElement::Pack().

Here is the call graph for this function:

Here is the caller graph for this function:

fsc_MergeStatus_e fsc_nsAttrMgr::MergeAttributes ( df_SplitInfo a_splitInfo  )  [private]

Attribute from DB and DF must be merged when not all attributes storred and got splitted data form DF.

Fill up missing ACL parts and add missing ADS names. return the status of merging: already in - skip it (no changes) completed - change attribute index type to ait_ATTRIB inserted - leave attribute type as is, ait_NOTALLATTR

Definition at line 149 of file fsc_nsAttrMgr.cpp.

References log_FUNC_m, m_attrStream, and fsc_nsAttrStream::MergeAttributes().

Referenced by ChgAttributes().

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsAttrMgr::Pack ( df_Packer a_packer  )  [inline]

Definition at line 80 of file fsc_nsAttrMgr.h.

References m_attrStream, and fsc_nsAttrStream::Pack().

Referenced by fsc_nsElement::Pack().

                                   {
        return m_attrStream.Pack(a_packer);
    };

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsAttrMgr::RemoveAttributes (  ) 

Definition at line 141 of file fsc_nsAttrMgr.cpp.

References log_FUNC_m, m_attrIdxType, m_attrStream, m_changed, NULL, and fsc_nsStream::SetLimitedStream().

Referenced by fsc_nsElement::Remove().

Here is the call graph for this function:

Here is the caller graph for this function:

bool fsc_nsAttrMgr::Write2DB ( UInt8_t a_elementType,
UInt8_t a_numOfElement,
ivd_RecordIDX_t a_recordIdx,
fio_Transaction a_trans 
)

Definition at line 64 of file fsc_nsAttrMgr.cpp.

References c_fio_numOfDifVector, fio_VecQualifers::idx, log_FUNC_m, m_attrIdxType, m_attrStream, m_changed, m_vectorSizeInDB, fio_VecQualifers::size, and fsc_nsStream::Write2DB().

Referenced by fsc_nsElement::Write2DB().

{
    log_FUNC_m(Write2DB);
    if (!m_changed) {
        return false;
    }
    fio_VecQualifers vq(m_vectorSizeInDB, a_recordIdx);
    if (m_attrStream.Write2DB(vq, a_trans)) {
        m_vectorSizeInDB = vq.size;
        if (vq.size == c_fio_numOfDifVector) {
            a_numOfElement = 0;
        }
        else {
            a_numOfElement = vq.size;
        }
        a_recordIdx   = vq.idx;
        a_elementType = m_attrIdxType;
        m_changed = false;
        return true;
    }
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 82 of file fsc_nsAttrMgr.h.

to know if all attributes are set.

When data are splited in DF then special handling is need to collect all attributes.

Definition at line 100 of file fsc_nsAttrMgr.h.

Referenced by ChgAttributes(), RemoveAttributes(), and Write2DB().

file name

Definition at line 103 of file fsc_nsAttrMgr.h.

Referenced by ChgAttributes(), Dump(), GetStandAttrRef(), MergeAttributes(), Pack(), RemoveAttributes(), and Write2DB().

bool fsc_nsAttrMgr::m_changed [private]

need to update in DB

Definition at line 106 of file fsc_nsAttrMgr.h.

Referenced by ChgAttributes(), RemoveAttributes(), and Write2DB().

Definition at line 116 of file fsc_nsAttrMgr.h.

Referenced by Write2DB().


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