Free Electron
StoreI.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __data_StoreI_h__
8 #define __data_StoreI_h__
9 
10 #define FE_SB_TO_HDR(s) ((SBHeader *)(((FE_UWORD)s)-sizeof(SBHeader)))
11 #define FE_HDR_TO_SB(a) ((void *)(((FE_UWORD)a)+sizeof(SBHeader)))
12 
13 namespace fe
14 {
15 
16 class StoreI;
17 
18 struct SBHeader
19 {
20  StoreI *m_pStore;
21 };
22 
23 
24 /** @brief Base class for state block memeory managers
25 
26  @ingroup data
27 
28  Reference counting is maintained on state blocks that have the attribute
29  _C_.
30  */
31 class FE_DL_EXPORT StoreI : virtual public Component
32 {
33  public:
34 virtual ~StoreI(void) {}
35  /** Create a state block. */
36 virtual void *createSB(void) = 0;
37  /** Create an array of state blocks. */
38 virtual void *createSB(FE_UWORD count) = 0;
39  /** Get the layout for this StoreI. */
40 virtual hp<LayoutSB>& getLayout(void) = 0;
41  /** Set the layout for this StoreI. */
42 virtual void setLayout(sp<LayoutSB>& rspLayout) = 0;
43  /** Get the size of a state block created by this StoreI. */
44 virtual FE_UWORD skipSizeSB(void) = 0;
45 
46  public:
47  friend class LayoutSB;
48  /** Acquire a state block. */
49 virtual void acquireSB(void *stateBlock) = 0;
50  /** Release a state block. */
51 virtual void releaseSB(const RecordSB &r_old) = 0;
52 
53  /** Free the state block.
54  Use only on non-reference counted data blocks.
55  */
56 virtual void freeSB(void *stateBlock) = 0;
57 };
58 
59 } /* namespace */
60 
61 #endif /* __data_StoreI_h__ */
62 
kernel
Definition: namespace.dox:3
Base class for state block memeory managers.
Definition: StoreI.h:31
Safe handle for shared pointer.
Definition: Handled.h:61
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Base for all interfacable components.
Definition: Component.h:20
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Record "type" definition.
Definition: LayoutSB.h:32