29 #ifndef _UCOMMON_MAPPED_H_
30 #define _UCOMMON_MAPPED_H_
32 #ifndef _UCOMMON_LINKED_H_
36 #ifndef _UCOMMON_THREAD_H_
40 #ifndef _UCOMMON_STRING_H_
78 void create(
const char *name,
size_t size = (
size_t)0);
84 virtual void *invalid(
void)
const;
89 virtual void fault(
void)
const;
124 static void remove(
const char *name);
130 inline operator bool()
const
131 {
return (size != 0);};
137 inline bool operator!()
const
138 {
return (size == 0);};
147 void *sbrk(
size_t size);
154 void *offset(
size_t offset)
const;
164 bool copy(
size_t offset,
void *buffer,
size_t size)
const;
170 inline size_t len(
void)
187 static void disable(
void);
209 inline void create(
const char *fname,
unsigned count)
225 MappedReuse(
const char *name,
size_t size,
unsigned count);
282 inline void create(
const char *fn,
unsigned members)
283 {MappedMemory::create(fn, members *
sizeof(T));};
301 inline void initialize(
void)
302 {
new((caddr_t)offset(0)) T[size /
sizeof(T)];};
308 inline void *addLock(
void)
309 {
return sbrk(
sizeof(T));};
316 inline T *operator()(
unsigned member)
317 {
return static_cast<T*
>(offset(member *
sizeof(T)));}
323 inline T *operator()(
void)
324 {
return static_cast<T*
>(sbrk(
sizeof(T)));};
331 inline T& operator[](
unsigned member)
332 {
return *(operator()(member));};
339 {
return (
unsigned)(size /
sizeof(T));};
371 inline void initialize(
void)
372 {
new((caddr_t)pos(0)) T[size /
sizeof(T)];};
378 inline operator bool()
const
379 {
return MappedReuse::avail();};
385 inline bool operator!()
const
386 {
return !MappedReuse::avail();};
394 {
return mapped_reuse::get();};
401 inline T* operator*()
402 {
return mapped_reuse::get();};
409 inline T *pos(
size_t member)
410 {
return static_cast<T*
>(MappedReuse::offset(member *
sizeof(T)));};
418 {
return static_cast<T*
>(MappedReuse::get());};
428 {
return static_cast<T*
>(MappedReuse::getTimed(timeout));};
435 inline T *request(
void)
436 {
return static_cast<T*
>(MappedReuse::request());};
443 inline void removeLocked(T *
object)
444 {MappedReuse::removeLocked(
object);};
451 inline T *getLocked(
void)
452 {
return static_cast<T*
>(MappedReuse::getLocked());};
485 inline volatile const T *operator()(
unsigned member)
486 {
return static_cast<const T*
>(offset(member *
sizeof(T)));}
493 inline volatile const T &operator[](
unsigned member)
494 {
return *(operator()(member));};
496 inline volatile const T *
get(
unsigned member)
497 {
return static_cast<const T*
>(offset(member *
sizeof(T)));};
499 inline void copy(
unsigned member, T& buffer)
506 inline unsigned count(
void)
507 {
return (
unsigned)(size /
sizeof(T));};