ui_ResultPacker Class Reference
[Command line interface]

#include <ui_helpers.h>

List of all members.


Detailed Description

Packes output result into i_Result.

Author:
Toni Pljakoski, HERMES SoftLab
See also:
<reference>

Definition at line 51 of file ui_helpers.h.


Public Member Functions

 ui_ResultPacker ()
virtual ~ui_ResultPacker ()
const vector< i_UIResult_t > & GetUIResults ()
bool SendResults (i_UIMessageServer_ptr a_uims)
void Insert (const string &a_text, const i_UIAlignType_e a_align=uialign_LEFT)
void Insert (const UInt64_t a_num)
void Insert (const Int64_t a_num)
void Insert (const UInt32_t a_num)
void Insert (const Int32_t a_num)
void Insert (const CORBA::Long a_num)
void Insert (const CORBA::ULong a_num)
void Insert (const i_UIResultType_e a_type, const UInt64_t a_num, const i_UIAlignType_e a_align=uialign_LEFT)
void Insert (const bool a_bool)
void Insert (const char *a_cstr, const i_UIAlignType_e a_align=uialign_LEFT)
void NewRow (bool a_isHeader=false)
void MakeNewBlock ()

Public Attributes

 log_CLASSID_m

Private Member Functions

i_UIResultCell_tNewContainer ()

Private Attributes

vector< i_UIResult_tm_UIResults
UInt32_t m_numOfBlk
UInt32_t m_currentBlockLength

Constructor & Destructor Documentation

ui_ResultPacker::ui_ResultPacker (  ) 

Definition at line 35 of file ui_resultpacker.cpp.

References log_FUNC_m.

00035                                  :
00036     m_numOfBlk(0),
00037     m_currentBlockLength(0)
00038 {
00039     log_FUNC_m(ui_ResultPacker);
00040     
00041     //MakeNewBlock();
00042 }

ui_ResultPacker::~ui_ResultPacker (  )  [virtual]

Definition at line 44 of file ui_resultpacker.cpp.

References log_FUNC_m.

00044                                   {
00045     log_FUNC_m(~ui_ResultPacker);
00046 }


Member Function Documentation

const vector< i_UIResult_t > & ui_ResultPacker::GetUIResults (  ) 

bool ui_ResultPacker::SendResults ( i_UIMessageServer_ptr  a_uims  ) 

void ui_ResultPacker::Insert ( const string &  a_text,
const i_UIAlignType_e  a_align = uialign_LEFT 
)

void ui_ResultPacker::Insert ( const UInt64_t  a_num  ) 

Definition at line 92 of file ui_resultpacker.cpp.

References Insert(), log_FUNC_A_m, m_currentBlockLength, NewContainer(), i_UIResultCell_t::num, i_UIResultCell_t::type, and uires_NUM.

00092                                                  {
00093     log_FUNC_A_m(Insert, "num:" << a_num);
00094     
00095     i_UIResultCell_t& newCell = NewContainer();
00096     newCell.type = uires_NUM;
00097     newCell.num = a_num;
00098     m_currentBlockLength += sizeof(newCell.num);
00099 }

Here is the call graph for this function:

void ui_ResultPacker::Insert ( const Int64_t  a_num  )  [inline]

Definition at line 68 of file ui_helpers.h.

00068                                         {
00069                 Insert(static_cast<const UInt64_t>(a_num)); };

void ui_ResultPacker::Insert ( const UInt32_t  a_num  )  [inline]

Definition at line 70 of file ui_helpers.h.

00070                                          {
00071                 Insert(static_cast<const UInt64_t>(a_num)); };

void ui_ResultPacker::Insert ( const Int32_t  a_num  )  [inline]

Definition at line 72 of file ui_helpers.h.

00072                                         {
00073                 Insert(static_cast<const UInt64_t>(a_num)); };

void ui_ResultPacker::Insert ( const CORBA::Long  a_num  )  [inline]

Definition at line 76 of file ui_helpers.h.

00076                                           {
00077                 Insert(static_cast<const UInt64_t>(a_num)); };

void ui_ResultPacker::Insert ( const CORBA::ULong  a_num  )  [inline]

Definition at line 78 of file ui_helpers.h.

00078                                            {
00079                 Insert(static_cast<const UInt64_t>(a_num)); };

void ui_ResultPacker::Insert ( const i_UIResultType_e  a_type,
const UInt64_t  a_num,
const i_UIAlignType_e  a_align = uialign_LEFT 
)

Definition at line 101 of file ui_resultpacker.cpp.

