HeapMultiplexingDataManager.cpp

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #include <fesa-core/Synchronization/HeapMultiplexingDataManager.h>
00004 
00005 #include <fesa-core/Utilities/Mutex.h>
00006 
00007 
00008 namespace fesa
00009 {
00010 
00011 int32_t HeapMultiplexingDataManager::computeMemorySize()
00012 {
00013     int32_t memorySize = Mutex::getSize();
00014 
00015     // current slot
00016     memorySize += static_cast<int32_t>(sizeof(int32_t));
00017 
00018     // current cycle ID
00019     memorySize += static_cast<int32_t>(sizeof(int32_t));
00020 
00021     return memorySize;
00022 }
00023 
00024 void HeapMultiplexingDataManager::mapMemory(char* address)
00025 {
00026     mutex_ = new Mutex((void*) address);
00027 
00028     currentSlot_ = (int32_t*) (address + Mutex::getSize());
00029     currentCycleId_ = (int32_t*) ((char*) currentSlot_ + sizeof(int32_t));
00030 
00031     *currentSlot_ = -1;
00032     *currentCycleId_ = -1;
00033 }
00034 
00035 } // fesa

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1