7 #ifndef MEMORY_SEGMENT_H
8 #define MEMORY_SEGMENT_H
118 virtual void*
allocate(
size_t size) = 0;
145 virtual void deallocate(
void* ptr,
size_t size) = 0;
303 static void validateName(
const char* name) {
306 }
else if (*name ==
'\0') {
308 }
else if (*name ==
'_') {
310 "Names beginning with '_' are reserved for "
311 "internal use only.");
329 #endif // MEMORY_SEGMENT_H
MemorySegmentError(const char *file, size_t line, const char *what)
General error that can be thrown by a MemorySegment implementation.
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
MemorySegmentOpenError(const char *file, size_t line, const char *what)
virtual void deallocate(void *ptr, size_t size)=0
Free/release a segment of memory.
bool clearNamedAddress(const char *name)
Delete a name previously associated with a segment address.
NamedAddressResult getNamedAddress(const char *name) const
Return the address in the segment that has the given name.
std::pair< bool, void * > NamedAddressResult
Type definition for result returned by getNamedAddress()
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
bool setNamedAddress(const char *name, void *addr)
Associate specified address in the segment with a given name.
virtual bool setNamedAddressImpl(const char *name, void *addr)=0
Implementation of setNamedAddress beyond common validation.
virtual bool allMemoryDeallocated() const =0
Check if all allocated memory was deallocated.
Exception that can be thrown when constructing a MemorySegment object.
virtual bool clearNamedAddressImpl(const char *name)=0
Implementation of clearNamedAddress beyond common validation.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
virtual NamedAddressResult getNamedAddressImpl(const char *name) const =0
Implementation of getNamedAddress beyond common validation.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
virtual ~MemorySegment()
Destructor.
virtual void * allocate(size_t size)=0
Allocate/acquire a fragment of memory.
Exception that is thrown, when allocating space in a MemorySegment results in growing the underlying ...
MemorySegmentGrown(const char *file, size_t line, const char *what)