References i_UIResultCell_t::alignment, Insert(), log_FUNC_A_m, m_currentBlockLength, NewContainer(), i_UIResultCell_t::num, and i_UIResultCell_t::type.

00102                                                             {
00103     log_FUNC_A_m(Insert, "num:" << a_num);
00104     i_UIResultCell_t& newCell = NewContainer();
00105     newCell.alignment = a_align;
00106     newCell.type = a_type;
00107     newCell.num  = a_num;
00108     m_currentBlockLength += sizeof(newCell.num);
00109 }

Here is the call graph for this function:

void ui_ResultPacker::Insert ( const bool  a_bool  ) 

Definition at line 112 of file ui_resultpacker.cpp.

References i_UIResultCell_t::boolVar, Insert(), log_FUNC_A_m, m_currentBlockLength, NewContainer(), i_UIResultCell_t::type, and uires_BOOL.

00112                                               {
00113     log_FUNC_A_m(Insert, "bool:" << a_bool);
00114 
00115     i_UIResultCell_t& newCell = NewContainer();
00116     newCell.type = uires_BOOL;
00117     newCell.boolVar = a_bool;
00118     m_currentBlockLength += sizeof(newCell.boolVar);
00119 }

Here is the call graph for this function:

void ui_ResultPacker::Insert ( const char *  a_cstr,
const i_UIAlignType_e  a_align = uialign_LEFT 
)

Definition at line 121 of file ui_resultpacker.cpp.

References i_UIResultCell_t::alignment, Insert(), log_FUNC_A_m, m_currentBlockLength, NewContainer(), i_UIResultCell_t::text, i_UIResultCell_t::type, and uires_TEXT.

00121                                                                               {
00122     log_FUNC_A_m(Insert, "cstr:" << a_cstr);
00123 
00124     i_UIResultCell_t& newCell = NewContainer();
00125 
00126     newCell.type      = uires_TEXT;
00127     newCell.alignment = a_align;
00128     newCell.text      = CORBA::string_dup(a_cstr);
00129 
00130     m_currentBlockLength += strlen(a_cstr)+1;
00131 }

Here is the call graph for this function:

void ui_ResultPacker::NewRow ( bool  a_isHeader = false  ) 

Definition at line 133 of file ui_resultpacker.cpp.

References dbg_DETAIL, ie_MIF_UIPACKER, ivd_Error, log_DBG_m, log_FUNC_m, m_currentBlockLength, m_UIResults, MakeNewBlock(), MAX_CORBA_UIRESULT_BLOCK_LENGTH, i_UIResult_t::table, i_UIResult_t::type, uiitem_CELL, uiitem_TABLE, and uiitem_UNKNOWN.

Referenced by _tmain(), i_ManagementInterface_i::FileHistory(), i_ManagementInterface_i::ListDriveHosts(), i_ManagementInterface_i::ListDrives(), i_ManagementInterface_i::ListJob(), i_ManagementInterface_i::ListJobs(), i_ManagementInterface_i::ListMedia(), i_ManagementInterface_i::ListMediumVolumes(), i_ManagementInterface_i::ListPartitions(), i_ManagementInterface_i::ListSingleMedium(), i_ManagementInterface_i::ListSlots(), i_ManagementInterface_i::MakeInventoryHeader(), i_ManagementInterface_i::PartitionReorgStat(), i_ManagementInterface_i::PartitionStatus(), i_ManagementInterface_i::PoolReorgStat(), i_ManagementInterface_i::ShowLibraryInventory(), and i_ManagementInterface_i::SystemStatus().

