30 #ifndef _UCOMMON_MAPPED_H_
31 #define _UCOMMON_MAPPED_H_
33 #ifndef _UCOMMON_LINKED_H_
37 #ifndef _UCOMMON_THREAD_H_
41 #ifndef _UCOMMON_STRING_H_
81 void create(
const char *name,
size_t size = (
size_t)0);
116 static void remove(
const char *name);
122 inline operator bool()
const
123 {
return (size != 0);}
129 inline bool operator!()
const
130 {
return (size == 0);}
139 void *sbrk(
size_t size);
146 void *offset(
size_t offset)
const;
156 bool copy(
size_t offset,
void *buffer,
size_t size)
const;
162 inline size_t len(
void)
const
179 static void disable(
void);
203 inline void create(
const char *fname,
unsigned count)
219 MappedReuse(
const char *name,
size_t size,
unsigned count);
225 bool avail(
void)
const;
279 inline void create(
const char *fn,
unsigned members)
299 {
new((caddr_t)
offset(0)) T[size /
sizeof(T)];}
306 {
return sbrk(
sizeof(T));}
314 {
return static_cast<T*
>(
offset(member *
sizeof(T)));}
321 {
return static_cast<T*
>(
sbrk(
sizeof(T)));}
335 inline unsigned max(
void)
const
336 {
return (
unsigned)(size /
sizeof(T));}
372 {
new((caddr_t)
pos(0)) T[size /
sizeof(T)];}
378 inline operator bool()
const
409 inline T *
pos(
size_t member)
489 {
return static_cast<const T*
>(
offset(member *
sizeof(T)));}
499 inline volatile const T *
get(
unsigned member)
500 {
return static_cast<const T*
>(
offset(member *
sizeof(T)));}
502 inline void copy(
unsigned member, T& buffer)
510 {
return (
unsigned)(size /
sizeof(T));}