rm_String Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

List of all members.


Detailed Description

Definition at line 69 of file rmdb.h.


Public Member Functions

 rm_String ()
 rm_String (const rm_String &a_rmstr)
 rm_String (Int32_t a_lenght)
virtual ~rm_String ()
rm_Stringoperator= (const rm_String &a_rmString)
rm_Stringoperator= (const string &a_string)
rm_Stringoperator= (const char *a_cString)

Public Attributes

char * cvalue_p
 log_CLASSID_m

Private Attributes

UInt32_t m_maxLen

Constructor & Destructor Documentation

rm_String::rm_String (  ) 

Definition at line 34 of file rmstring.cpp.

References ie_ARGUMENT_MISSING, and ivd_Error.

00035     :   m_maxLen(0),
00036         cvalue_p(NULL) {
00037 
00038     throw ivd_Error(ie_ARGUMENT_MISSING,
00039         "Argument (int - string length) for rm_String Constructor is mandatory", true);
00040 }

rm_String::rm_String ( const rm_String a_rmstr  ) 

Definition at line 51 of file rmstring.cpp.

References cvalue_p, and m_maxLen.

00052     : string(""),
00053       m_maxLen(a_rmstr.m_maxLen),
00054       cvalue_p(NULL)  {
00055 
00056     // Prepare memory for char value
00057     cvalue_p = new char[m_maxLen + 1];
00058     cvalue_p[0] = '\0';
00059 
00060     // rm_String <-- char[] operator will be called
00061     (*this) = a_rmstr.cvalue_p;
00062 }

rm_String::rm_String ( Int32_t  a_lenght  ) 

Definition at line 42 of file rmstring.cpp.

References cvalue_p, and m_maxLen.

00043     : m_maxLen(a_length),
00044       cvalue_p(NULL)    {
00045 
00046     // Prepare memory for char value
00047     cvalue_p = new char[m_maxLen + 1];
00048     cvalue_p[0] = '\0'; 
00049 }

rm_String::~rm_String (  )  [virtual]

Definition at line 64 of file rmstring.cpp.

References cvalue_p, ie_DATA_CORRUPTION, and NULL.

00064                       {
00065     // cleanup memory
00066     if (cvalue_p != NULL) {
00067         delete [] cvalue_p;
00068         cvalue_p = NULL;
00069     } else throw ivd_InternalError(
00070         ie_DATA_CORRUPTION, "rm_String corrupt. pointer cvalue_p == NULL", true); 
00071 }


Member Function Documentation

rm_String & rm_String::operator= ( const rm_String a_rmString  ) 

Definition at line 73 of file rmstring.cpp.

00073                                                               {
00074 
00075     //
00076     // this_string is a pointer to this, but is a of a string type.
00077     // dynamic_cast is used, because it is intended for conversion
00078     // from derived class to a base class.
00079     //
00080     //const string *rmAsString = dynamic_cast<string*>((rm_String*)&a_rmString);
00081     const string *rmAsString = dynamic_cast<const string*>(&a_rmString);
00082     (*this) = string::operator=(*rmAsString);
00083 
00084     return (*this);
00085 }

rm_String & rm_String::operator= ( const string &  a_string  ) 

Definition at line 87 of file rmstring.cpp.

References cmn_Num2Str(), cvalue_p, ie_DATA_CORRUPTION, ie_STRING_TOO_LONG, ivd_Error, m_maxLen, and NULL.

00087                                                      {
00088 
00089     if (cvalue_p == NULL) {
00090         throw ivd_InternalError(
00091             ie_DATA_CORRUPTION, "rm_String corrupt. pointer cvalue_p == NULL", true);
00092     }
00093     
00094     if (a_string.length() > m_maxLen) {
00095         throw ivd_Error(ie_STRING_TOO_LONG,
00096             cmn_Num2Str(a_string.length()) + string(">") +
00097             cmn_Num2Str(m_maxLen), true);
00098     }
00099 
00100     string trimmed = a_string.substr(0, m_maxLen);
00101     
00102     strncpy( cvalue_p, trimmed.c_str(), m_maxLen);
00103     cvalue_p[trimmed.length()] = '\0';
00104 
00105     //
00106     // this_string is a pointer to this, but is a of a string type.
00107     // dynamic_cast is used, because it is intended for conversion
00108     // from derived class to a base class.
00109     //
00110     string *this_string = dynamic_cast<string*>(this);
00111 
00112     // string <-- string operator will be called
00113     *this_string = trimmed;
00114     
00115     return *this;
00116 }