00133                                            {
00134     log_FUNC_m(NewRow);
00135     //Check Block Length
00136     if (m_currentBlockLength == 0){
00137 
00138         //make new block
00139         MakeNewBlock();
00140     }
00141 
00142     if (m_currentBlockLength >= MAX_CORBA_UIRESULT_BLOCK_LENGTH){
00143         //make new block
00144         MakeNewBlock();
00145     }
00146 
00147     i_UIResult_t &lastBlock =  m_UIResults.back();
00148     
00149     if (lastBlock.type == uiitem_UNKNOWN){
00150         log_DBG_m(dbg_DETAIL,"Will set result type to table");
00151         lastBlock.type = uiitem_TABLE;
00152     } 
00153     else if (lastBlock.type == uiitem_CELL) {
00154         throw ivd_Error(ie_MIF_UIPACKER, "Can not invoke new Row on CELL");
00155     }
00156 
00157     log_DBG_m(dbg_DETAIL,"Creating new row");
00158     lastBlock.table.length(lastBlock.table.length() + 1);
00159     lastBlock.table[lastBlock.table.length() -1 ].isHdr = a_isHeader;
00160     
00161   
00162 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ui_ResultPacker::MakeNewBlock (  ) 

Definition at line 49 of file ui_resultpacker.cpp.

References i_UIResultCell_t::alignment, i_UIResultCell_t::boolVar, i_UIResult_t::cell, ipc_nilStr, m_numOfBlk, m_UIResults, i_UIResultCell_t::num, i_UIResultCell_t::text, i_UIResultCell_t::type, i_UIResult_t::type, uialign_LEFT, uiitem_UNKNOWN, and uires_NO_TYPE.

Referenced by i_ManagementInterface_i::ListJob(), and NewRow().

00049                                    {
00050     //log_FUNC_m(MakeNewBlock);
00051 
00052     m_UIResults.resize(m_UIResults.size() + 1);
00053     i_UIResult_t &newBlock =  m_UIResults.back();
00054 
00055     newBlock.type           = uiitem_UNKNOWN;
00056     newBlock.cell.type      = uires_NO_TYPE;
00057     newBlock.cell.alignment = uialign_LEFT;
00058     newBlock.cell.text      = CORBA::string_dup(ipc_nilStr);
00059     newBlock.cell.boolVar   = false;
00060     newBlock.cell.num       = 0;
00061 
00062     m_numOfBlk = m_UIResults.size();
00063 }

Here is the caller graph for this function:

i_UIResultCell_t & ui_ResultPacker::NewContainer (  )  [private]

Definition at line 164 of file ui_resultpacker.cpp.

References i_UIResultCell_t::alignment, i_UIResultCell_t::boolVar, i_UIResult_t::cell, ie_MIF_UIPACKER, ipc_nilStr, ivd_Error, log_FUNC_m, m_UIResults, i_UIResultCell_t::num, i_UIResult_t::table, i_UIResultCell_t::text, i_UIResultCell_t::type, i_UIResult_t::type, uialign_LEFT, uiitem_CELL, uiitem_TABLE, uiitem_UNKNOWN, and uires_NO_TYPE.

Referenced by Insert().

00164                                                {
00165     //log_FUNC_m(NewContainer);
00166         
00167     i_UIResult_t &lastBlock =  m_UIResults.back();
00168     switch (lastBlock.type){
00169         case(uiitem_UNKNOWN):
00170             // NOTE: Fall through on purpose
00171             //log_DBG_m(dbg_DETAIL,"block UNKNOWN");
00172         case(uiitem_CELL):
00173             {
00174                 lastBlock.type = uiitem_CELL;
00175 
00176                 lastBlock.cell.type       = uires_NO_TYPE;
00177                 lastBlock.cell.alignment  = uialign_LEFT;
00178                 lastBlock.cell.text       = CORBA::string_dup(ipc_nilStr);
00179                 lastBlock.cell.boolVar    = false;
00180                 lastBlock.cell.num        = 0;
00181 
00182                 return lastBlock.cell;
00183             }        
00184         case(uiitem_TABLE):
00185             {
00186                 i_UIResultCellSeq_t& currentRow = lastBlock.table[lastBlock.table.length() - 1].row;
00187                
00188                 currentRow.length(currentRow.length() + 1);
00189                 currentRow[currentRow.length() - 1].type      = uires_NO_TYPE;
00190                 currentRow[currentRow.length() - 1].alignment = uialign_LEFT;
00191                 currentRow[currentRow.length() - 1].text      = CORBA::string_dup(ipc_nilStr);
00192                 currentRow[currentRow.length() - 1].boolVar   = false;
00193                 currentRow[currentRow.length() - 1].num       = 0;
00194 
00195                 return currentRow[currentRow.length() - 1];
00196             }
00197         default:
00198             log_FUNC_m(NewContainer);
00199             throw ivd_Error(ie_MIF_UIPACKER,"result type not set");
00200     }
00201 
00202 }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 58 of file ui_helpers.h.

Referenced by GetUIResults(), MakeNewBlock(), NewContainer(), NewRow(), and SendResults().

Definition at line 90 of file ui_helpers.h.

Definition at line 96 of file ui_helpers.h.

Referenced by MakeNewBlock().

Definition at line 97 of file ui_helpers.h.

Referenced by Insert(), and NewRow().


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

Generated on Mon Feb 27 19:51:13 2012 for OPENARCHIVE by  doxygen 1.5.6