SharedMemoryBlockDescriptor.cpp
Go to the documentation of this file.
00001 #include "sharedmem_transport/SharedMemoryBlockDescriptor.h"
00002 
00003 namespace sharedmem_transport {
00004 
00005     SharedMemoryBlockDescriptor::SharedMemoryBlockDescriptor() :
00006         num_clients(0), size_(0), allocated_(0), resize_count_(0), active_(false)
00007     {
00008         name_[0] = 0;
00009     }
00010 
00011     uint32_t SharedMemoryBlockDescriptor::getSize() const {
00012         return size_;
00013     }
00014 
00015     void SharedMemoryBlockDescriptor::recordSize(uint32_t newsize, uint32_t alloc) {
00016         if (newsize > allocated_) {
00017             resize_count_++;
00018         }
00019         if (alloc) {
00020             allocated_ = alloc;
00021         }
00022         size_ = newsize;
00023     }
00024 
00025     void SharedMemoryBlockDescriptor::allocate(const char name[256]) {
00026         memcpy(name_,name,256);
00027         active_ = true;
00028     }
00029 
00030     void SharedMemoryBlockDescriptor::reset() {
00031         active_ = false;
00032         name_[0] = 0;
00033         size_ = 0;
00034         allocated_ = 0;
00035         resize_count_ = 0;
00036     }
00037 
00038     bool SharedMemoryBlockDescriptor::matchName(const char * name) const {
00039         return strncmp(name_,name, 256) == 0;
00040     }
00041 
00042 }


sharedmem_transport
Author(s): Cedric Pradalier
autogenerated on Sat Dec 28 2013 16:57:13