Here is the call graph for this function:

rm_String & rm_String::operator= ( const char *  a_cString  ) 

Definition at line 119 of file rmstring.cpp.

References cmn_Num2Str(), cvalue_p, ie_DATA_CORRUPTION, ie_STRING_TOO_LONG, ivd_Error, m_maxLen, and NULL.

00119                                                     {
00120 
00121     if (cvalue_p == NULL) {
00122         throw ivd_InternalError(
00123             ie_DATA_CORRUPTION, "rm_String corrupt. pointer cvalue_p == NULL", true);
00124     }
00125     if (strlen(a_cString) > m_maxLen) {
00126         throw ivd_Error(ie_STRING_TOO_LONG,
00127             cmn_Num2Str(strlen(a_cString)) + string(">") +
00128             cmn_Num2Str(m_maxLen), true);
00129     }
00130     
00131     unsigned int strLength = strlen(a_cString);
00132     if (strLength > m_maxLen) {
00133         strLength = m_maxLen;
00134     }
00135     strncpy( cvalue_p, a_cString, strLength);
00136     cvalue_p[strLength] = '\0';
00137 
00138     //
00139     // this_string is a pointer to this, but is a of a string type.
00140     // dynamic_cast is used, because it is intended for conversion
00141     // from derived class to a base class.
00142     //
00143     
00144     string *this_string = dynamic_cast<string*>(this);
00145 
00146     // string <-- char[] operator will be called
00147     *this_string = cvalue_p;
00148 
00149     return *this;
00150 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 71 of file rmdb.h.

Referenced by operator=(), and rm_String().

Definition at line 74 of file rmdb.h.

Referenced by rm_Operator::GetHost(), i_EfficientRecallJob_i::i_EfficientRecallJob_i(), i_MaintFriJob_i::i_MaintFriJob_i(), i_MigrationJob_i::i_MigrationJob_i(), i_RecallJob_i::i_RecallJob_i(), i_RedundantCopyJob_i::i_RedundantCopyJob_i(), i_ReorgJob_i::i_ReorgJob_i(), i_ThreadJob_i::i_ThreadJob_i(), rm_MajorCol::Insert(), rm_Partition::Insert(), rm_MediumVol::Insert(), rm_Medium::Insert(), rm_Slot::Insert(), rm_MediaPool::Insert(), rm_DiskSubsys::Insert(), rm_DriveHost::Insert(), rm_Drive::Insert(), rm_Library::Insert(), operator=(), rm_Operator::PoolInfo(), rm_Partition::Remove(), rm_DriveHost::Remove(), rm_String(), rm_Partition::Select(), rm_DriveHost::Select(), rm_Operator::SelectAllDriveHosts(), rm_Operator::SelectAllPart(), rm_Drive::SelectByAddr(), rm_Medium::SelectByBarcode(), rm_Slot::SelectByLibAddrType(), rm_MediumVol::SelectByMedVolId(), rm_Partition::SelectByName(), rm_MediaPool::SelectByName(), rm_DiskSubsys::SelectByName(), rm_Drive::SelectByName(), rm_Library::SelectByName(), rm_MediumVol::SelectByPartition(), rm_Medium::SelectByPartition(), rm_Partition::SelectByUuid(), rm_MediaPool::SelectByUUID(), rm_Operator::SelectDrive(), rm_Operator::SelectDriveHost(), rm_Operator::SelectLibrary(), rm_Operator::SelectMajorCol(), rm_Operator::SelectMediaPool(), rm_Operator::SelectMediaPoolbyUUID(), i_ResourceManager_i::SelectPartition(), i_ResourceManager_i::SelectPartitionByUUID(), rm_Partition::Update(), rm_MediumVol::Update(), rm_Medium::Update(), rm_Slot::Update(), rm_MediaPool::Update(), rm_DiskSubsys::Update(), rm_DriveHost::Update(), rm_Drive::Update(), rm_Library::Update(), and ~rm_String().

Definition at line 83 of file rmdb.h.


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

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