C++ TargetRTS
Loading...
Searching...
No Matches
RTCachedString.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTCachedString_h__
11#define __RTCachedString_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTConfig_h__
18#include <RTConfig.h>
19#endif
20
22{
23public:
24 RTS_INLINE RTCachedString( void );
25 explicit RTCachedString( const char * );
27 ~RTCachedString( void );
28
29 RTS_INLINE operator const char * ( void ) const;
30
31 RTCachedString & operator=( const char * );
32 RTCachedString & operator=( const RTCachedString & );
33
34 RTS_INLINE int operator==( const char * ) const;
35 RTS_INLINE int operator!=( const char * ) const;
36 RTS_INLINE int operator==( const RTCachedString & ) const;
37 RTS_INLINE int operator!=( const RTCachedString & ) const;
38
39 struct Entry
40 {
41 char * value;
42 unsigned use_count;
43 };
44
45 struct Block
46 {
47 enum { Size = 32 };
48
49 Entry entry[ Size ];
50 Block * next;
51 };
52
53private:
54 Entry * _entry;
55
56 static unsigned _size;
57 static unsigned _used;
58 static Entry ** _contents;
59 static Block * _blocks;
60
61 static Entry * add( const char * );
62 static void link( Entry * );
63 static void unlink( Entry * );
64
65 static void lock( void );
66 static void unlock( void );
67};
68
69#if RTS_INLINES
70#include <RTCachedString.inl>
71#endif
72
73#endif // __RTCachedString_h__
Definition: RTCachedString.h:22
Definition: RTCachedString.h:46
Definition: RTCachedString.h:40