ConfigurationField.cpp

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #include <fesa-core/DataStore/ConfigurationField.h>
00004 
00005 
00006 namespace fesa
00007 {
00008 
00009 ConfigFieldString::ConfigFieldString(const std::string& fieldName,
00010                                      DataStore* pDataStore, int32_t size, const DataIntegrity bufferType) :
00011     FieldString(fieldName, Configuration, false, false, false, bufferType,
00012                 pDataStore, size) {
00013 }
00014 
00015 ConfigFieldString::~ConfigFieldString() {
00016 
00017 }
00018 
00019 const char* ConfigFieldString::get() {
00020     return (const char*) this->fieldValue_->activeBuffer(
00021         (char*) this->fieldValue_);
00022 }
00023 
00024 const std::string ConfigFieldString::getAsString() {
00025     const std::string value(this->fieldValue_->activeBuffer(
00026                                 (char*) this->fieldValue_));
00027     return value;
00028 }
00029 
00030 /**************************** END ConfigFieldString **********************/
00031 
00032 ConfigFieldStringArray::ConfigFieldStringArray(const std::string& fieldName,
00033                                                DataStore* pDataStore, int32_t size1, int32_t size2,
00034                                                const DataIntegrity bufferType) :
00035     FieldStringArray(fieldName, Configuration, false, false, false, bufferType,
00036                      pDataStore, size1, size2) {
00037 }
00038 
00039 ConfigFieldStringArray::~ConfigFieldStringArray() {
00040 
00041 }
00042 
00043 const char** ConfigFieldStringArray::get(uint32_t& size1) {
00044     size1 = this->fieldValue_->getActiveCurrentSize();
00045 
00046     return (const char**) pointers_[0][this->fieldValue_->activeBuffer()];
00047 }
00048 
00049 const char* ConfigFieldStringArray::getString(uint32_t index) {
00050     // Check against dynamic dimensions. Exception is thrown in case of out of bound
00051     uint32_t size = this->fieldValue_->getActiveCurrentSize();
00052     if ((index+1) > size) {
00053         throw FesaException(__FILE__, __LINE__,
00054                             FesaErrorFieldCurrentDimensionOutOfBound.c_str(),
00055                             StringUtilities::toString(index).c_str(), this->name_.c_str(),
00056                             StringUtilities::toString(size).c_str());
00057     }
00058     return (const char*) pointers_[0][this->fieldValue_->activeBuffer()][index];
00059 }
00060 
00061 /**************************** END ConfigFieldStringArray **********************/
00062 
00063 } // fesa

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1