deviceCollection |
iteration over device collection |
fesa::MultiplexingContext* pCtxt = pEvt->getMultiplexingContext(); for (std::vector<Device*>::iterator itr = deviceCol_.begin(); itr != deviceCol_.end(); ++itr) { try { Device* pDev = (*itr); // perform an action with the device pDev->myField.set(someValue,pCtxt); } catch (fesa::FesaException& exception) { } } |
getGlobalDevice |
retrieve the global device |
GlobalDevice* globalDev = !DeviceFactory::getInstance()->getGlobalDevice(); |
getIntField |
retrieve an int32 value |
int32_t myData = (*device)->myField.get(pEvt->getMultiplexingContext()); |
setIntField |
set a field's value |
(*device)->myField.set(myData, pEvt->getMultiplexingContext()); |
getIntArray |
retrieve an int32 array |
uint32_t dim; const int32_t* myData = (*device)->myArrayField.get(dim, pEvt->getMultiplexingContext()); |
setIntArray |
set an in32 array |
uint32_t sizeOfmyData = 4; int32_t myData[sizeOfmyData]; myData[1] = 15; (*device)->myArrayField.set(myData, sizeOfmyData, pEvt->getMultiplexingContext()); |
get2DIntArray |
retrieve an 2D int32 array |
uint32_t dim1; uint32_t dim2; const int32_t** myDataAll = (*device)->my2DArray.get(dim1, dim2, pEvt->getMultiplexingContext()); |
set2DIntArrayRow |
set a row in an 2D int32 array |
uint32_t dim1; uint32_t index = 1; int32_t myDataRow[dim1]; (*device)->my2DArray.setRow(myDataRow, index, dim1, pEvt->getMultiplexingContext()); |
set2DIntArrayColumn |
set a column in an 2D int32 array |
uint32_t dim2; uint32_t index = 1; int32_t myDataColumn[dim2]; (*device)->my2DArray.setColumn(myDataColumn, index, dim2, pEvt->getMultiplexingContext()); |
throwFESAException |
throws a FESA exception to a client |
std::string errorMessage = "Something went wrong here!"; std::string errorCode = "4711"; // errorCategory should use "FESACLASS_" as prefix and the class name std::string errorCategory = "FESACLASS_MyFesaClassName"; throw fesa::FesaException(errorMessage, __FILE__, __LINE__, errorCode, errorCategory); |
deviceCollection in Action I - C++ 11 |
iteration over device collection for the use in RT actions |
const auto& devices = FESAClassServiceLocator_->getDeviceCollection(); for( const auto device : devices ) { try { std::cout << " Name: " << device->name.getAsString() << std::endl; } catch(const fesa::FesaException& exception) { LOG_ERROR_IF(logger, exception.getMessage()); } } |
deviceCollection in Action II - C++ 11 |
iteration over filtered device collection for the use in RT actions (devices relevant for the current event) |
const auto& devices = getFilteredDeviceCollection(pEvt); for( const auto device : devices ) { try { std::cout << " Name: " << device->name.getAsString() << std::endl; } catch(const fesa::FesaException& exception) { LOG_ERROR_IF(logger, exception.getMessage()); } } |
deviceCollection in SpecificInit - C++ 11 |
iteration over device collection for the use in specific initialization method |
const auto& devices = FESAClassServiceLocator_->getDeviceCollection(); for( const auto device : devices ) { try { std::cout << " Name: " << device->name.getAsString() << std::endl; } catch(const fesa::FesaException& exception) { LOG_ERROR_IF(logger, exception.getMessage()); } } |
subsetSelection - C++ 11 |
Iterate over subsets defined in instance file |
// treat data from subsets differently const auto& devices = FESAClassServiceLocator_->getDeviceCollection(); for( const auto device : devices ) { try { boost::shared_ptr<DeviceInstantiationData> instData = device->getInstantiationData(); std::string subset = instData->getSubset(); if (subset.compare("Name of Subset") == 0) { std::cout << "Name of Subset" << std::endl; } } catch (const fesa::FesaException& exception) { LOG_ERROR_IF(logger, exception.getMessage()); } } |