fsc_nsAttrMgr Class Reference
[G_nsc]

#include <fsc_nsAttrMgr.h>

Collaboration diagram for fsc_nsAttrMgr:

Collaboration graph
[legend]

List of all members.


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 41 of file fsc_nsAttrMgr.h.


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

Constructor & Destructor Documentation

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

Definition at line 37 of file fsc_nsAttrMgr.cpp.

References log_FUNC_m.

00040         :
00041         m_attrIdxType(static_cast<fsc_nsAttribIdxType_e>(a_attrIdxType)),
00042         m_attrStream(*g_nsAttribRF_p, a_size, a_idx),
00043         m_changed(false),
00044         m_vectorSizeInDB( (a_idx > 0 && a_size == 0) ? c_fio_numOfDifVector : a_size )
00045 { 
00046     log_FUNC_m(fsc_nsAttrMgr);
00047 }
//============================================================================//

fsc_nsAttrMgr::~fsc_nsAttrMgr ( void   )  [inline]

Definition at line 48 of file fsc_nsAttrMgr.h.

00048 {};


Member Function Documentation

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

Definition at line 77 of file fsc_nsAttrMgr.cpp.

References ait_ATTRIB, ait_INVMETADATA, 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().

00078                                                                   {    
00079     log_FUNC_m(ChgAttributes)    ;
00080     bool splittedData = (!a_splitInfo.lastSplit) || (a_splitInfo.splitOffset > 0);
00081     if (a_genInsAct == giaNEWEST_GEN){
00082         if (a_splitInfo.failedDataType) {
00083             m_attrIdxType = ait_INVMETADATA;
00084             goto end;
00085         }
00086         if (splittedData) {
00087             m_attrIdxType = ait_NOTALLATTR;
00088         } else {
00089             m_attrIdxType = ait_ATTRIB;
00090         }
00091     }
00092     else if (   m_attrIdxType == ait_NOTALLATTR
00093              && a_genInsAct   == giaLAST_GEN_UPDATED) {
00094 
00095         if (a_splitInfo.failedDataType) {
00096             m_attrIdxType = ait_INVMETADATA;
00097             goto end;
00098         }
00099         if (splittedData) {
00100             if (m_attrStream.GetVectorIndex() > 0) {
00101                 // attribute from DB and DF will be merged to DF (a_splitInfo.attrStream)
00102                 switch (MergeAttributes(a_splitInfo)) {
00103                     case mrgCOMPLETED : 
00104                         m_attrIdxType = ait_ATTRIB;
00105                         break;
00106                     case mrgALREADY_IN : 
00107                         return;
00108                         break;
00109                     case mrgINSERTED :
00110                         break;
00111                 }
00112             }
00113         }
00114         else {  // data is not splitted
00115             m_attrIdxType = ait_ATTRIB;
00116         }
00117     }
00118     else {
00119         return; // skip. reasons: too old generations or already completed
00120     }
00121 end:
00122     m_changed = true;
00123     m_attrStream.SetLimitedStream(a_splitInfo.attrStream.StealFirstStream());
00124 }

Here is the call graph for this function:

Here is the caller graph for this function:

void fsc_nsAttrMgr::RemoveAttributes (  ) 

Definition at line 127 of file fsc_nsAttrMgr.cpp.

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

Referenced by fsc_nsElement::Remove().

00127                                      {
00128     log_FUNC_m(RemoveAttributes)    ;
00129     m_attrStream.SetLimitedStream(NULL);
00130     m_attrIdxType = ait_NOTALLATTR;
00131     m_changed = true;    
00132 }

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 50 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().

00054 {
00055     log_FUNC_m(Write2DB);
00056     if (!m_changed) {
00057         return false;
00058     }
00059     fio_VecQualifers vq(m_vectorSizeInDB, a_recordIdx);
00060     if (m_attrStream.Write2DB(vq, a_trans)) {
00061         m_vectorSizeInDB = vq.size;
00062         if (vq.size == c_fio_numOfDifVector) {
00063             a_numOfElement = 0;
00064         }
00065         else {
00066             a_numOfElement = vq.size;
00067         }
00068         a_recordIdx   = vq.idx;
00069         a_elementType = m_attrIdxType;
00070         m_changed = false;
00071         return true;
00072     }
00073     return false;
00074 }

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 60 of file fsc_nsAttrMgr.h.

References fsc_nsAttrStream::Dump(), and m_attrStream.

Referenced by fsc_nsElement::Dump().

00060                            {
00061         m_attrStream.Dump(os);
00062     };

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 64 of file fsc_nsAttrMgr.h.

References fsc_nsAttrStream::GetStandAttrRef(), and m_attrStream.

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

00064 { return m_attrStream.GetStandAttrRef();};

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 66 of file fsc_nsAttrMgr.h.

References m_attrStream, and fsc_nsAttrStream::Pack().

Referenced by fsc_nsElement::Pack().

00066                                    {
00067         return m_attrStream.Pack(a_packer);
00068     };

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 135 of file fsc_nsAttrMgr.cpp.

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

Referenced by ChgAttributes().

00135                                                                           {
00136     log_FUNC_m(MergeAttributes);
00137     return m_attrStream.MergeAttributes(a_splitInfo);
00138 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 68 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 86 of file fsc_nsAttrMgr.h.

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

file name

Definition at line 89 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 92 of file fsc_nsAttrMgr.h.

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

Definition at line 102 of file fsc_nsAttrMgr.h.

Referenced by Write2DB().


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

Generated on Mon Feb 27 19:21:47 2012 for OPENARCHIVE by  doxygen 1.5.6